@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    final Editor editor = e.getData(CommonDataKeys.EDITOR);
    PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
    if (editor == null || file == null) return;
    final Project project = file.getProject();
    CommandProcessorEx commandProcessor = (CommandProcessorEx)CommandProcessor.getInstance();
    CommandToken commandToken = commandProcessor.startCommand(project, e.getPresentation().getText(), e.getPresentation().getText(), UndoConfirmationPolicy.DEFAULT);
    try {
      WriteAction.run(() -> {
        TextRange range = editor.getSelectionModel().hasSelection()
                          ? EditorUtil.getSelectionInAnyMode(editor)
                          : TextRange.create(0, editor.getDocument().getTextLength());
        perform(project, editor.getDocument(), range);
      });
    }
    finally {
      commandProcessor.finishCommand(commandToken, null);
    }
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)