From c4be4f9492e86baf81d67d1b7cb4ce4b351d2eef Mon Sep 17 00:00:00 2001 From: "Rustam.Vishnyakov" Date: Mon, 16 Jan 2012 16:48:47 +0400 Subject: [PATCH] Fixed IDEA-79459 Code Style Schemes dialog has no preselected scheme on opening, AE at ManageCodeStyleSchemesDialog$3.actionPerformed() --- .../codeStyle/ManageCodeStyleSchemesDialog.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/ManageCodeStyleSchemesDialog.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/ManageCodeStyleSchemesDialog.java index fa93e04f6d81..455bd02cb300 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/ManageCodeStyleSchemesDialog.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/ManageCodeStyleSchemesDialog.java @@ -70,6 +70,8 @@ public class ManageCodeStyleSchemesDialog extends DialogWrapper { updateActions(); } }); + setDefaultSelection(); + myDeleteButton.addActionListener(new ActionListener() { @Override @@ -345,5 +347,14 @@ public class ManageCodeStyleSchemesDialog extends DialogWrapper { mySchemesTableModel.copyToProject(getSelectedScheme()); } + private void setDefaultSelection() { + CodeStyleScheme selectedScheme = myModel.getSelectedScheme(); + for (int i = 0; i < mySchemesTableModel.getRowCount(); i ++) { + if (mySchemesTableModel.getSchemeAt(i).equals(selectedScheme)) { + mySchemesTable.getSelectionModel().setSelectionInterval(i, i); + return; + } + } + } }