use of com.intellij.refactoring.move.moveClassesOrPackages.AutocreatingSingleSourceRootMoveDestination in project smali by JesusFreke.
the class ClassMoveTest method doMove.
private void doMove(String oldQualifiedName, final String newPackage) throws Exception {
final PsiClass testClass = myJavaFacade.findClass(oldQualifiedName, GlobalSearchScope.allScope(getProject()));
final List<VirtualFile> contentSourceRoots = JavaProjectRootsUtil.getSuitableDestinationSourceRoots(getProject());
new MoveClassesOrPackagesProcessor(getProject(), new PsiClass[] { testClass }, new AutocreatingSingleSourceRootMoveDestination(new PackageWrapper(getPsiManager(), newPackage), contentSourceRoots.get(0)), false, false, null).run();
}
use of com.intellij.refactoring.move.moveClassesOrPackages.AutocreatingSingleSourceRootMoveDestination in project kotlin by JetBrains.
the class MoveKotlinTopLevelDeclarationsDialog method selectPackageBasedTargetDirAndDestination.
@Nullable
private Pair<VirtualFile, ? extends MoveDestination> selectPackageBasedTargetDirAndDestination(boolean askIfDoesNotExist) {
String packageName = getTargetPackage();
RecentsManager.getInstance(myProject).registerRecentEntry(RECENTS_KEY, packageName);
PackageWrapper targetPackage = new PackageWrapper(PsiManager.getInstance(myProject), packageName);
if (!targetPackage.exists() && askIfDoesNotExist) {
int ret = Messages.showYesNoDialog(myProject, RefactoringBundle.message("package.does.not.exist", packageName), RefactoringBundle.message("move.title"), Messages.getQuestionIcon());
if (ret != Messages.YES)
return null;
}
DirectoryChooser.ItemWrapper selectedItem = (DirectoryChooser.ItemWrapper) destinationFolderCB.getComboBox().getSelectedItem();
PsiDirectory selectedPsiDirectory = selectedItem != null ? selectedItem.getDirectory() : null;
if (selectedPsiDirectory == null) {
if (initialTargetDirectory != null) {
selectedPsiDirectory = initialTargetDirectory;
} else {
return Pair.create(null, new MultipleRootsMoveDestination(targetPackage));
}
}
VirtualFile targetDirectory = selectedPsiDirectory.getVirtualFile();
return Pair.create(targetDirectory, new AutocreatingSingleSourceRootMoveDestination(targetPackage, targetDirectory));
}
Aggregations