From 8a4f10412d9dd88dd6bc7d148de18d6d958cb140 Mon Sep 17 00:00:00 2001 From: "Denis.Zhdanov" Date: Wed, 14 Nov 2012 16:56:42 +0400 Subject: [PATCH] IDEA-94950 Code Style | Arrangement: AIOOBE at ArrangementMatchingRulesModel.removeRow() on removing the last rule that is in edit mode --- .../match/ArrangementMatchingRulesControl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementMatchingRulesControl.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementMatchingRulesControl.java index c997deed0e9a..ee4b33a0a771 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementMatchingRulesControl.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementMatchingRulesControl.java @@ -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; }