@Nullable private MoveDestination selectDestination() { final String packageName = getTargetPackage().trim(); if (packageName.length() > 0 && !PsiNameHelper.getInstance(myManager.getProject()).isQualifiedName(packageName)) { Messages.showErrorDialog( myProject, RefactoringBundle.message("please.enter.a.valid.target.package.name"), RefactoringBundle.message("move.title")); return null; } RecentsManager.getInstance(myProject).registerRecentEntry(RECENTS_KEY, packageName); PackageWrapper targetPackage = new PackageWrapper(myManager, packageName); if (!targetPackage.exists()) { final int ret = Messages.showYesNoDialog( myProject, RefactoringBundle.message("package.does.not.exist", packageName), RefactoringBundle.message("move.title"), Messages.getQuestionIcon()); if (ret != Messages.YES) return null; } return ((DestinationFolderComboBox) myDestinationFolderCB) .selectDirectory(targetPackage, mySuggestToMoveToAnotherRoot); }
@Override protected void canRun() throws ConfigurationException { if (isMoveToPackage()) { String name = getTargetPackage().trim(); if (name.length() != 0 && !PsiNameHelper.getInstance(myManager.getProject()).isQualifiedName(name)) { throw new ConfigurationException("\'" + name + "\' is invalid destination package name"); } } else { if (findTargetClass() == null) throw new ConfigurationException("Destination class not found"); final String validationError = verifyInnerClassDestination(); if (validationError != null) throw new ConfigurationException(validationError); } }