@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file, @NotNull DataContext dataContext) {
    PsiElement element = getElement(dataContext);
    if (element == null) {
      element = CommonRefactoringUtil.getElementAtCaret(editor, file);
    }

    if (ApplicationManager.getApplication().isUnitTestMode()) {
      final String newName = DEFAULT_NAME.getData(dataContext);
      if (newName != null) {
        rename(element, project, element, editor, newName);
        return;
      }
    }

    editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
    final PsiElement nameSuggestionContext = InjectedLanguageUtilBase.findElementAtNoCommit(file, editor.getCaretModel().getOffset());
    boolean checkInProject = shouldCheckInProject();
    List<String> suggestedNames = requireNonNullElse(NAME_SUGGESTIONS.getData(dataContext), List.of());
    invoke(element, project, nameSuggestionContext, suggestedNames, editor, checkInProject);
  }
@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file, @NotNull DataContext dataContext)