Skip to content

Release 2.6.3 #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2.6.3
Aug 25, 2019

FIX: Index out of bound error on multi line clear cells #151

2.6.2
Aug 09, 2019

Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ intellij {
downloadSources = false
}
publishPlugin {
username = System.getenv().getOrDefault('JI_USER', '')
password = System.getenv().getOrDefault('JI_PASSWORD', '')
token = System.getenv().getOrDefault('JI_TOKEN', '')
channels = [System.getenv().getOrDefault('JI_CHANNELS', 'Testing')]
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://www.jetbrains.com/intellij-repository/snapshots

name='CSV Plugin'
pluginVersion=2.6.2
pluginVersion=2.6.3
javaVersion=1.8
javaTargetVersion=1.8
downloadIntellijSources=false
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,9 @@ public final Object[][] removeRows(int[] indices) {
currentRows.sort(Collections.reverseOrder());
TableDataHandler dataHandler = getDataHandler();
Object[][] currentData = dataHandler.getCurrentState();
int offset = getFileEditorState().getFixedHeaders() ? 1 : 0;
for (int currentRow : currentRows) {
currentData = ArrayUtil.remove(currentData, currentRow + (getFileEditorState().getFixedHeaders() ? 1 : 0));
currentData = ArrayUtil.remove(currentData, currentRow + offset);
}
updateTableComponentData(dataHandler.addState(currentData));
return currentData;
Expand All @@ -414,10 +415,8 @@ public final Object[][] addColumn(int focusedColumnIndex, boolean before) {
public final Object[][] removeColumns(int[] indices) {
List<Integer> currentColumns = Ints.asList(indices);
currentColumns.sort(Collections.reverseOrder());

TableDataHandler dataHandler = getDataHandler();
Object[][] currentData = dataHandler.getCurrentState();

for (int currentColumn : currentColumns) {
for (int i = 0; i < currentData.length; ++i) {
currentData[i] = ArrayUtil.remove(currentData[i], currentColumn);
Expand All @@ -426,4 +425,17 @@ public final Object[][] removeColumns(int[] indices) {
updateTableComponentData(dataHandler.addState(currentData));
return currentData;
}

public final Object[][] clearCells(int[] columns, int[] rows) {
TableDataHandler dataHandler = getDataHandler();
Object[][] currentData = dataHandler.getCurrentState();
int offset = getFileEditorState().getFixedHeaders() ? 1 : 0;
for (int currentColumn : columns) {
for (int currentRow : rows) {
currentData[currentRow + offset][currentColumn] = "";
}
}
updateTableComponentData(dataHandler.addState(currentData));
return currentData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.seesharpsoft.intellij.plugins.csv.editor.CsvFileEditorProvider;

import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
Expand Down Expand Up @@ -184,25 +183,17 @@ public void actionPerformed(ActionEvent e) {
try {
JBTable table = csvTableEditor.getTable();
int[] selectedRows = table.getSelectedRows();
if (selectedRows == null || selectedRows.length == 0) {
return;
}
int[] selectedColumns = table.getSelectedColumns();
if (selectedColumns == null || selectedColumns.length == 0) {

if (selectedRows == null || selectedRows.length == 0 ||
selectedColumns == null || selectedColumns.length == 0) {
return;
}

int focusedRow = table.getSelectedRow();
int focusedColumn = table.getSelectedColumn();

DefaultTableModel tableModel = csvTableEditor.getTableModel();

for (int row : selectedRows) {
for (int column : selectedColumns) {
tableModel.setValueAt("", row, column);
}
}

csvTableEditor.syncTableModelWithUI();
csvTableEditor.clearCells(selectedColumns, selectedRows);

selectCell(table, focusedRow, focusedColumn);
} finally {
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@

<change-notes><![CDATA[
<pre style="font-family: sans-serif">
FIX: AssertionError: Already disposed Project #147
FIX: No fallback font used in table editor #145
FIX: Index out of bound error on multi line clear cells #151
</pre>
]]>
</change-notes>
Expand Down