Search in sources :

Example 6 with ExternalSystemNode

use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.

the class GradleViewContributor method addCustomSourceSetsNodes.

private static void addCustomSourceSetsNodes(@NotNull ExternalProjectsView externalProjectsView, @NotNull MultiMap<Key<?>, DataNode<?>> dataNodes, @NotNull List<ExternalSystemNode<?>> result) {
    final Collection<DataNode<?>> sourceSetsDataNodes = dataNodes.get(GradleSourceSetData.KEY);
    if (!sourceSetsDataNodes.isEmpty()) {
        final ExternalSystemNode sourceSetsNode = new SourceSetsNode(externalProjectsView);
        for (DataNode<?> dataNode : sourceSetsDataNodes) {
            //noinspection unchecked
            sourceSetsNode.add(new SourceSetNode(externalProjectsView, (DataNode<GradleSourceSetData>) dataNode));
        }
        result.add(sourceSetsNode);
    }
}
Also used : DataNode(com.intellij.openapi.externalSystem.model.DataNode) ExternalSystemNode(com.intellij.openapi.externalSystem.view.ExternalSystemNode)

Example 7 with ExternalSystemNode

use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.

the class EditExternalSystemRunConfigurationAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    Project project = getProject(e);
    assert project != null;
    final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
    if (selectedNodes == null || selectedNodes.size() != 1 || !(selectedNodes.get(0) instanceof RunConfigurationNode))
        return;
    RunnerAndConfigurationSettings settings = ((RunConfigurationNode) selectedNodes.get(0)).getSettings();
    assert settings != null;
    RunManager.getInstance(project).setSelectedConfiguration(settings);
    EditConfigurationsDialog dialog = new EditConfigurationsDialog(project);
    dialog.show();
}
Also used : Project(com.intellij.openapi.project.Project) EditConfigurationsDialog(com.intellij.execution.impl.EditConfigurationsDialog) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) ExternalSystemNode(com.intellij.openapi.externalSystem.view.ExternalSystemNode) RunConfigurationNode(com.intellij.openapi.externalSystem.view.RunConfigurationNode)

Example 8 with ExternalSystemNode

use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.

the class ExternalSystemRunConfigurationMenu method update.

@Override
public void update(AnActionEvent e) {
    for (AnAction action : getChildActionsOrStubs()) {
        if (action instanceof ExecuteExternalSystemRunConfigurationAction) {
            remove(action);
        }
    }
    final Project project = e.getProject();
    final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
    if (selectedNodes == null || selectedNodes.size() != 1 || !(selectedNodes.get(0) instanceof RunConfigurationNode))
        return;
    final RunnerAndConfigurationSettings settings = ((RunConfigurationNode) selectedNodes.get(0)).getSettings();
    if (settings == null || project == null)
        return;
    Executor[] executors = ExecutorRegistry.getInstance().getRegisteredExecutors();
    for (int i = executors.length; --i >= 0; ) {
        final ProgramRunner runner = RunnerRegistry.getInstance().getRunner(executors[i].getId(), settings.getConfiguration());
        AnAction action = new ExecuteExternalSystemRunConfigurationAction(executors[i], runner != null, project, settings);
        addAction(action, Constraints.FIRST);
    }
    super.update(e);
}
Also used : Project(com.intellij.openapi.project.Project) ExternalSystemNode(com.intellij.openapi.externalSystem.view.ExternalSystemNode) RunConfigurationNode(com.intellij.openapi.externalSystem.view.RunConfigurationNode) ProgramRunner(com.intellij.execution.runners.ProgramRunner) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 9 with ExternalSystemNode

use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.

the class ExternalSystemSelectProjectDataToImportAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = getProject(e);
    final ProjectSystemId projectSystemId = getSystemId(e);
    final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
    final ExternalProjectInfo projectInfo;
    final ExternalSystemNode<?> externalSystemNode = ContainerUtil.getFirstItem(selectedNodes);
    if (externalSystemNode == null) {
        projectInfo = ContainerUtil.getFirstItem(ProjectDataManager.getInstance().getExternalProjectsData(project, projectSystemId));
    } else {
        final ProjectNode projectNode = externalSystemNode instanceof ProjectNode ? (ProjectNode) externalSystemNode : externalSystemNode.findParent(ProjectNode.class);
        assert projectNode != null;
        final ProjectData projectData = projectNode.getData();
        assert projectData != null;
        projectInfo = ProjectDataManager.getInstance().getExternalProjectData(project, projectSystemId, projectData.getLinkedExternalProjectPath());
    }
    final ExternalProjectDataSelectorDialog dialog;
    if (projectInfo != null) {
        dialog = new ExternalProjectDataSelectorDialog(project, projectInfo, externalSystemNode != null ? externalSystemNode.getData() : null);
        dialog.showAndGet();
    }
}
Also used : ExternalProjectInfo(com.intellij.openapi.externalSystem.model.ExternalProjectInfo) Project(com.intellij.openapi.project.Project) ExternalProjectDataSelectorDialog(com.intellij.openapi.externalSystem.service.ui.ExternalProjectDataSelectorDialog) ProjectSystemId(com.intellij.openapi.externalSystem.model.ProjectSystemId) ProjectNode(com.intellij.openapi.externalSystem.view.ProjectNode) ExternalSystemNode(com.intellij.openapi.externalSystem.view.ExternalSystemNode) ProjectData(com.intellij.openapi.externalSystem.model.project.ProjectData)

Example 10 with ExternalSystemNode

use of com.intellij.openapi.externalSystem.view.ExternalSystemNode in project intellij-community by JetBrains.

the class OpenTasksActivationManagerAction method perform.

@Override
public void perform(@NotNull final Project project, @NotNull ProjectSystemId projectSystemId, @NotNull AbstractExternalEntityData externalEntityData, @NotNull AnActionEvent e) {
    final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
    final ExternalSystemNode<?> externalSystemNode = ContainerUtil.getFirstItem(selectedNodes);
    assert externalSystemNode != null;
    final ExternalConfigPathAware externalConfigPathAware = externalSystemNode.getData() instanceof ExternalConfigPathAware ? (ExternalConfigPathAware) externalSystemNode.getData() : null;
    assert externalConfigPathAware != null;
    new ConfigureTasksActivationDialog(project, projectSystemId, externalConfigPathAware.getLinkedExternalProjectPath()).showAndGet();
}
Also used : ExternalConfigPathAware(com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware) ExternalSystemNode(com.intellij.openapi.externalSystem.view.ExternalSystemNode) ConfigureTasksActivationDialog(com.intellij.openapi.externalSystem.service.task.ui.ConfigureTasksActivationDialog)

Aggregations

ExternalSystemNode (com.intellij.openapi.externalSystem.view.ExternalSystemNode)12 ExternalConfigPathAware (com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware)5 RunConfigurationNode (com.intellij.openapi.externalSystem.view.RunConfigurationNode)5 Project (com.intellij.openapi.project.Project)5 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)4 AnAction (com.intellij.openapi.actionSystem.AnAction)2 ProjectSystemId (com.intellij.openapi.externalSystem.model.ProjectSystemId)2 ProjectData (com.intellij.openapi.externalSystem.model.project.ProjectData)2 ExternalSystemRunConfiguration (com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration)2 ExternalProjectSettings (com.intellij.openapi.externalSystem.settings.ExternalProjectSettings)2 RunManagerEx (com.intellij.execution.RunManagerEx)1 EditConfigurationsDialog (com.intellij.execution.impl.EditConfigurationsDialog)1 ProgramRunner (com.intellij.execution.runners.ProgramRunner)1 ImportSpecBuilder (com.intellij.openapi.externalSystem.importing.ImportSpecBuilder)1 DataNode (com.intellij.openapi.externalSystem.model.DataNode)1 ExternalProjectInfo (com.intellij.openapi.externalSystem.model.ExternalProjectInfo)1 ExternalSystemTaskExecutionSettings (com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)1 ModuleData (com.intellij.openapi.externalSystem.model.project.ModuleData)1 TaskData (com.intellij.openapi.externalSystem.model.task.TaskData)1 ConfigureTasksActivationDialog (com.intellij.openapi.externalSystem.service.task.ui.ConfigureTasksActivationDialog)1