Maven: suspend/resume conter bugfix
authorAnton Makeev <Anton.Makeev@jetbrains.com>
Fri, 12 Mar 2010 12:45:19 +0000 (15:45 +0300)
committerAnton Makeev <Anton.Makeev@jetbrains.com>
Fri, 12 Mar 2010 12:46:39 +0000 (15:46 +0300)
plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenMergingUpdateQueue.java

index 5bef4d9c4bed1e3a1f7f8473f5f8005ef97c408b..e553c7c2abfba52ff7dcf973d8a65dce14766ab6 100644 (file)
@@ -86,16 +86,18 @@ public class MavenMergingUpdateQueue extends MergingUpdateQueue {
           }
         }, MavenMergingUpdateQueue.this);
 
-        if (CommandProcessor.getInstance().getCurrentCommand() != null) {
-          suspend();
-        }
-
         ProjectRootManager.getInstance(project).addModuleRootListener(new ModuleRootListener() {
+          boolean beforeCalled = false;
+
           public void beforeRootsChange(ModuleRootEvent event) {
             suspend();
+            beforeCalled = true;
           }
 
           public void rootsChanged(ModuleRootEvent event) {
+            if (!beforeCalled) return;
+            beforeCalled = false;
+            
             resume();
             MavenMergingUpdateQueue.this.restartTimer();
           }
@@ -109,7 +111,6 @@ public class MavenMergingUpdateQueue extends MergingUpdateQueue {
       protected void run(Result result) throws Throwable {
         MessageBusConnection connection = project.getMessageBus().connect(MavenMergingUpdateQueue.this);
         connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
-
           public void enteredDumbMode() {
             suspend();
           }
@@ -118,6 +119,7 @@ public class MavenMergingUpdateQueue extends MergingUpdateQueue {
             resume();
           }
         });
+
         if (DumbService.getInstance(project).isDumb()) {
           suspend();
         }