diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index c32d9ecda313..d4ce3c8b88e1 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -28,6 +28,7 @@ import com.intellij.execution.process.*; import com.intellij.execution.ui.RunContentDescriptor; import com.intellij.ide.DataManager; import com.intellij.ide.PowerSaveMode; +import com.intellij.ide.file.BatchFileChangeListener; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.application.Application; @@ -268,6 +269,12 @@ public class BuildManager implements ApplicationComponent{ }); + conn.subscribe(BatchFileChangeListener.TOPIC, new BatchFileChangeListener.Adapter() { + public void batchChangeStarted(Project project) { + cancelAutoMakeTasks(project); + } + }); + EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentAdapter() { @Override public void documentChanged(DocumentEvent e) { diff --git a/platform/platform-impl/src/com/intellij/ide/file/BatchFileChangeListener.java b/platform/platform-impl/src/com/intellij/ide/file/BatchFileChangeListener.java index 495d22761ad8..593c39885a46 100644 --- a/platform/platform-impl/src/com/intellij/ide/file/BatchFileChangeListener.java +++ b/platform/platform-impl/src/com/intellij/ide/file/BatchFileChangeListener.java @@ -15,6 +15,7 @@ */ package com.intellij.ide.file; +import com.intellij.openapi.project.Project; import com.intellij.util.messages.Topic; /** @@ -27,8 +28,18 @@ public interface BatchFileChangeListener { Topic TOPIC = Topic.create("Batch File Update", BatchFileChangeListener.class); - void batchChangeStarted(); + class Adapter implements BatchFileChangeListener { + @Override + public void batchChangeStarted(Project project) { + } + @Override + public void batchChangeCompleted(Project project) { + } + } - void batchChangeCompleted(); + + void batchChangeStarted(Project project); + + void batchChangeCompleted(Project project); } diff --git a/plugins/git4idea/src/git4idea/GitUtil.java b/plugins/git4idea/src/git4idea/GitUtil.java index fc72bc90d272..5f56de5674e1 100644 --- a/plugins/git4idea/src/git4idea/GitUtil.java +++ b/plugins/git4idea/src/git4idea/GitUtil.java @@ -19,6 +19,7 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.Collections2; import com.intellij.ide.file.BatchFileChangeListener; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressIndicator; @@ -1015,12 +1016,12 @@ public class GitUtil { public static void workingTreeChangeStarted(@NotNull Project project) { HeavyProcessLatch.INSTANCE.processStarted(); - project.getMessageBus().syncPublisher(BatchFileChangeListener.TOPIC).batchChangeStarted(); + ApplicationManager.getApplication().getMessageBus().syncPublisher(BatchFileChangeListener.TOPIC).batchChangeStarted(project); } public static void workingTreeChangeFinished(@NotNull Project project) { HeavyProcessLatch.INSTANCE.processFinished(); - project.getMessageBus().syncPublisher(BatchFileChangeListener.TOPIC).batchChangeCompleted(); + ApplicationManager.getApplication().getMessageBus().syncPublisher(BatchFileChangeListener.TOPIC).batchChangeCompleted(project); } }