@Override
  public @Nullable CommandToken startCommand(final @Nullable Project project,
                                             final String name,
                                             final @Nullable Object groupId,
                                             final @NotNull UndoConfirmationPolicy undoConfirmationPolicy) {
    ApplicationManager.getApplication().assertWriteIntentLockAcquired();
    if (project != null && project.isDisposed()) return null;

    if (CommandLog.LOG.isDebugEnabled()) {
      CommandLog.LOG.debug("startCommand: name = " + name + ", groupId = " + groupId);
    }

    if (myCurrentCommand != null) {
      return null;
    }

    Document document = groupId instanceof Document
                        ? (Document)groupId
                        : groupId instanceof Ref && ((Ref<?>)groupId).get() instanceof Document
                           ? (Document)((Ref<?>)groupId).get()
                           : null;
    myCurrentCommand = new CommandDescriptor(EmptyRunnable.INSTANCE, project, name, groupId, undoConfirmationPolicy, true, document);
    fireCommandStarted();
    return myCurrentCommand;
  }
@Override
  public @Nullable CommandToken startCommand(final @Nullable Project project,
                                             final String name,
                                             final @Nullable Object groupId,
                                             final @NotNull UndoConfirmationPolicy undoConfirmationPolicy)