@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
    int offset = editor.getCaretModel().getOffset();
    editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
    PsiElement element = file.findElementAt(offset);
    if (element == null) {
      element = file;
    }

    PsiReference reference = TargetElementUtilBase.findReferenceWithoutExpectedCaret(editor);
    if (reference != null) {
      PsiElement refElement = reference.resolve();
      for (MoveHandlerDelegate delegate: MoveHandlerDelegate.EP_NAME.getExtensionList()) {
        if (refElement != null && delegate.tryToMove(refElement, project, dataContext, reference, editor)) {
          logDelegate(project, delegate, refElement.getLanguage());
          return;
        }
      }
    }

    List<MoveHandlerDelegate> candidateHandlers = findHandlersForLanguage(element);
    while (true) {
      if (element == null) {
        String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("the.caret.should.be.positioned.at.the.class.method.or.field.to.be.refactored"));
        CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), null);
        return;
      }

      for (MoveHandlerDelegate delegate: candidateHandlers) {
        if (delegate.tryToMove(element, project, dataContext, null, editor)) {
          logDelegate(project, delegate, element.isValid() ? element.getLanguage() : null);
          return;
        }
      }

      element = element.getParent();
    }
  }
@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext)