示例#1
0
 @Override
 public boolean canExecuteTask(RunConfiguration configuration, RunConfigurableBeforeRunTask task) {
   RunnerAndConfigurationSettings settings = task.getSettings();
   if (settings == null) {
     return false;
   }
   String executorId = DefaultRunExecutor.getRunExecutorInstance().getId();
   final ProgramRunner runner = ProgramRunnerUtil.getRunner(executorId, settings);
   return runner != null && runner.canRun(executorId, settings.getConfiguration());
 }
示例#2
0
  @NotNull
  private static List<RunnerAndConfigurationSettings> getAvailableConfigurations(
      RunConfiguration runConfiguration) {
    Project project = runConfiguration.getProject();
    if (project == null || !project.isInitialized()) return Collections.emptyList();
    final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project);

    final ArrayList<RunnerAndConfigurationSettings> configurations =
        new ArrayList<RunnerAndConfigurationSettings>(runManager.getSortedConfigurations());
    String executorId = DefaultRunExecutor.getRunExecutorInstance().getId();
    for (Iterator<RunnerAndConfigurationSettings> iterator = configurations.iterator();
        iterator.hasNext(); ) {
      RunnerAndConfigurationSettings settings = iterator.next();
      final ProgramRunner runner = ProgramRunnerUtil.getRunner(executorId, settings);
      if (runner == null || settings.getConfiguration() == runConfiguration) iterator.remove();
    }
    return configurations;
  }
 private static void start(@NotNull ExecutionEnvironment environment) {
   RunnerAndConfigurationSettings settings = environment.getRunnerAndConfigurationSettings();
   ProgramRunnerUtil.executeConfiguration(
       environment, settings != null && settings.isEditBeforeRun(), true);
 }
示例#4
0
 @Override
 public Icon getTaskIcon(RunConfigurableBeforeRunTask task) {
   if (task.getSettings() == null) return null;
   return ProgramRunnerUtil.getConfigurationIcon(task.getSettings(), false);
 }