Move: Suggest creating Kotlin file if it doesn't exist

#KT-5379 Fixed
This commit is contained in:
Alexey Sedunov
2014-11-17 14:21:24 +03:00
parent d061c3d771
commit 7170209760
2 changed files with 11 additions and 1 deletions
@@ -42,4 +42,6 @@ package.private.0.will.no.longer.be.accessible.from.1=Package-private {0} will n
0.will.become.invisible.after.extraction={0} will become invisible after extraction
setter.of.0.will.become.invisible.after.extraction = Setter of {0} will become invisible after extraction
naming.convention.will.be.violated.after.rename=Naming conventions will be violated after rename
naming.convention.will.be.violated.after.rename=Naming conventions will be violated after rename
file.does.not.exist=File {0} does not exist.\nDo you want to create it?
@@ -297,6 +297,14 @@ public class MoveKotlinTopLevelDeclarationsDialog extends RefactoringDialog {
JetFile jetFile = (JetFile) RefactoringPackage.toPsiFile(targetFile, myProject);
if (jetFile != null) return new JetFileKotlinMoveTarget(jetFile);
int ret = Messages.showYesNoDialog(
myProject,
JetRefactoringBundle.message("file.does.not.exist", targetFile.getName()),
RefactoringBundle.message("move.title"),
Messages.getQuestionIcon()
);
if (ret != Messages.YES) return null;
File targetDir = targetFile.getParentFile();
final PsiDirectory psiDirectory = RefactoringPackage.toPsiDirectory(targetDir, myProject);
assert psiDirectory != null : "No directory found: " + targetDir.getPath();