Java Code Examples for com.intellij.execution.runners.ExecutionEnvironment.getRunnerAndConfigurationSettings()

The following are Jave code examples for showing how to use getRunnerAndConfigurationSettings() of the com.intellij.execution.runners.ExecutionEnvironment class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: intellij-ce-playground   File: ServersTreeStructure.java   Source Code and License Vote up 5 votes
public void doDeploy(Executor executor) {
  DeploymentTask<?> deploymentTask = getDeployment().getDeploymentTask();
  if (deploymentTask != null) {
    ExecutionEnvironment environment = ((DeploymentTaskImpl)deploymentTask).getExecutionEnvironment();
    RunnerAndConfigurationSettings settings = environment.getRunnerAndConfigurationSettings();
    if (settings != null) {
      ProgramRunnerUtil.executeConfiguration(doGetProject(), settings, executor);
    }
  }
}
 
Example 2
Project: intellij   File: BlazeCidrRunConfigurationHandler.java   Source Code and License Vote up 5 votes
@Override
public BlazeCommandRunConfigurationRunner createRunner(
    Executor executor, ExecutionEnvironment environment) {
  RunnerAndConfigurationSettings settings = environment.getRunnerAndConfigurationSettings();
  RunConfiguration config = settings != null ? settings.getConfiguration() : null;
  if (config instanceof BlazeCommandRunConfiguration
      && RunConfigurationUtils.canUseClionRunner((BlazeCommandRunConfiguration) config)) {
    return new BlazeCidrRunConfigurationRunner((BlazeCommandRunConfiguration) config);
  }
  return new BlazeCommandGenericRunConfigurationRunner();
}
 
Example 3
Project: intellij-ce-playground   File: RunManagerImpl.java   Source Code and License Vote up 4 votes
public static boolean canRunConfiguration(@NotNull ExecutionEnvironment environment) {
  RunnerAndConfigurationSettings runnerAndConfigurationSettings = environment.getRunnerAndConfigurationSettings();
  return runnerAndConfigurationSettings != null && canRunConfiguration(runnerAndConfigurationSettings, environment.getExecutor());
}
 
Example 4
Project: intellij-ce-playground   File: ExecutionManagerImpl.java   Source Code and License Vote up 4 votes
private static void start(@NotNull ExecutionEnvironment environment) {
  RunnerAndConfigurationSettings settings = environment.getRunnerAndConfigurationSettings();
  ProgramRunnerUtil.executeConfiguration(environment, settings != null && settings.isEditBeforeRun(), true);
}
 
Example 5
Project: intellij-ce-playground   File: ProgramRunnerUtil.java   Source Code and License Vote up 4 votes
public static void executeConfiguration(@NotNull ExecutionEnvironment environment, boolean showSettings, boolean assignNewId) {
  if (ExecutorRegistry.getInstance().isStarting(environment)) {
    return;
  }

  RunnerAndConfigurationSettings runnerAndConfigurationSettings = environment.getRunnerAndConfigurationSettings();
  if (runnerAndConfigurationSettings != null) {
    if (!ExecutionTargetManager.canRun(environment)) {
      ExecutionUtil.handleExecutionError(environment, new ExecutionException(
        StringUtil.escapeXml("Cannot run '" + environment.getRunProfile().getName() + "' on '" + environment.getExecutionTarget().getDisplayName() + "'")));
      return;
    }

    if (!RunManagerImpl.canRunConfiguration(environment) || (showSettings && runnerAndConfigurationSettings.isEditBeforeRun())) {
      if (!RunDialog.editConfiguration(environment, "Edit configuration")) {
        return;
      }

      while (!RunManagerImpl.canRunConfiguration(environment)) {
        if (Messages.YES == Messages
          .showYesNoDialog(environment.getProject(), "Configuration is still incorrect. Do you want to edit it again?", "Change Configuration Settings",
                           "Edit", "Continue Anyway", Messages.getErrorIcon())) {
          if (!RunDialog.editConfiguration(environment, "Edit configuration")) {
            return;
          }
        }
        else {
          break;
        }
      }
    }

    ConfigurationType configurationType = runnerAndConfigurationSettings.getType();
    if (configurationType != null) {
      UsageTrigger.trigger("execute." + ConvertUsagesUtil.ensureProperKey(configurationType.getId()) + "." + environment.getExecutor().getId());
    }
  }

  try {
    if (assignNewId) {
      environment.assignNewExecutionId();
    }
    environment.getRunner().execute(environment);
  }
  catch (ExecutionException e) {
    String name = runnerAndConfigurationSettings != null ? runnerAndConfigurationSettings.getName() : null;
    if (name == null) {
      name = environment.getRunProfile().getName();
    }
    if (name == null && environment.getContentToReuse() != null) {
      name = environment.getContentToReuse().getDisplayName();
    }
    if (name == null) {
      name = "<Unknown>";
    }
    ExecutionUtil.handleExecutionError(environment.getProject(), environment.getExecutor().getToolWindowId(), name, e);
  }
}