void (@NotNull final Project project, Editor editor, final PsiFile file, DataContext dataContext) { myProject = project; final int offset = editor.getCaretModel().getOffset(); editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); final @Nullable PsiClass anonymousOrLocal = findClassToMove(file, offset); if (anonymousOrLocal == null) { showErrorMessage(editor, RefactoringBundle.getCannotRefactorMessage(JavaRefactoringBundle.message("error.wrong.caret.position.anonymous"))); return; } final PsiElement parent = anonymousOrLocal.getParent(); if (parent instanceof PsiEnumConstant) { showErrorMessage(editor, RefactoringBundle.getCannotRefactorMessage( JavaRefactoringBundle.message("anonymous.to.inner.enum.constant.cannot.refactor.message"))); return; } invoke(project, editor, anonymousOrLocal); }