MoveDestination (final PackageWrapper targetPackage, final boolean showChooserWhenDefault) { final DirectoryChooser.ItemWrapper selectedItem = (DirectoryChooser.ItemWrapper)getComboBox().getSelectedItem(); if (selectedItem == null || selectedItem == DirectoryChooser.ItemWrapper.NULL) { return new MultipleRootsMoveDestination(targetPackage); } final PsiDirectory selectedPsiDirectory = selectedItem.getDirectory(); Project project = targetPackage.getManager().getProject(); VirtualFile selectedDestination = ProjectRootManager.getInstance(project).getFileIndex().getSourceRootForFile(selectedPsiDirectory.getVirtualFile()); if (showChooserWhenDefault && myInitialTargetDirectory != null && Comparing.equal(selectedDestination, myInitialTargetDirectory.getVirtualFile()) && mySourceRoots.size() > 1) { selectedDestination = CommonMoveClassesOrPackagesUtil.chooseSourceRoot(targetPackage, mySourceRoots, myInitialTargetDirectory); } if (selectedDestination == null) return null; return new AutocreatingSingleSourceRootMoveDestination(targetPackage, selectedDestination); }