void () { String errorString = null; final String innerClassName = getClassName(); final PsiManager manager = PsiManager.getInstance(myProject); if ("".equals(innerClassName)) { errorString = JavaRefactoringBundle.message("anonymousToInner.no.inner.class.name"); } else { if (!PsiNameHelper.getInstance(manager.getProject()).isIdentifier(innerClassName)) { errorString = RefactoringMessageUtil.getIncorrectIdentifierMessage(innerClassName); } else{ PsiElement targetContainer = AnonymousToInnerHandler.findTargetContainer(myAnonOrLocalClass); if (targetContainer instanceof PsiClass targetClass) { PsiClass[] innerClasses = targetClass.getInnerClasses(); for (PsiClass innerClass : innerClasses) { if (innerClassName.equals(innerClass.getName())) { errorString = JavaRefactoringBundle.message("inner.class.exists", innerClassName, targetClass.getName()); break; } } } else { LOG.assertTrue(false); } } } if (errorString != null) { CommonRefactoringUtil.showErrorMessage( JavaRefactoringBundle.message("anonymousToInner.refactoring.name"), errorString, HelpID.ANONYMOUS_TO_INNER, myProject); myNameField.requestFocusInWindow(); return; } super.doOKAction(); myNameField.requestFocusInWindow(); }