external system: run external system startup activity when the dumb mode ends
authorVladislav.Soroka <Vladislav.Soroka@jetbrains.com>
Thu, 26 Feb 2015 11:40:45 +0000 (14:40 +0300)
committerVladislav.Soroka <Vladislav.Soroka@jetbrains.com>
Thu, 26 Feb 2015 11:43:22 +0000 (14:43 +0300)
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java

index 1c9afb70f45e7f5dfc504ab5fcbc862c8e0bd4a0..949df203683c4b825a4c11c5f313e1c803b451fe 100644 (file)
@@ -26,9 +26,10 @@ import com.intellij.openapi.externalSystem.service.ui.ExternalToolWindowManager;
 import com.intellij.openapi.externalSystem.service.vcs.ExternalSystemVcsRegistrar;
 import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
 import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.startup.StartupActivity;
-import com.intellij.openapi.startup.StartupManager;
+import com.intellij.util.DisposeAwareRunnable;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -75,11 +76,6 @@ public class ExternalSystemStartupActivity implements StartupActivity {
       }
     };
 
-    if (project.isInitialized()) {
-      task.run();
-    }
-    else {
-      StartupManager.getInstance(project).registerPostStartupActivity(task);
-    }
+    DumbService.getInstance(project).runWhenSmart(DisposeAwareRunnable.create(task, project));
   }
 }