@Override
  public void doExecute(final @NotNull Editor editor, final @Nullable Caret caret, final DataContext dataContext) {
    boolean preview = IntentionPreviewUtils.getPreviewEditor() == editor;
    if (!preview) {
      if (!EditorModificationUtil.checkModificationAllowed(editor)) return;
      if (!ApplicationManager.getApplication().isWriteAccessAllowed() && !EditorModificationUtil.requestWriting(editor)) return;
    }

    DocumentRunnable runnable = new DocumentRunnable(editor.getDocument(), editor.getProject()) {
      @Override
      public void run() {
        final Document doc = editor.getDocument();

        doc.startGuardedBlockChecking();
        try {
          executeWriteAction(editor, caret, dataContext);
        }
        catch (ReadOnlyFragmentModificationException e) {
          EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e);
        }
        finally {
          doc.stopGuardedBlockChecking();
        }
      }
    };
    if (preview || editor instanceof TextComponentEditor) {
      runnable.run();
    }
    else {
      ApplicationManager.getApplication().runWriteAction(runnable);
    }
  }
@Override
  public void doExecute(final @NotNull Editor editor, final @Nullable Caret caret, final DataContext dataContext)