mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[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.
This commit is contained in:
+5
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user