@Override
  public void executeCommand(@Nullable Project project,
                              @NotNull Runnable command,
                              @Nullable @NlsContexts.Command String name,
                              @Nullable Object groupId,
                              @NotNull UndoConfirmationPolicy undoConfirmationPolicy,
                              boolean shouldRecordCommandForActiveDocument,
                              @Nullable Document document) {
    Application application = ApplicationManager.getApplication();
    application.assertWriteIntentLockAcquired();

    if (CommandLog.LOG.isDebugEnabled()) {
      String currentCommandName;
      if (myCurrentCommand != null) currentCommandName = myCurrentCommand.myName;
      else currentCommandName = "<null>";
      CommandLog.LOG.debug("executeCommand: " + command + ", name = " + name + ", groupId = " + groupId +
                           ", in command = " + currentCommandName +
                           ", in transparent action = " + isUndoTransparentActionInProgress());
    }

    if (project != null && project.isDisposed()) {
      CommandLog.LOG.error("Project "+project+" already disposed");
      return;
    }

    if (myCurrentCommand != null) {
      command.run();
      return;
    }
    Throwable throwable = null;
    CommandDescriptor descriptor = new CommandDescriptor(command, project, name, groupId, undoConfirmationPolicy,
                                                         shouldRecordCommandForActiveDocument, document);
    try {
      myCurrentCommand = descriptor;
      fireCommandStarted();
      command.run();
    }
    catch (Throwable th) {
      throwable = th;
    }
    finally {
      Throwable finalThrowable = throwable;
      ProgressManager.getInstance().executeNonCancelableSection(() -> {
        finishCommand(descriptor, finalThrowable);
      });
      if (finalThrowable instanceof ProcessCanceledException) {
        throw (ProcessCanceledException)finalThrowable;
      }
    }
  }
@Override
  public void executeCommand(@Nullable Project project,
                              @NotNull Runnable command,
                              @Nullable @NlsContexts.Command String name,
                              @Nullable Object groupId,
                              @NotNull UndoConfirmationPolicy undoConfirmationPolicy,
                              boolean shouldRecordCommandForActiveDocument,
                              @Nullable Document document)