private void performWriteCommandAction(@NotNull RunResult<T> result) {
    if (myPsiFiles.length > 0 && !FileModificationService.getInstance().preparePsiElementsForWrite(Arrays.asList(myPsiFiles))) {
      return;
    }

    // this is needed to prevent memory leak, since the command is put into undo queue
    Ref<RunResult<?>> resultRef = new Ref<>(result);
    doExecuteCommand(() -> ApplicationManager.getApplication().runWriteAction(() -> {
      resultRef.get().run();
      resultRef.set(null);
    }));
  }
private void performWriteCommandAction(@NotNull RunResult<T> result)