void () { final String packageName = myTfPackage.getText(); final String className = getClassName(); final String[] errorString = new String[1]; final PsiManager manager = PsiManager.getInstance(myProject); final PsiNameHelper nameHelper = PsiNameHelper.getInstance(manager.getProject()); if (packageName.length() > 0 && !nameHelper.isQualifiedName(packageName)) { errorString[0] = JavaRefactoringBundle.message("invalid.target.package.name.specified"); } else if (className != null && className.isEmpty()) { errorString[0] = JavaRefactoringBundle.message("no.class.name.specified"); } else { if (!nameHelper.isIdentifier(className)) { errorString[0] = RefactoringMessageUtil.getIncorrectIdentifierMessage(className); } else if (!myDoClone) { try { final PackageWrapper targetPackage = new PackageWrapper(manager, packageName); myDestination = myDestinationCB.selectDirectory(targetPackage, false); if (myDestination == null) return; } catch (IncorrectOperationException e) { errorString[0] = e.getMessage(); } } RecentsManager.getInstance(myProject).registerRecentEntry(RECENTS_KEY, packageName); } if (errorString[0] != null) { if (errorString[0].length() > 0) { Messages.showMessageDialog(myProject, errorString[0], RefactoringBundle.message("error.title"), Messages.getErrorIcon()); } myNameField.requestFocusInWindow(); return; } closeOKAction(); }