From ae20525fe065fad6d0aaadb8176af987c3563bea Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Mon, 18 Jun 2018 12:20:32 +0300 Subject: [PATCH] inspection settings: reload scope list after scope settings are edited --- .../codeInspection/ui/ScopesOrderDialog.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java index aa00b325a426..6ed2580a2f9c 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java @@ -31,6 +31,7 @@ public class ScopesOrderDialog extends DialogWrapper { private final InspectionProfileImpl myInspectionProfile; private final Project myProject; private final JPanel myPanel; + private final MyModel myModel; public ScopesOrderDialog(final @NotNull Component parent, final InspectionProfileImpl inspectionProfile, @@ -38,8 +39,11 @@ public class ScopesOrderDialog extends DialogWrapper { super(parent, true); myInspectionProfile = inspectionProfile; myProject = project; + myModel = new MyModel(); + reloadScopeList(); + myOptionsList.setModel(myModel); + myOptionsList.setSelectedIndex(0); - fillList(); final JPanel listPanel = ToolbarDecorator.createDecorator(myOptionsList).setMoveDownAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton anActionButton) { @@ -54,6 +58,7 @@ public class ScopesOrderDialog extends DialogWrapper { @Override public void actionPerformed(AnActionEvent e) { ShowSettingsUtil.getInstance().editConfigurable(project, new ScopeChooserConfigurable(project)); + reloadScopeList(); } }).disableRemoveAction().disableAddAction().createPanel(); final JLabel descr = new JLabel("

If file appears in two or more scopes, it will be " + @@ -68,9 +73,8 @@ public class ScopesOrderDialog extends DialogWrapper { setTitle("Scopes Order"); } - private void fillList() { - MyModel model = new MyModel(); - model.removeAllElements(); + private void reloadScopeList() { + myModel.removeAllElements(); final List scopes = new ArrayList<>(); for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) { @@ -83,10 +87,8 @@ public class ScopesOrderDialog extends DialogWrapper { scopes.remove(CustomScopesProviderEx.getAllScope().getName()); Collections.sort(scopes, new ScopeOrderComparator(myInspectionProfile)); for (String scopeName : scopes) { - model.addElement(scopeName); + myModel.addElement(scopeName); } - myOptionsList.setModel(model); - myOptionsList.setSelectedIndex(0); } @Nullable