mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
give Changes View threads a chance to invokeAndWait, e.g. for VFS refresh events (ChangeListManagerImpl.waitEverythingDoneInTestMode)
This commit is contained in:
@@ -57,6 +57,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.intellij.util.continuation.ContinuationPause;
|
||||
import com.intellij.util.messages.Topic;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.CalledInAwt;
|
||||
@@ -65,10 +66,7 @@ import org.jetbrains.annotations.*;
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
@@ -1684,10 +1682,14 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
|
||||
@TestOnly
|
||||
public void waitEverythingDoneInTestMode() {
|
||||
assert ApplicationManager.getApplication().isUnitTestMode();
|
||||
Future future = ourUpdateAlarm.get();
|
||||
if (future != null) {
|
||||
while (true) {
|
||||
Future future = ourUpdateAlarm.get();
|
||||
if (future == null) break;
|
||||
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
try {
|
||||
future.get();
|
||||
future.get(10, TimeUnit.MILLISECONDS);
|
||||
break;
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
LOG.error(e);
|
||||
@@ -1695,6 +1697,8 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
|
||||
catch (ExecutionException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
catch (TimeoutException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user