diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/AbstractArrangementRuleAction.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/AbstractArrangementRuleAction.java index 1e5a84da3f8d..ec700f7e2363 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/AbstractArrangementRuleAction.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/action/AbstractArrangementRuleAction.java @@ -35,17 +35,6 @@ public abstract class AbstractArrangementRuleAction extends AnAction { } protected void scrollRowToVisible(@NotNull ArrangementMatchingRulesControl control, int row) { - final Rectangle rect = control.getCellRect(row, 0, false); - if (row != control.getEditingRow() - 1) { - control.scrollRectToVisible(rect); - } - else { - final Rectangle editorRect = control.getCellRect(row + 1, 0, false); - if(!rect.isEmpty() && !editorRect.isEmpty()) { - final int height = (int)(rect.getHeight() + editorRect.getHeight()); - final Rectangle visibleRect = new Rectangle((int)rect.getX(), (int)rect.getY(), (int)rect.getWidth(), height); - control.scrollRectToVisible(visibleRect); - } - } + control.scrollRowToVisible(row); } } 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 5889df54e1b1..6f5963fb4dac 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 @@ -329,6 +329,21 @@ public class ArrangementMatchingRulesControl extends JBTable { showEditor(myEditor, rowToEdit); } + public void scrollRowToVisible(int row) { + final Rectangle rect = getCellRect(row, 0, false); + if (row != getEditingRow() - 1) { + scrollRectToVisible(rect); + } + else { + final Rectangle editorRect = getCellRect(row + 1, 0, false); + if(!rect.isEmpty() && !editorRect.isEmpty()) { + final int height = (int)(rect.getHeight() + editorRect.getHeight()); + final Rectangle visibleRect = new Rectangle((int)rect.getX(), (int)rect.getY(), (int)rect.getWidth(), height); + scrollRectToVisible(visibleRect); + } + } + } + public void showEditor(@NotNull ArrangementMatchingRuleEditor editor, int rowToEdit) { if (myEditorRow == rowToEdit + 1) { return; diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/util/ArrangementListRowDecorator.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/util/ArrangementListRowDecorator.java index fe36724293f4..5bbba9eb8a7c 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/util/ArrangementListRowDecorator.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/util/ArrangementListRowDecorator.java @@ -214,6 +214,7 @@ public class ArrangementListRowDecorator extends JPanel implements ArrangementUi int row = myControl.getRowByRenderer(this); if (row >= 0) { myControl.showEditor(row); + myControl.scrollRowToVisible(row); myBeingEdited = true; } }