@Override
  public void update(@NotNull AnActionEvent e) {
    for (AnAction action : getChildActionsOrStubs()) {
      if (action instanceof ExecuteExternalSystemRunConfigurationAction) {
        remove(action);
      }
    }

    Project project = e.getProject();

    List<ExternalSystemNode> selectedNodes = e.getData(ExternalSystemDataKeys.SELECTED_NODES);
    if (selectedNodes == null || selectedNodes.size() != 1 || !(selectedNodes.get(0) instanceof RunConfigurationNode runConfigurationNode)) {
      return;
    }

    final RunnerAndConfigurationSettings settings = runConfigurationNode.getSettings();

    if (settings == null || project == null) return;

    ProjectSystemId projectSystemId = e.getData(ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID);
    @SuppressWarnings("DuplicatedCode") final List<Executor> executors = new ArrayList<>();
    for (final Executor executor: Executor.EXECUTOR_EXTENSION_NAME.getExtensionList()) {
      if (executor instanceof ExecutorGroup) {
        executors.addAll(((ExecutorGroup<?>)executor).childExecutors());
      }
      else {
        executors.add(executor);
      }
    }
    for (int i = executors.size(); --i >= 0; ) {
      Executor executor = executors.get(i);
      if (!executor.isApplicable(project)) {
        continue;
      }
      ProgramRunner<?> runner = ProgramRunner.getRunner(executor.getId(), settings.getConfiguration());
      AnAction action = new ExecuteExternalSystemRunConfigurationAction(executor, runner != null, project, projectSystemId, settings);
      addAction(action, Constraints.FIRST);
    }

    super.update(e);
  }
@Override
  public void update(@NotNull AnActionEvent e)