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 || !SafeDeleteProcessor.validElement(element)) { String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("is.not.supported.in.the.current.context", getRefactoringName())); CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), "refactoring.safeDelete"); return; } invoke(project, new PsiElement[]{element}, dataContext); }