GT-3352 - Structure Editor - 'Delete Selected Components' - review fixes

This commit is contained in:
dragonmacher 2019-12-04 11:22:51 -05:00
parent 291e61b0c6
commit 5a3deaa7f6

View file

@ -164,6 +164,7 @@ public abstract class CompEditorModel extends CompositeEditorModel {
if (updatingSelection) { if (updatingSelection) {
return; return;
} }
FieldSelection tmpSelection = new FieldSelection(); FieldSelection tmpSelection = new FieldSelection();
// allow any single row to be selected // allow any single row to be selected
if (rows.length == 1) { if (rows.length == 1) {
@ -172,10 +173,10 @@ public abstract class CompEditorModel extends CompositeEditorModel {
else { else {
// restrict multi-selection to defined components only // restrict multi-selection to defined components only
int numComponents = getNumComponents(); int numComponents = getNumComponents();
for (int row2 : rows) { for (int r : rows) {
// Only add valid component rows (i.e. don't include blank last line) // Only add valid component rows (i.e. don't include blank last line)
if (row2 < numComponents) { if (r < numComponents) {
tmpSelection.addRange(row2, row2 + 1); tmpSelection.addRange(r, r + 1);
} }
} }
} }
@ -354,7 +355,7 @@ public abstract class CompEditorModel extends CompositeEditorModel {
int[] selectedRows = getSelectedRows(); int[] selectedRows = getSelectedRows();
Arrays.sort(rows); Arrays.sort(rows);
for (int i = rows.length - 1; i >= 0; i--) { for (int i = n - 1; i >= 0; i--) {
monitor.checkCanceled(); monitor.checkCanceled();
monitor.setMessage("Deleting " + (n - i + 1) + " of " + n); monitor.setMessage("Deleting " + (n - i + 1) + " of " + n);
int rowIndex = rows[i]; int rowIndex = rows[i];