public final void actionPerformed(final Editor editor, final @NotNull DataContext dataContext) {
    if (editor == null) return;
    if (editor.isDisposed()) {
      VirtualFile file = FileDocumentManager.getInstance().getFile(editor.getDocument());
      LOG.error("Action " + this + " invoked on a disposed editor" + (file == null ? "" : " for file " + file));
      return;
    }

    final EditorActionHandler handler = getHandler();
    if (!handler.executeInCommand(editor, dataContext)) {
      executeHandler(handler, editor, dataContext);
      return;
    }

    String commandName = getTemplatePresentation().getText();
    if (commandName == null) commandName = "";
    CommandProcessor.getInstance().executeCommand(editor.getProject(),
                                                  () -> executeHandler(handler, editor, dataContext),
                                                  commandName,
                                                  handler.getCommandGroupId(editor),
                                                  UndoConfirmationPolicy.DEFAULT,
                                                  editor.getDocument());
  }
public final void actionPerformed(final Editor editor, final @NotNull DataContext dataContext)