@Nullable
  @Override
  public ExecutionResult execute(Executor executor, @NotNull ProgramRunner<?> runner) throws ExecutionException {
    if (myProject.isDisposed()) return null;

    ProjectSystemId externalSystemId = mySettings.getExternalSystemId();
    if (!confirmLoadingUntrustedProject(myProject, externalSystemId)) {
      String externalSystemName = externalSystemId.getReadableName();
      throw new ExecutionException(ExternalSystemBundle.message("untrusted.project.notification.execution.error", externalSystemName));
    }

    String jvmParametersSetup = getJvmParametersSetup();

    ApplicationManager.getApplication().assertWriteIntentLockAcquired();
    FileDocumentManager.getInstance().saveAllDocuments();

    ExternalSystemExecuteTaskTask task = new ExternalSystemExecuteTaskTask(myProject, mySettings, jvmParametersSetup, myConfiguration);
    copyUserDataTo(task);
    addDebugUserDataTo(task);
    ExternalSystemTaskNotificationListener listener = myEnv.getUserData(TASK_NOTIFICATION_LISTENER_KEY);
    if (listener != null) {
      ExternalSystemProgressNotificationManager.getInstance().addNotificationListener(task.getId(), listener);
    }

    final String executionName = getExecutionName(externalSystemId);

    final ExternalSystemProcessHandler processHandler = new ExternalSystemProcessHandler(task, executionName);
    final ExternalSystemExecutionConsoleManager<ExecutionConsole, ProcessHandler>
      consoleManager = getConsoleManagerFor(task);

    final ExecutionConsole consoleView =
      consoleManager.attachExecutionConsole(myProject, task, myEnv, processHandler);
    AnAction[] customActions, restartActions, contextActions;
    if (consoleView == null) {
      customActions = AnAction.EMPTY_ARRAY;
      restartActions = AnAction.EMPTY_ARRAY;
      contextActions = AnAction.EMPTY_ARRAY;
      Disposer.register(myProject, processHandler);
    }
    else {
      Disposer.register(myProject, consoleView);
      Disposer.register(consoleView, processHandler);
      customActions = consoleManager.getCustomActions(myProject, task, myEnv);
      restartActions = consoleManager.getRestartActions(consoleView);
      contextActions = consoleManager.getCustomContextActions(myProject, task, myEnv);
    }
    DefaultBuildDescriptor buildDescriptor =
      new DefaultBuildDescriptor(task.getId(), executionName, task.getExternalProjectPath(), System.currentTimeMillis());
    Class<? extends BuildProgressListener> progressListenerClazz = task.getUserData(ExternalSystemRunConfiguration.PROGRESS_LISTENER_KEY);
    Filter[] filters = consoleManager.getCustomExecutionFilters(myProject, task, myEnv);
    Arrays.stream(filters).forEach(buildDescriptor::withExecutionFilter);
    final BuildProgressListener progressListener =
      progressListenerClazz != null ? myProject.getService(progressListenerClazz)
                                    : createBuildView(buildDescriptor, consoleView);

    var runnerSettings = myEnv.getRunnerSettings();
    var runConfigurationExtensionManager = ExternalSystemRunConfigurationExtensionManager.getInstance();
    runConfigurationExtensionManager.attachExtensionsToProcess(myConfiguration, processHandler, runnerSettings);
    ApplicationManager.getApplication().executeOnPooledThread(
      () -> {
        var progressIndicator = myEnv.getUserData(PROGRESS_INDICATOR_KEY);
        if (progressIndicator == null) {
          progressIndicator = new EmptyProgressIndicator();
        }
        executeTask(task, executionName, progressIndicator, processHandler, progressListener, consoleManager, consoleView,
                    buildDescriptor, customActions, restartActions, contextActions);
      }
    );
    ExecutionConsole executionConsole = progressListener instanceof ExecutionConsole ? (ExecutionConsole)progressListener : consoleView;
    DefaultActionGroup actionGroup = new DefaultActionGroup();
    if (executionConsole instanceof BuildView) {
      actionGroup.addAll(((BuildView)executionConsole).getSwitchActions());
      actionGroup.add(BuildTreeFilters.createFilteringActionsGroup((BuildView)executionConsole));
    }
    RunConfigurationTaskState taskState = myConfiguration.getUserData(RunConfigurationTaskState.getKEY());
    if (taskState != null && consoleView != null) {
      actionGroup.addAll(taskState.createCustomActions(processHandler, consoleView, executor));
    }

    DefaultExecutionResult executionResult = new DefaultExecutionResult(
      executionConsole, processHandler, actionGroup.getChildren(ActionManager.getInstance()));
    executionResult.setRestartActions(restartActions);
    return executionResult;
  }
@Nullable
  @Override
  public ExecutionResult execute(Executor executor, @NotNull ProgramRunner<?> runner)