Search in sources :

Example 41 with Configurable

use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.

the class ShowSettingsUtilImpl method getConfigurables.

/**
   * @param project         a project used to load project settings or {@code null}
   * @param withIdeSettings specifies whether to load application settings or not
   * @return all configurables as a plain list except the root configurable group
   */
@NotNull
public static Configurable[] getConfigurables(@Nullable Project project, boolean withIdeSettings) {
    ConfigurableGroup group = ConfigurableExtensionPointUtil.getConfigurableGroup(project, withIdeSettings);
    List<Configurable> list = new ArrayList<>();
    collect(list, group.getConfigurables());
    return list.toArray(new Configurable[0]);
}
Also used : ConfigurableGroup(com.intellij.openapi.options.ConfigurableGroup) ArrayList(java.util.ArrayList) Configurable(com.intellij.openapi.options.Configurable) TabbedConfigurable(com.intellij.openapi.options.TabbedConfigurable) NotNull(org.jetbrains.annotations.NotNull)

Example 42 with Configurable

use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.

the class ShowSettingsUtilImpl method showSettingsDialog.

public static void showSettingsDialog(@Nullable Project project, final String id2Select, final String filter) {
    ConfigurableGroup[] group = getConfigurableGroups(project, true);
    group = filterEmptyGroups(group);
    final Configurable configurable2Select = id2Select == null ? null : new ConfigurableVisitor.ByID(id2Select).find(group);
    SettingsDialogFactory.getInstance().create(getProject(project), group, configurable2Select, filter).show();
}
Also used : ConfigurableGroup(com.intellij.openapi.options.ConfigurableGroup) Configurable(com.intellij.openapi.options.Configurable) TabbedConfigurable(com.intellij.openapi.options.TabbedConfigurable)

Example 43 with Configurable

use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.

the class IdeSettingsDialogFixture method getProjectSettingsNames.

@NotNull
public List<String> getProjectSettingsNames() {
    List<String> names = new ArrayList<>();
    JPanel optionsEditor = field("myEditor").ofType(JPanel.class).in(getDialogWrapper()).get();
    assertNotNull(optionsEditor);
    List<JComponent> trees = findComponentsOfType(optionsEditor, "com.intellij.openapi.options.newEditor.SettingsTreeView");
    assertThat(trees).hasSize(1);
    JComponent tree = trees.get(0);
    CachingSimpleNode root = field("myRoot").ofType(CachingSimpleNode.class).in(tree).get();
    assertNotNull(root);
    ConfigurableGroup[] groups = field("myGroups").ofType(ConfigurableGroup[].class).in(root).get();
    assertNotNull(groups);
    for (ConfigurableGroup current : groups) {
        Configurable[] configurables = current.getConfigurables();
        for (Configurable configurable : configurables) {
            names.add(configurable.getDisplayName());
        }
    }
    return names;
}
Also used : ConfigurableGroup(com.intellij.openapi.options.ConfigurableGroup) ArrayList(java.util.ArrayList) Configurable(com.intellij.openapi.options.Configurable) CachingSimpleNode(com.intellij.ui.treeStructure.CachingSimpleNode) Assert.assertNotNull(org.junit.Assert.assertNotNull) NotNull(org.jetbrains.annotations.NotNull)

Example 44 with Configurable

use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.

the class DebuggerConfigurable method compute.

private void compute() {
    if (myChildren != null) {
        return;
    }
    List<Configurable> configurables = new SmartList<>();
    configurables.add(new DataViewsConfigurable());
    DebuggerConfigurableProvider[] providers = DebuggerConfigurableProvider.EXTENSION_POINT.getExtensions();
    computeMergedConfigurables(providers, configurables);
    for (DebuggerConfigurableProvider provider : providers) {
        configurables.addAll(provider.getConfigurables(DebuggerSettingsCategory.ROOT));
    }
    MergedCompositeConfigurable mergedGeneralConfigurable = computeGeneralConfigurables(providers);
    if (configurables.isEmpty() && mergedGeneralConfigurable == null) {
        myRootConfigurable = null;
        myChildren = EMPTY_CONFIGURABLES;
    } else if (configurables.size() == 1) {
        Configurable firstConfigurable = configurables.get(0);
        if (mergedGeneralConfigurable == null) {
            myRootConfigurable = firstConfigurable;
            myChildren = EMPTY_CONFIGURABLES;
        } else {
            Configurable[] generalConfigurables = mergedGeneralConfigurable.children;
            Configurable[] mergedArray = new Configurable[generalConfigurables.length + 1];
            System.arraycopy(generalConfigurables, 0, mergedArray, 0, generalConfigurables.length);
            mergedArray[generalConfigurables.length] = firstConfigurable;
            myRootConfigurable = new MergedCompositeConfigurable("", "", mergedArray);
            myChildren = firstConfigurable instanceof SearchableConfigurable.Parent ? ((Parent) firstConfigurable).getConfigurables() : EMPTY_CONFIGURABLES;
        }
    } else {
        myChildren = configurables.toArray(new Configurable[configurables.size()]);
        myRootConfigurable = mergedGeneralConfigurable;
    }
}
Also used : DebuggerConfigurableProvider(com.intellij.xdebugger.settings.DebuggerConfigurableProvider) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) Configurable(com.intellij.openapi.options.Configurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) SmartList(com.intellij.util.SmartList)

Example 45 with Configurable

use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.

the class ConfigurableOptionsTopHitProvider method getOptions.

@NotNull
@Override
public Collection<OptionDescription> getOptions(@Nullable Project project) {
    try {
        Configurable configurable = getConfigurable(project);
        Component component = configurable.createComponent();
        configurable.reset();
        myPrefix.clear();
        String name = getName(configurable);
        if (name != null) {
            myPrefix.push(name);
        }
        Collection<BooleanOptionDescription> options = new ArrayList<>();
        init(options, configurable, component);
        return Collections.unmodifiableCollection(options);
    } catch (Exception exception) {
        LOG.debug(exception);
    }
    return Collections.emptyList();
}
Also used : BooleanOptionDescription(com.intellij.ide.ui.search.BooleanOptionDescription) Configurable(com.intellij.openapi.options.Configurable) ConfigurationException(com.intellij.openapi.options.ConfigurationException) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Configurable (com.intellij.openapi.options.Configurable)66 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)32 BaseConfigurable (com.intellij.openapi.options.BaseConfigurable)8 NotNull (org.jetbrains.annotations.NotNull)8 ConfigurableGroup (com.intellij.openapi.options.ConfigurableGroup)7 UnnamedConfigurable (com.intellij.openapi.options.UnnamedConfigurable)7 Nullable (org.jetbrains.annotations.Nullable)6 Project (com.intellij.openapi.project.Project)5 ArrayList (java.util.ArrayList)5 ConfigurationException (com.intellij.openapi.options.ConfigurationException)4 ArtifactsStructureConfigurable (com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable)4 ApplicationConfigurable (com.intellij.execution.application.ApplicationConfigurable)3 JUnitConfigurable (com.intellij.execution.junit2.configuration.JUnitConfigurable)3 DataContext (com.intellij.openapi.actionSystem.DataContext)3 Module (com.intellij.openapi.module.Module)3 TabbedConfigurable (com.intellij.openapi.options.TabbedConfigurable)3 Settings (com.intellij.openapi.options.ex.Settings)3 ActionCallback (com.intellij.openapi.util.ActionCallback)3 ExtensionsArea (com.intellij.openapi.extensions.ExtensionsArea)2 CompositeConfigurable (com.intellij.openapi.options.CompositeConfigurable)2