mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Using "Batch File Change" events in BuildManager to cancel already running automake session while VCS is updating working tree (IDEA-111673)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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<BatchFileChangeListener> 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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user