Skip to content

Commit 0fc5289

Browse files
authored
Merge pull request #153 from SeeSharpSoft/master
Release 2.6.3
2 parents 7306e99 + e084797 commit 0fc5289

File tree

6 files changed

+28
-22
lines changed

6 files changed

+28
-22
lines changed

CHANGELOG

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2.6.3
2+
Aug 25, 2019
3+
4+
FIX: Index out of bound error on multi line clear cells #151
5+
16
2.6.2
27
Aug 09, 2019
38

build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ intellij {
7878
downloadSources = false
7979
}
8080
publishPlugin {
81-
username = System.getenv().getOrDefault('JI_USER', '')
82-
password = System.getenv().getOrDefault('JI_PASSWORD', '')
81+
token = System.getenv().getOrDefault('JI_TOKEN', '')
8382
channels = [System.getenv().getOrDefault('JI_CHANNELS', 'Testing')]
8483
}
8584

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://www.jetbrains.com/intellij-repository/snapshots
44

55
name='CSV Plugin'
6-
pluginVersion=2.6.2
6+
pluginVersion=2.6.3
77
javaVersion=1.8
88
javaTargetVersion=1.8
99
downloadIntellijSources=false

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditor.java

+15-3
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,9 @@ public final Object[][] removeRows(int[] indices) {
392392
currentRows.sort(Collections.reverseOrder());
393393
TableDataHandler dataHandler = getDataHandler();
394394
Object[][] currentData = dataHandler.getCurrentState();
395+
int offset = getFileEditorState().getFixedHeaders() ? 1 : 0;
395396
for (int currentRow : currentRows) {
396-
currentData = ArrayUtil.remove(currentData, currentRow + (getFileEditorState().getFixedHeaders() ? 1 : 0));
397+
currentData = ArrayUtil.remove(currentData, currentRow + offset);
397398
}
398399
updateTableComponentData(dataHandler.addState(currentData));
399400
return currentData;
@@ -414,10 +415,8 @@ public final Object[][] addColumn(int focusedColumnIndex, boolean before) {
414415
public final Object[][] removeColumns(int[] indices) {
415416
List<Integer> currentColumns = Ints.asList(indices);
416417
currentColumns.sort(Collections.reverseOrder());
417-
418418
TableDataHandler dataHandler = getDataHandler();
419419
Object[][] currentData = dataHandler.getCurrentState();
420-
421420
for (int currentColumn : currentColumns) {
422421
for (int i = 0; i < currentData.length; ++i) {
423422
currentData[i] = ArrayUtil.remove(currentData[i], currentColumn);
@@ -426,4 +425,17 @@ public final Object[][] removeColumns(int[] indices) {
426425
updateTableComponentData(dataHandler.addState(currentData));
427426
return currentData;
428427
}
428+
429+
public final Object[][] clearCells(int[] columns, int[] rows) {
430+
TableDataHandler dataHandler = getDataHandler();
431+
Object[][] currentData = dataHandler.getCurrentState();
432+
int offset = getFileEditorState().getFixedHeaders() ? 1 : 0;
433+
for (int currentColumn : columns) {
434+
for (int currentRow : rows) {
435+
currentData[currentRow + offset][currentColumn] = "";
436+
}
437+
}
438+
updateTableComponentData(dataHandler.addState(currentData));
439+
return currentData;
440+
}
429441
}

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/swing/CsvTableEditorActions.java

+5-14
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import net.seesharpsoft.intellij.plugins.csv.editor.CsvFileEditorProvider;
99

1010
import javax.swing.*;
11-
import javax.swing.table.DefaultTableModel;
1211
import java.awt.*;
1312
import java.awt.event.ActionEvent;
1413
import java.awt.event.ActionListener;
@@ -184,25 +183,17 @@ public void actionPerformed(ActionEvent e) {
184183
try {
185184
JBTable table = csvTableEditor.getTable();
186185
int[] selectedRows = table.getSelectedRows();
187-
if (selectedRows == null || selectedRows.length == 0) {
188-
return;
189-
}
190186
int[] selectedColumns = table.getSelectedColumns();
191-
if (selectedColumns == null || selectedColumns.length == 0) {
187+
188+
if (selectedRows == null || selectedRows.length == 0 ||
189+
selectedColumns == null || selectedColumns.length == 0) {
192190
return;
193191
}
192+
194193
int focusedRow = table.getSelectedRow();
195194
int focusedColumn = table.getSelectedColumn();
196195

197-
DefaultTableModel tableModel = csvTableEditor.getTableModel();
198-
199-
for (int row : selectedRows) {
200-
for (int column : selectedColumns) {
201-
tableModel.setValueAt("", row, column);
202-
}
203-
}
204-
205-
csvTableEditor.syncTableModelWithUI();
196+
csvTableEditor.clearCells(selectedColumns, selectedRows);
206197

207198
selectCell(table, focusedRow, focusedColumn);
208199
} finally {

src/main/resources/META-INF/plugin.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646

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

0 commit comments

Comments
 (0)