Search in sources :

Example 1 with JdkConfigurable

use of com.intellij.openapi.roots.ui.configuration.projectRoot.JdkConfigurable in project intellij-community by JetBrains.

the class ProjectJdksConfigurable method createActions.

@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
    if (myProjectJdksModel == null) {
        return null;
    }
    final ArrayList<AnAction> actions = new ArrayList<>();
    DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
    group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
    myProjectJdksModel.createAddActions(group, myTree, projectJdk -> {
        addNode(new MyNode(new JdkConfigurable(((ProjectJdkImpl) projectJdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
        selectNodeInTree(findNodeByObject(myRoot, projectJdk));
    });
    actions.add(new MyActionGroupWrapper(group));
    actions.add(new MyDeleteAction(Conditions.<Object[]>alwaysTrue()));
    return actions;
}
Also used : ProjectJdkImpl(com.intellij.openapi.projectRoots.impl.ProjectJdkImpl) JdkConfigurable(com.intellij.openapi.roots.ui.configuration.projectRoot.JdkConfigurable) AnAction(com.intellij.openapi.actionSystem.AnAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with JdkConfigurable

use of com.intellij.openapi.roots.ui.configuration.projectRoot.JdkConfigurable in project intellij-community by JetBrains.

the class ProjectJdksConfigurable method reset.

@Override
public void reset() {
    super.reset();
    myProjectJdksModel.reset(myProject);
    myRoot.removeAllChildren();
    final Map<Sdk, Sdk> sdks = myProjectJdksModel.getProjectSdks();
    for (Sdk sdk : sdks.keySet()) {
        final JdkConfigurable configurable = new JdkConfigurable((ProjectJdkImpl) sdks.get(sdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject);
        addNode(new MyNode(configurable), myRoot);
    }
    //restore selection
    selectJdk(myProjectJdksModel.getProjectSdk());
    JBSplitter splitter = extractSplitter();
    if (splitter != null) {
        splitter.setAndLoadSplitterProportionKey("project.jdk.splitter");
    }
}
Also used : JavaSdk(com.intellij.openapi.projectRoots.JavaSdk) Sdk(com.intellij.openapi.projectRoots.Sdk) JBSplitter(com.intellij.ui.JBSplitter) JdkConfigurable(com.intellij.openapi.roots.ui.configuration.projectRoot.JdkConfigurable)

Aggregations

JdkConfigurable (com.intellij.openapi.roots.ui.configuration.projectRoot.JdkConfigurable)2 AnAction (com.intellij.openapi.actionSystem.AnAction)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 JavaSdk (com.intellij.openapi.projectRoots.JavaSdk)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 ProjectJdkImpl (com.intellij.openapi.projectRoots.impl.ProjectJdkImpl)1 JBSplitter (com.intellij.ui.JBSplitter)1 Nullable (org.jetbrains.annotations.Nullable)1