Search in sources :

Example 11 with ExternalTaskExecutionInfo

use of com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo in project intellij-community by JetBrains.

the class GradleManager method patchRecentTasks.

private static void patchRecentTasks(@NotNull Map<String, String> adjustedPaths, @NotNull GradleLocalSettings localSettings) {
    for (ExternalTaskExecutionInfo taskInfo : localSettings.getRecentTasks()) {
        ExternalSystemTaskExecutionSettings s = taskInfo.getSettings();
        String newPath = adjustedPaths.get(s.getExternalProjectPath());
        if (newPath != null) {
            s.setExternalProjectPath(newPath);
        }
    }
}
Also used : ExternalTaskExecutionInfo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo) ExternalSystemTaskExecutionSettings(com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)

Example 12 with ExternalTaskExecutionInfo

use of com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo in project intellij-community by JetBrains.

the class ExternalProjectsViewImpl method extractLocation.

@Nullable
private ExternalSystemTaskLocation extractLocation() {
    final List<ExternalSystemNode> selectedNodes = getSelectedNodes(ExternalSystemNode.class);
    if (selectedNodes.isEmpty())
        return null;
    List<TaskData> tasks = ContainerUtil.newSmartList();
    ExternalTaskExecutionInfo taskExecutionInfo = new ExternalTaskExecutionInfo();
    String projectPath = null;
    for (ExternalSystemNode node : selectedNodes) {
        final Object data = node.getData();
        if (data instanceof TaskData) {
            final TaskData taskData = (TaskData) data;
            if (projectPath == null) {
                projectPath = taskData.getLinkedExternalProjectPath();
            } else if (!taskData.getLinkedExternalProjectPath().equals(projectPath)) {
                return null;
            }
            taskExecutionInfo.getSettings().getTaskNames().add(taskData.getName());
            taskExecutionInfo.getSettings().getTaskDescriptions().add(taskData.getDescription());
            tasks.add(taskData);
        }
    }
    if (tasks.isEmpty())
        return null;
    taskExecutionInfo.getSettings().setExternalSystemIdString(myExternalSystemId.toString());
    taskExecutionInfo.getSettings().setExternalProjectPath(projectPath);
    return ExternalSystemTaskLocation.create(myProject, myExternalSystemId, projectPath, taskExecutionInfo);
}
Also used : ExternalTaskExecutionInfo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo) TaskData(com.intellij.openapi.externalSystem.model.task.TaskData) Nullable(org.jetbrains.annotations.Nullable)

Example 13 with ExternalTaskExecutionInfo

use of com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo in project intellij-community by JetBrains.

the class AbstractExternalSystemLocalSettings method forgetExternalProjects.

/**
   * Asks current settings to drop all information related to external projects which root configs are located at the given paths.
   *
   * @param linkedProjectPathsToForget  target root external project paths
   */
public void forgetExternalProjects(@NotNull Set<String> linkedProjectPathsToForget) {
    Map<ExternalProjectPojo, Collection<ExternalProjectPojo>> projects = myAvailableProjects.get();
    for (Iterator<Map.Entry<ExternalProjectPojo, Collection<ExternalProjectPojo>>> it = projects.entrySet().iterator(); it.hasNext(); ) {
        Map.Entry<ExternalProjectPojo, Collection<ExternalProjectPojo>> entry = it.next();
        if (linkedProjectPathsToForget.contains(entry.getKey().getPath())) {
            it.remove();
        }
    }
    for (Iterator<Map.Entry<String, Collection<ExternalTaskPojo>>> it = myAvailableTasks.get().entrySet().iterator(); it.hasNext(); ) {
        Map.Entry<String, Collection<ExternalTaskPojo>> entry = it.next();
        if (linkedProjectPathsToForget.contains(entry.getKey()) || linkedProjectPathsToForget.contains(ExternalSystemApiUtil.getRootProjectPath(entry.getKey(), myExternalSystemId, myProject))) {
            it.remove();
        }
    }
    for (Iterator<ExternalTaskExecutionInfo> it = myRecentTasks.get().iterator(); it.hasNext(); ) {
        ExternalTaskExecutionInfo taskInfo = it.next();
        String path = taskInfo.getSettings().getExternalProjectPath();
        if (linkedProjectPathsToForget.contains(path) || linkedProjectPathsToForget.contains(ExternalSystemApiUtil.getRootProjectPath(path, myExternalSystemId, myProject))) {
            it.remove();
        }
    }
    for (Iterator<Map.Entry<String, ExternalProjectBuildClasspathPojo>> it = myProjectBuildClasspath.get().entrySet().iterator(); it.hasNext(); ) {
        Map.Entry<String, ExternalProjectBuildClasspathPojo> entry = it.next();
        if (linkedProjectPathsToForget.contains(entry.getKey()) || linkedProjectPathsToForget.contains(ExternalSystemApiUtil.getRootProjectPath(entry.getKey(), myExternalSystemId, myProject))) {
            it.remove();
        }
    }
    Map<String, Long> modificationStamps = myExternalConfigModificationStamps.get();
    for (String path : linkedProjectPathsToForget) {
        modificationStamps.remove(path);
    }
}
Also used : ExternalTaskPojo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo) ExternalTaskExecutionInfo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo) ExternalProjectBuildClasspathPojo(com.intellij.openapi.externalSystem.model.project.ExternalProjectBuildClasspathPojo) ExternalProjectPojo(com.intellij.openapi.externalSystem.model.project.ExternalProjectPojo)

Example 14 with ExternalTaskExecutionInfo

use of com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo in project intellij-community by JetBrains.

the class ExternalSystemActionUtil method buildTaskInfo.

@NotNull
public static ExternalTaskExecutionInfo buildTaskInfo(@NotNull TaskData task) {
    ExternalSystemTaskExecutionSettings settings = new ExternalSystemTaskExecutionSettings();
    settings.setExternalProjectPath(task.getLinkedExternalProjectPath());
    settings.setTaskNames(Collections.singletonList(task.getName()));
    settings.setTaskDescriptions(Collections.singletonList(task.getDescription()));
    settings.setExternalSystemIdString(task.getOwner().toString());
    return new ExternalTaskExecutionInfo(settings, DefaultRunExecutor.EXECUTOR_ID);
}
Also used : ExternalTaskExecutionInfo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo) ExternalSystemTaskExecutionSettings(com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ExternalTaskExecutionInfo (com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo)14 ExternalSystemTaskExecutionSettings (com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)6 RunManagerEx (com.intellij.execution.RunManagerEx)4 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)4 ExternalProjectPojo (com.intellij.openapi.externalSystem.model.project.ExternalProjectPojo)4 Nullable (org.jetbrains.annotations.Nullable)4 NotNull (org.jetbrains.annotations.NotNull)3 ExternalTaskPojo (com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo)2 NotificationData (com.intellij.openapi.externalSystem.service.notification.NotificationData)2 Module (com.intellij.openapi.module.Module)2 Project (com.intellij.openapi.project.Project)2 CommandLineArgumentException (org.gradle.cli.CommandLineArgumentException)2 ExecuteGradleTaskHistoryService (org.jetbrains.plugins.gradle.service.task.ExecuteGradleTaskHistoryService)2 GradleRunTaskDialog (org.jetbrains.plugins.gradle.service.task.GradleRunTaskDialog)2 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)1 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 CommonDataKeys (com.intellij.openapi.actionSystem.CommonDataKeys)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1