IDEA-94950 Code Style | Arrangement: AIOOBE at ArrangementMatchingRulesModel.removeRow() on removing the last rule that is in edit mode

This commit is contained in:
Denis.Zhdanov
2012-11-14 16:57:03 +04:00
parent cb7bacd335
commit 8a4f10412d
@@ -212,6 +212,9 @@ public class ArrangementMatchingRulesControl extends JBTable {
public void runOperationIgnoreSelectionChange(@NotNull Runnable task) {
mySkipSelectionChange = true;
try {
if (isEditing()) {
getCellEditor().stopCellEditing();
}
task.run();
}
finally {
@@ -228,6 +231,17 @@ public class ArrangementMatchingRulesControl extends JBTable {
}
public void refreshEditor() {
ArrangementMatchingRulesModel model = getModel();
if (myEditorRow >= model.getSize()) {
myEditorRow = -1;
for (int i = 0, max = model.getSize(); i < max; i++) {
if (model.getElementAt(i) instanceof ArrangementEditorComponent) {
myEditorRow = i;
break;
}
}
}
if (myEditorRow < 0) {
return;
}