move refactoring: call completeJustSubmittedTasks before refreshing PSI (IDEA-CR...
authorpeter <peter@jetbrains.com>
Tue, 15 Nov 2016 19:00:31 +0000 (20:00 +0100)
committerpeter <peter@jetbrains.com>
Tue, 15 Nov 2016 19:00:31 +0000 (20:00 +0100)
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesUtil.java
plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/move/MoveGroovyClassHandler.java

index a9f6dbb2a44ebd0625f8e225cc00ffee590afb5b..d3f1a6f223ed26eda6aae2318c6a0be2ae50d555 100644 (file)
@@ -239,10 +239,11 @@ public class MoveClassesOrPackagesUtil {
 
       Project project = file.getProject();
       MoveFilesOrDirectoriesUtil.doMoveFile(file, moveDestination);
-      file = moveDestination.findFile(file.getName());
 
       DumbService.getInstance(project).completeJustSubmittedTasks();
 
+      file = moveDestination.findFile(file.getName());
+
       if (newPackage != null && file instanceof PsiClassOwner && !FileTypeUtils.isInServerPageFile(file) && !PsiUtil.isModuleFile(file)) {
         // Do not rely on class instance identity retention after setPackageName (Scala)
         String aClassName = aClass.getName();
index e8904a8ade2b5b8437fbe7f531ad0b57eec08fea..420ba119902ec4315ef0855c87dc0951a063a20b 100644 (file)
@@ -76,10 +76,13 @@ public class MoveGroovyClassHandler implements MoveClassHandler {
       final PsiClass[] classes = ((GroovyFile)file).getClasses();
       if (classes.length == 1) {
         if (!moveDestination.equals(file.getContainingDirectory())) {
+          Project project = file.getProject();
           MoveFilesOrDirectoriesUtil.doMoveFile(file, moveDestination);
+
+          DumbService.getInstance(project).completeJustSubmittedTasks();
+
           file = moveDestination.findFile(file.getName());
           assert file != null;
-          DumbService.getInstance(file.getProject()).completeJustSubmittedTasks();
           ((PsiClassOwner)file).setPackageName(newPackageName);
         }
         return ((GroovyFile)file).getScriptClass();