From 74ef93fd0cfca6a518c78a2630ed39a42d8da674 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Thu, 13 Aug 2015 13:49:38 +0300 Subject: [PATCH] Move Declarations: Do not show "Package doesn't exist" message twice --- .../ui/MoveKotlinTopLevelDeclarationsDialog.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveTopLevelDeclarations/ui/MoveKotlinTopLevelDeclarationsDialog.java b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveTopLevelDeclarations/ui/MoveKotlinTopLevelDeclarationsDialog.java index 3e59ad973d4..cf4e2a9a730 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveTopLevelDeclarations/ui/MoveKotlinTopLevelDeclarationsDialog.java +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveTopLevelDeclarations/ui/MoveKotlinTopLevelDeclarationsDialog.java @@ -347,12 +347,12 @@ public class MoveKotlinTopLevelDeclarationsDialog extends RefactoringDialog { } @Nullable - private MoveDestination selectPackageBasedMoveDestination() { + private MoveDestination selectPackageBasedMoveDestination(boolean askIfDoesNotExist) { String packageName = getTargetPackage(); RecentsManager.getInstance(myProject).registerRecentEntry(RECENTS_KEY, packageName); PackageWrapper targetPackage = new PackageWrapper(PsiManager.getInstance(myProject), packageName); - if (!targetPackage.exists()) { + 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; @@ -378,7 +378,7 @@ public class MoveKotlinTopLevelDeclarationsDialog extends RefactoringDialog { setErrorText(null); if (isMoveToPackage()) { - final MoveDestination moveDestination = selectPackageBasedMoveDestination(); + final MoveDestination moveDestination = selectPackageBasedMoveDestination(true); if (moveDestination == null) return null; final String targetFileName = tfFileNameInPackage.getText(); @@ -541,7 +541,7 @@ public class MoveKotlinTopLevelDeclarationsDialog extends RefactoringDialog { if (elementsToMove.size() == sourceFile.getDeclarations().size()) { if (isMoveToPackage()) { - final MoveDestination moveDestination = selectPackageBasedMoveDestination(); + final MoveDestination moveDestination = selectPackageBasedMoveDestination(false); //noinspection ConstantConditions PsiDirectory targetDir = moveDestination.getTargetIfExists(sourceFile); final String targetFileName = tfFileNameInPackage.getText();