@Nullable
  private static Executor findExecutor(@NotNull RunnerAndConfigurationSettings settings,
                                       @MagicConstant(intValues = {RUN_MODE, DEBUG_MODE}) int mode) {
    Executor runExecutor = DefaultRunExecutor.getRunExecutorInstance();
    Executor debugExecutor = ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG);

    Executor executor = mode == RUN_MODE ? runExecutor : debugExecutor;
    if (executor == null) {
      return null;
    }

    RunConfiguration runConf = settings.getConfiguration();
    if (ProgramRunner.getRunner(executor.getId(), runConf) == null) {
      executor = runExecutor == executor ? debugExecutor : runExecutor;
    }

    return executor;
  }
@Nullable
  private static Executor findExecutor(@NotNull RunnerAndConfigurationSettings settings,
                                       @MagicConstant(intValues = {RUN_MODE, DEBUG_MODE}) int mode)