Search in sources :

Example 1 with NamedConfigurable

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

the class BaseStructureConfigurable method getSelectedElement.

@Nullable
public ProjectStructureElement getSelectedElement() {
    final TreePath selectionPath = myTree.getSelectionPath();
    if (selectionPath != null && selectionPath.getLastPathComponent() instanceof MyNode) {
        MyNode node = (MyNode) selectionPath.getLastPathComponent();
        final NamedConfigurable configurable = node.getConfigurable();
        if (configurable instanceof ProjectStructureElementConfigurable) {
            return ((ProjectStructureElementConfigurable) configurable).getProjectStructureElement();
        }
    }
    return null;
}
Also used : TreePath(javax.swing.tree.TreePath) NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with NamedConfigurable

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

the class JdkListConfigurable method apply.

@Override
public void apply() throws ConfigurationException {
    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 (myJdksTreeModel.isModified() || modifiedJdks)
        myJdksTreeModel.apply(this);
    myJdksTreeModel.setProjectSdk(ProjectRootManager.getInstance(myProject).getProjectSdk());
}
Also used : NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable)

Example 3 with NamedConfigurable

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

the class ProjectJdksConfigurable method processRemovedItems.

@Override
protected void processRemovedItems() {
    final Set<Sdk> jdks = new HashSet<>();
    for (int i = 0; i < myRoot.getChildCount(); i++) {
        final DefaultMutableTreeNode node = (DefaultMutableTreeNode) myRoot.getChildAt(i);
        final NamedConfigurable namedConfigurable = (NamedConfigurable) node.getUserObject();
        jdks.add(((JdkConfigurable) namedConfigurable).getEditableObject());
    }
    final HashMap<Sdk, Sdk> sdks = new HashMap<>(myProjectJdksModel.getProjectSdks());
    for (Sdk sdk : sdks.values()) {
        if (!jdks.contains(sdk)) {
            myProjectJdksModel.removeSdk(sdk);
        }
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable) JavaSdk(com.intellij.openapi.projectRoots.JavaSdk) Sdk(com.intellij.openapi.projectRoots.Sdk)

Example 4 with NamedConfigurable

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

the class BasePerspectiveConfigurable method putNavigationPath.

public void putNavigationPath(@NotNull Place place, @NotNull String moduleName, @NotNull String dependency) {
    place.putPath(getNavigationPathName(), moduleName);
    PsModule module = findModule(moduleName);
    assert module != null;
    MyNode node = findNodeByObject(myRoot, module);
    assert node != null;
    NamedConfigurable configurable = node.getConfigurable();
    assert configurable instanceof BaseNamedConfigurable;
    BaseNamedConfigurable dependenciesConfigurable = (BaseNamedConfigurable) configurable;
    dependenciesConfigurable.putNavigationPath(place, dependency);
}
Also used : PsModule(com.android.tools.idea.gradle.structure.model.PsModule) NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable)

Example 5 with NamedConfigurable

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

the class BasePerspectiveConfigurable method queryPlace.

@Override
public void queryPlace(@NotNull Place place) {
    NamedConfigurable selectedConfigurable = getSelectedConfigurable();
    if (selectedConfigurable instanceof BaseNamedConfigurable) {
        PsModule module = ((BaseNamedConfigurable) selectedConfigurable).getEditableObject();
        String moduleName = module.getName();
        place.putPath(getNavigationPathName(), moduleName);
        queryFurther(selectedConfigurable, place);
        return;
    }
    place.putPath(getNavigationPathName(), "");
}
Also used : PsModule(com.android.tools.idea.gradle.structure.model.PsModule) 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