Search in sources :

Example 11 with ExternalSystemTaskExecutionSettings

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

the class RunConfigurationNode method update.

@Override
protected void update(PresentationData presentation) {
    super.update(presentation);
    presentation.setIcon(ProgramRunnerUtil.getConfigurationIcon(mySettings, false));
    final ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration) mySettings.getConfiguration();
    final ExternalSystemTaskExecutionSettings taskExecutionSettings = runConfiguration.getSettings();
    final String shortcutHint = StringUtil.nullize(getShortcutsManager().getDescription(taskExecutionSettings.getExternalProjectPath(), mySettings.getName()));
    final String activatorHint = StringUtil.nullize(getTaskActivator().getDescription(taskExecutionSettings.getExternalSystemId(), taskExecutionSettings.getExternalProjectPath(), getRunConfigurationActivationTaskName(mySettings)));
    String hint;
    if (shortcutHint == null) {
        hint = activatorHint;
    } else if (activatorHint == null) {
        hint = shortcutHint;
    } else {
        hint = shortcutHint + ", " + activatorHint;
    }
    setNameAndTooltip(getName(), StringUtil.join(taskExecutionSettings.getTaskNames(), " "), hint);
}
Also used : ExternalSystemRunConfiguration(com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration) ExternalSystemTaskExecutionSettings(com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)

Example 12 with ExternalSystemTaskExecutionSettings

use of com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings 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)

Example 13 with ExternalSystemTaskExecutionSettings

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

the class AbstractExternalSystemRunConfigurationProducer method setupConfigurationFromContext.

@Override
protected boolean setupConfigurationFromContext(ExternalSystemRunConfiguration configuration, ConfigurationContext context, Ref<PsiElement> sourceElement) {
    Project project = getProjectFromContext(context);
    if (project == null)
        return false;
    ExternalSystemTaskExecutionSettings contextTaskExecutionSettings = getTaskSettingsFromContext(context);
    if (contextTaskExecutionSettings == null)
        return false;
    ExternalSystemTaskExecutionSettings taskExecutionSettings = configuration.getSettings();
    if (!contextTaskExecutionSettings.getExternalSystemId().equals(taskExecutionSettings.getExternalSystemId())) {
        return false;
    }
    taskExecutionSettings.setExternalProjectPath(contextTaskExecutionSettings.getExternalProjectPath());
    taskExecutionSettings.setTaskNames(contextTaskExecutionSettings.getTaskNames());
    configuration.setName(AbstractExternalSystemTaskConfigurationType.generateName(project, taskExecutionSettings));
    return true;
}
Also used : Project(com.intellij.openapi.project.Project) ExternalSystemTaskExecutionSettings(com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)

Example 14 with ExternalSystemTaskExecutionSettings

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

the class AbstractExternalSystemRunConfigurationProducer method isConfigurationFromContext.

@Override
public boolean isConfigurationFromContext(ExternalSystemRunConfiguration configuration, ConfigurationContext context) {
    Project project = getProjectFromContext(context);
    if (project == null)
        return false;
    ExternalSystemTaskExecutionSettings contextTaskExecutionSettings = getTaskSettingsFromContext(context);
    if (contextTaskExecutionSettings == null)
        return false;
    ExternalSystemTaskExecutionSettings taskExecutionSettings = configuration.getSettings();
    if (!contextTaskExecutionSettings.getExternalSystemId().equals(taskExecutionSettings.getExternalSystemId())) {
        return false;
    }
    if (!StringUtil.equals(contextTaskExecutionSettings.getExternalProjectPath(), taskExecutionSettings.getExternalProjectPath())) {
        return false;
    }
    if (!contextTaskExecutionSettings.getTaskNames().equals(taskExecutionSettings.getTaskNames()))
        return false;
    return true;
}
Also used : Project(com.intellij.openapi.project.Project) ExternalSystemTaskExecutionSettings(com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)

Example 15 with ExternalSystemTaskExecutionSettings

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

the class AbstractExternalSystemRuntimeConfigurationProducer method createConfigurationByElement.

@Nullable
@Override
protected RunnerAndConfigurationSettings createConfigurationByElement(Location location, ConfigurationContext context) {
    if (!(location instanceof ExternalSystemTaskLocation)) {
        return null;
    }
    ExternalSystemTaskLocation taskLocation = (ExternalSystemTaskLocation) location;
    mySourceElement = taskLocation.getPsiElement();
    RunManagerEx runManager = RunManagerEx.getInstanceEx(taskLocation.getProject());
    RunnerAndConfigurationSettings settings = runManager.createConfiguration("", getConfigurationFactory());
    ExternalSystemRunConfiguration configuration = (ExternalSystemRunConfiguration) settings.getConfiguration();
    ExternalSystemTaskExecutionSettings taskExecutionSettings = configuration.getSettings();
    ExternalTaskExecutionInfo task = taskLocation.getTaskInfo();
    taskExecutionSettings.setExternalProjectPath(task.getSettings().getExternalProjectPath());
    taskExecutionSettings.setTaskNames(task.getSettings().getTaskNames());
    configuration.setName(AbstractExternalSystemTaskConfigurationType.generateName(location.getProject(), taskExecutionSettings));
    return settings;
}
Also used : RunManagerEx(com.intellij.execution.RunManagerEx) ExternalTaskExecutionInfo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) ExternalSystemTaskExecutionSettings(com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ExternalSystemTaskExecutionSettings (com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)19 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)7 ExternalTaskExecutionInfo (com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo)6 ExternalSystemRunConfiguration (com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration)6 NotNull (org.jetbrains.annotations.NotNull)5 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)3 Module (com.intellij.openapi.module.Module)3 Project (com.intellij.openapi.project.Project)3 RunManagerEx (com.intellij.execution.RunManagerEx)2 ProjectSystemId (com.intellij.openapi.externalSystem.model.ProjectSystemId)2 ExternalTaskPojo (com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo)2 Phase (com.intellij.openapi.externalSystem.service.project.manage.ExternalSystemTaskActivator.Phase)2 TaskCallback (com.intellij.openapi.externalSystem.task.TaskCallback)2 ExternalSystemNode (com.intellij.openapi.externalSystem.view.ExternalSystemNode)2 Nullable (org.jetbrains.annotations.Nullable)2 CantRunException (com.intellij.execution.CantRunException)1 ApplicationConfiguration (com.intellij.execution.application.ApplicationConfiguration)1 JavaParameters (com.intellij.execution.configurations.JavaParameters)1 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)1