void (@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) { PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext); editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); if (element == null) { element = file.findElementAt(editor.getCaretModel().getOffset()); } if (element == null) return; if (element instanceof PsiIdentifier) element = element.getParent(); if (!(element instanceof PsiMethod)) { String message = RefactoringBundle.getCannotRefactorMessage(JavaRefactoringBundle.message("error.wrong.caret.position.method")); CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HelpID.MOVE_INSTANCE_METHOD); return; } if (LOG.isDebugEnabled()) { LOG.debug("Move Instance Method invoked"); } invoke(project, new PsiElement[]{element}, dataContext); }