Search in sources :

Example 36 with Configurable

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

the class SettingsEditor method checkModified.

void checkModified(Configurable configurable) {
    Configurable parent = myFilter.myContext.getParentConfigurable(configurable);
    if (ConfigurableWrapper.hasOwnContent(parent)) {
        checkModifiedForItem(parent);
        for (Configurable child : myFilter.myContext.getChildren(parent)) {
            checkModifiedForItem(child);
        }
    } else if (configurable != null) {
        checkModifiedForItem(configurable);
    }
    updateStatus(configurable);
}
Also used : Configurable(com.intellij.openapi.options.Configurable)

Example 37 with Configurable

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

the class SettingsFilter method update.

private ActionCallback update(@NotNull DocumentEvent.EventType type, boolean adjustSelection, boolean now) {
    if (myUpdateRejected) {
        return ActionCallback.REJECTED;
    }
    String text = getFilterText();
    if (text.isEmpty()) {
        myContext.setHoldingFilter(false);
        myFiltered = null;
    } else {
        myContext.setHoldingFilter(true);
        myHits = myRegistrar.getConfigurables(myGroups, type, myFiltered, text, myProject);
        myFiltered = myHits.getAll();
    }
    mySearch.getTextEditor().setBackground(myFiltered != null && myFiltered.isEmpty() ? LightColors.RED : UIUtil.getTextFieldBackground());
    Configurable current = myContext.getCurrentConfigurable();
    boolean shouldMoveSelection = myHits == null || (!myHits.getNameFullHits().contains(current) && !myHits.getContentHits().contains(current));
    if (shouldMoveSelection && type != DocumentEvent.EventType.INSERT && (myFiltered == null || myFiltered.contains(current))) {
        shouldMoveSelection = false;
    }
    Configurable candidate = adjustSelection ? current : null;
    if (shouldMoveSelection && myHits != null) {
        if (!myHits.getNameHits().isEmpty()) {
            candidate = findConfigurable(myHits.getNameHits(), myHits.getNameFullHits());
        } else if (!myHits.getContentHits().isEmpty()) {
            candidate = findConfigurable(myHits.getContentHits(), null);
        }
    }
    updateSpotlight(false);
    if ((myFiltered == null || !myFiltered.isEmpty()) && candidate == null && myLastSelected != null) {
        candidate = myLastSelected;
        myLastSelected = null;
    }
    if (candidate == null && current != null) {
        myLastSelected = current;
    }
    SimpleNode node = !adjustSelection ? null : findNode(candidate);
    ActionCallback callback = fireUpdate(node, adjustSelection, now);
    myDocumentWasChanged = true;
    return callback;
}
Also used : ActionCallback(com.intellij.openapi.util.ActionCallback) Configurable(com.intellij.openapi.options.Configurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) SimpleNode(com.intellij.ui.treeStructure.SimpleNode)

Example 38 with Configurable

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

the class SettingsFilter method shouldBeShowing.

@Override
public boolean shouldBeShowing(SimpleNode node) {
    if (myFiltered != null) {
        Configurable configurable = getConfigurable(node);
        if (configurable != null) {
            if (!myFiltered.contains(configurable)) {
                if (myHits != null) {
                    Set<Configurable> configurables = myHits.getNameFullHits();
                    while (node != null) {
                        if (configurable != null) {
                            if (configurables.contains(configurable)) {
                                return true;
                            }
                        }
                        node = node.getParent();
                        configurable = getConfigurable(node);
                    }
                }
                return false;
            }
        }
    }
    return true;
}
Also used : Configurable(com.intellij.openapi.options.Configurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable)

Example 39 with Configurable

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

the class GeneralSettingsConfigurable method createComponent.

@Override
public JComponent createComponent() {
    if (myComponent == null) {
        myComponent = new MyComponent();
    }
    myComponent.myChkAutoSaveIfInactive.addChangeListener(e -> myComponent.myTfInactiveTimeout.setEditable(myComponent.myChkAutoSaveIfInactive.isSelected()));
    List<SearchableConfigurable> list = getConfigurables();
    if (!list.isEmpty()) {
        myComponent.myPluginOptionsPanel.setLayout(new GridLayout(list.size(), 1));
        for (Configurable c : list) {
            myComponent.myPluginOptionsPanel.add(c.createComponent());
        }
    }
    return myComponent.myPanel;
}
Also used : SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) CompositeConfigurable(com.intellij.openapi.options.CompositeConfigurable) Configurable(com.intellij.openapi.options.Configurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable)

Example 40 with Configurable

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

the class ShowSettingsUtilImpl method showSettingsDialog.

public <T extends Configurable> void showSettingsDialog(@Nullable Project project, @NotNull Class<T> configurableClass, @Nullable Consumer<T> additionalConfiguration) {
    assert Configurable.class.isAssignableFrom(configurableClass) : "Not a configurable: " + configurableClass.getName();
    ConfigurableGroup[] groups = getConfigurableGroups(project, true);
    Configurable config = new ConfigurableVisitor.ByType(configurableClass).find(groups);
    assert config != null : "Cannot find configurable: " + configurableClass.getName();
    if (additionalConfiguration != null) {
        T toConfigure = ConfigurableWrapper.cast(configurableClass, config);
        assert toConfigure != null : "Wrong configurable found: " + config.getClass();
        additionalConfiguration.accept(toConfigure);
    }
    getDialog(project, groups, config).show();
}
Also used : ConfigurableGroup(com.intellij.openapi.options.ConfigurableGroup) ConfigurableVisitor(com.intellij.openapi.options.ex.ConfigurableVisitor) Configurable(com.intellij.openapi.options.Configurable) TabbedConfigurable(com.intellij.openapi.options.TabbedConfigurable)

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