void (@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); while (true) { if (element == null || element instanceof PsiFile) { String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("error.wrong.caret.position.class")); CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HelpID.TURN_REFS_TO_SUPER); return; } if (element instanceof PsiClass && !(element instanceof PsiAnonymousClass)) { invoke(project, new PsiElement[]{element}, dataContext); return; } element = element.getParent(); } }