From e5d91169eaa3c66ff8c2a9e85ae9d57d6676d9e7 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Fri, 8 Feb 2013 15:41:00 +0400 Subject: [PATCH] [vcs] Fix link to "Scopes" configurable. * Use correct method to get the data context (based on the focused component). * Find configurable by id (not by class) because of IDEA-100721. * Select the configurable instead of opening a modal dialog above the Settings for better user experience. --- .../VcsUpdateInfoScopeFilterConfigurable.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsUpdateInfoScopeFilterConfigurable.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsUpdateInfoScopeFilterConfigurable.java index 1cdcc3ef1fe2..f217c08125a1 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsUpdateInfoScopeFilterConfigurable.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsUpdateInfoScopeFilterConfigurable.java @@ -19,7 +19,7 @@ import com.intellij.ide.DataManager; import com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.options.ShowSettingsUtil; +import com.intellij.openapi.options.SearchableConfigurable; import com.intellij.openapi.options.newEditor.OptionsEditor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; @@ -77,20 +77,17 @@ class VcsUpdateInfoScopeFilterConfigurable implements Configurable { @Nullable @Override public JComponent createComponent() { - JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(myCheckbox); panel.add(myComboBox); panel.add(new LinkLabel("Edit scopes", null, new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { - final OptionsEditor optionsEditor = OptionsEditor.KEY.getData(DataManager.getInstance().getDataContext()); + final OptionsEditor optionsEditor = OptionsEditor.KEY.getData(DataManager.getInstance().getDataContext(panel)); if (optionsEditor != null) { - ScopeChooserConfigurable configurable = optionsEditor.findConfigurable(ScopeChooserConfigurable.class); + SearchableConfigurable configurable = optionsEditor.findConfigurableById(new ScopeChooserConfigurable(myProject).getId()); if (configurable != null) { - boolean edited = ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable); - if (edited) { - reset(); - } + optionsEditor.select(configurable); } } }