Search in sources :

Example 11 with NamedConfigurable

use of com.intellij.openapi.ui.NamedConfigurable in project intellij-community by JetBrains.

the class BaseStructureConfigurable method navigateTo.

@Override
public ActionCallback navigateTo(@Nullable final Place place, final boolean requestFocus) {
    if (place == null)
        return ActionCallback.DONE;
    final Object object = place.getPath(TREE_OBJECT);
    final String byName = (String) place.getPath(TREE_NAME);
    if (object == null && byName == null)
        return ActionCallback.DONE;
    final MyNode node = object == null ? null : findNodeByObject(myRoot, object);
    final MyNode nodeByName = byName == null ? null : findNodeByName(myRoot, byName);
    if (node == null && nodeByName == null)
        return ActionCallback.DONE;
    final NamedConfigurable config;
    if (node != null) {
        config = node.getConfigurable();
    } else {
        config = nodeByName.getConfigurable();
    }
    final ActionCallback result = new ActionCallback().doWhenDone(() -> myAutoScrollEnabled = true);
    myAutoScrollEnabled = false;
    myAutoScrollHandler.cancelAllRequests();
    final MyNode nodeToSelect = node != null ? node : nodeByName;
    selectNodeInTree(nodeToSelect, requestFocus).doWhenDone(() -> {
        setSelectedNode(nodeToSelect);
        Place.goFurther(config, place, requestFocus).notifyWhenDone(result);
    });
    return result;
}
Also used : ActionCallback(com.intellij.openapi.util.ActionCallback) NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable)

Example 12 with NamedConfigurable

use of com.intellij.openapi.ui.NamedConfigurable in project intellij-community by JetBrains.

the class FacetEditorFacadeImpl method findFacetNode.

@Nullable
private static MasterDetailsComponent.MyNode findFacetNode(final Facet facet, final MasterDetailsComponent.MyNode moduleNode) {
    for (int i = 0; i < moduleNode.getChildCount(); i++) {
        final TreeNode node = moduleNode.getChildAt(i);
        if (node instanceof MasterDetailsComponent.MyNode) {
            final MasterDetailsComponent.MyNode configNode = (MasterDetailsComponent.MyNode) node;
            final NamedConfigurable config = configNode.getConfigurable();
            if (config instanceof FacetConfigurable) {
                final Facet existingFacet = ((FacetConfigurable) config).getEditableObject();
                if (existingFacet != null && existingFacet.equals(facet)) {
                    return configNode;
                }
            }
        }
    }
    return null;
}
Also used : TreeNode(javax.swing.tree.TreeNode) NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) Nullable(org.jetbrains.annotations.Nullable)

Example 13 with NamedConfigurable

use of com.intellij.openapi.ui.NamedConfigurable in project intellij-community by JetBrains.

the class FacetStructureConfigurable method getHelpTopic.

@Override
public String getHelpTopic() {
    final Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(DataManager.getInstance().getDataContext());
    if (myTree.equals(component)) {
        final NamedConfigurable selectedConfigurable = getSelectedConfigurable();
        if (selectedConfigurable instanceof FacetTypeConfigurable) {
            final FacetType facetType = ((FacetTypeConfigurable) selectedConfigurable).getEditableObject();
            final String topic = facetType.getHelpTopic();
            if (topic != null) {
                return topic;
            }
        }
    }
    if (myCurrentMultipleSettingsEditor != null) {
        final String topic = myCurrentMultipleSettingsEditor.getHelpTopic();
        if (topic != null) {
            return topic;
        }
    }
    String topic = super.getHelpTopic();
    if (topic != null) {
        return topic;
    }
    return "reference.settingsdialog.project.structure.facet";
}
Also used : InvalidFacetType(com.intellij.facet.impl.invalid.InvalidFacetType) NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable) DetailsComponent(com.intellij.openapi.ui.DetailsComponent)

Example 14 with NamedConfigurable

use of com.intellij.openapi.ui.NamedConfigurable in project intellij-community by JetBrains.

the class ProjectJdksConfigurable method apply.

@Override
public void apply() throws ConfigurationException {
    final Ref<ConfigurationException> exceptionRef = Ref.create();
    try {
        super.apply();
        boolean modifiedJdks = false;
        for (int i = 0; i < myRoot.getChildCount(); i++) {
            final NamedConfigurable configurable = ((MyNode) myRoot.getChildAt(i)).getConfigurable();
            if (configurable.isModified()) {
                configurable.apply();
                modifiedJdks = true;
            }
        }
        if (myProjectJdksModel.isModified() || modifiedJdks) {
            myProjectJdksModel.apply(this);
        }
        myProjectJdksModel.setProjectSdk(getSelectedJdk());
    } catch (ConfigurationException e) {
        exceptionRef.set(e);
    }
    if (!exceptionRef.isNull()) {
        throw exceptionRef.get();
    }
}
Also used : ConfigurationException(com.intellij.openapi.options.ConfigurationException) NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable)

Example 15 with NamedConfigurable

use of com.intellij.openapi.ui.NamedConfigurable in project android by JetBrains.

the class BasePerspectiveConfigurable method navigateTo.

@Override
public ActionCallback navigateTo(@Nullable Place place, boolean requestFocus) {
    if (place != null) {
        Object path = place.getPath(getNavigationPathName());
        if (path instanceof String) {
            String moduleName = (String) path;
            if (!isEmpty(moduleName)) {
                ActionCallback callback = new ActionCallback();
                getContext().setSelectedModule(moduleName, this);
                selectModule(moduleName);
                NamedConfigurable selectedConfigurable = getSelectedConfigurable();
                if (selectedConfigurable != null) {
                    goFurther(selectedConfigurable, place, requestFocus).notifyWhenDone(callback);
                    return callback;
                }
            }
        }
    }
    return ActionCallback.DONE;
}
Also used : ActionCallback(com.intellij.openapi.util.ActionCallback) NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable)

Aggregations

NamedConfigurable (com.intellij.openapi.ui.NamedConfigurable)16 MasterDetailsComponent (com.intellij.openapi.ui.MasterDetailsComponent)4 PsModule (com.android.tools.idea.gradle.structure.model.PsModule)3 Nullable (org.jetbrains.annotations.Nullable)3 InvalidFacetType (com.intellij.facet.impl.invalid.InvalidFacetType)2 ActionCallback (com.intellij.openapi.util.ActionCallback)2 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)2 TreeNode (javax.swing.tree.TreeNode)2 PsIssue (com.android.tools.idea.gradle.structure.model.PsIssue)1 FacetEditor (com.intellij.facet.ui.FacetEditor)1 MultipleFacetSettingsEditor (com.intellij.facet.ui.MultipleFacetSettingsEditor)1 FlexModuleType (com.intellij.lang.javascript.flex.FlexModuleType)1 Module (com.intellij.openapi.module.Module)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 JavaSdk (com.intellij.openapi.projectRoots.JavaSdk)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 ProjectStructureDaemonAnalyzer (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer)1 ProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement)1 ProjectStructureProblemsHolderImpl (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemsHolderImpl)1 DetailsComponent (com.intellij.openapi.ui.DetailsComponent)1