Search in sources :

Example 1 with RunConfigurationNode

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

the class RemoveExternalSystemRunConfigurationAction 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;
    int res = Messages.showYesNoDialog(project, "Delete \"" + settings.getName() + "\"?", "Confirmation", Messages.getQuestionIcon());
    if (res == Messages.YES) {
        ((RunManagerEx) RunManager.getInstance(project)).removeConfiguration(settings);
    }
}
Also used : Project(com.intellij.openapi.project.Project) RunManagerEx(com.intellij.execution.RunManagerEx) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) ExternalSystemNode(com.intellij.openapi.externalSystem.view.ExternalSystemNode) RunConfigurationNode(com.intellij.openapi.externalSystem.view.RunConfigurationNode)

Example 2 with RunConfigurationNode

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

the class ToggleTaskActivationAction method getTasks.

@NotNull
private static List<TaskData> getTasks(AnActionEvent e) {
    final List<ExternalSystemNode> selectedNodes = ExternalSystemDataKeys.SELECTED_NODES.getData(e.getDataContext());
    if (selectedNodes == null)
        return Collections.emptyList();
    List<TaskData> tasks = new SmartList<>();
    for (ExternalSystemNode node : selectedNodes) {
        if (node instanceof TaskNode && !node.isIgnored()) {
            tasks.add((TaskData) node.getData());
        } else if (node instanceof RunConfigurationNode) {
            final RunnerAndConfigurationSettings configurationSettings = ((RunConfigurationNode) node).getSettings();
            final ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration) configurationSettings.getConfiguration();
            final ExternalSystemTaskExecutionSettings taskExecutionSettings = runConfiguration.getSettings();
            tasks.add(new TaskData(taskExecutionSettings.getExternalSystemId(), RUN_CONFIGURATION_TASK_PREFIX + configurationSettings.getName(), taskExecutionSettings.getExternalProjectPath(), null));
        } else {
            return Collections.emptyList();
        }
    }
    return tasks;
}
Also used : TaskNode(com.intellij.openapi.externalSystem.view.TaskNode) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) ExternalSystemRunConfiguration(com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration) ExternalSystemNode(com.intellij.openapi.externalSystem.view.ExternalSystemNode) SmartList(com.intellij.util.SmartList) RunConfigurationNode(com.intellij.openapi.externalSystem.view.RunConfigurationNode) TaskData(com.intellij.openapi.externalSystem.model.task.TaskData) ExternalSystemTaskExecutionSettings(com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with RunConfigurationNode

use of com.intellij.openapi.externalSystem.view.RunConfigurationNode 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 4 with RunConfigurationNode

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

the class AssignRunConfigurationShortcutAction 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;
    ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration) settings.getConfiguration();
    String actionIdPrefix = getActionPrefix(project, runConfiguration.getSettings().getExternalProjectPath());
    String actionId = actionIdPrefix + settings.getName();
    AnAction action = ActionManager.getInstance().getAction(actionId);
    if (action == null) {
        ExternalSystemKeymapExtension.getOrRegisterAction(project, settings);
    }
    new EditKeymapsDialog(project, actionId).show();
}
Also used : Project(com.intellij.openapi.project.Project) EditKeymapsDialog(com.intellij.openapi.keymap.impl.ui.EditKeymapsDialog) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) ExternalSystemRunConfiguration(com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration) ExternalSystemNode(com.intellij.openapi.externalSystem.view.ExternalSystemNode) RunConfigurationNode(com.intellij.openapi.externalSystem.view.RunConfigurationNode) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 5 with RunConfigurationNode

use of com.intellij.openapi.externalSystem.view.RunConfigurationNode 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)

Aggregations

ExternalSystemNode (com.intellij.openapi.externalSystem.view.ExternalSystemNode)5 RunConfigurationNode (com.intellij.openapi.externalSystem.view.RunConfigurationNode)5 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)4 Project (com.intellij.openapi.project.Project)4 AnAction (com.intellij.openapi.actionSystem.AnAction)2 ExternalSystemRunConfiguration (com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration)2 RunManagerEx (com.intellij.execution.RunManagerEx)1 EditConfigurationsDialog (com.intellij.execution.impl.EditConfigurationsDialog)1 ProgramRunner (com.intellij.execution.runners.ProgramRunner)1 ExternalSystemTaskExecutionSettings (com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)1 TaskData (com.intellij.openapi.externalSystem.model.task.TaskData)1 TaskNode (com.intellij.openapi.externalSystem.view.TaskNode)1 EditKeymapsDialog (com.intellij.openapi.keymap.impl.ui.EditKeymapsDialog)1 SmartList (com.intellij.util.SmartList)1 NotNull (org.jetbrains.annotations.NotNull)1