void (@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) { editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext); if (element == null) { element = file.findElementAt(editor.getCaretModel().getOffset()); } final InvertBooleanDelegate delegate = InvertBooleanDelegate.findInvertBooleanDelegate(element); if (delegate == null) { CommonRefactoringUtil.showErrorHint(project, editor, RefactoringBundle.getCannotRefactorMessage( RefactoringBundle.message("error.wrong.caret.position.method.or.variable.name")), getRefactoringName(), INVERT_BOOLEAN_HELP_ID); return; } final PsiElement namedElement = delegate.adjustElement(element, project, editor); if (namedElement != null && PsiElementRenameHandler.canRename(project, editor, namedElement)) { new InvertBooleanDialog(namedElement).show(); } }