From 30cafdab857e5f4bc2ddf5ddc068f9c06856db71 Mon Sep 17 00:00:00 2001 From: irengrig Date: Mon, 8 Aug 2011 22:41:36 +0400 Subject: [PATCH] annotate stacktrace: clear heavy request queue on console clear --- .../src/com/intellij/execution/impl/ConsoleViewImpl.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java index 013019af2da3..d78feee7273c 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java @@ -115,6 +115,8 @@ public class ConsoleViewImpl implements ConsoleView, ObservableConsoleView, Data private final Alarm mySpareTimeAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, this); @Nullable private final Alarm myHeavyAlarm; + @Nullable + private int myHeavyUpdateTicket; private final CopyOnWriteArraySet myListeners = new CopyOnWriteArraySet(); private final ArrayList customActions = new ArrayList(); @@ -291,6 +293,7 @@ public class ConsoleViewImpl implements ConsoleView, ObservableConsoleView, Data myPredefinedMessageFilter.addFilter(filter); } } + myHeavyUpdateTicket = 0; if (myPredefinedMessageFilter.isAnyHeavy()) { myHeavyAlarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, this); } else { @@ -327,6 +330,10 @@ public class ConsoleViewImpl implements ConsoleView, ObservableConsoleView, Data } myFlushAlarm.cancelAllRequests(); myFlushAlarm.addRequest(myClearRequest, 0, getStateForUpdate()); + if (myHeavyAlarm != null) { + myHeavyAlarm.cancelAllRequests(); + ++ myHeavyUpdateTicket; + } } public void scrollTo(final int offset) { @@ -826,6 +833,7 @@ public class ConsoleViewImpl implements ConsoleView, ObservableConsoleView, Data documentCopy.setReadOnly(true); myJLayeredPane.startUpdating(); + final int currentValue = myHeavyUpdateTicket; myHeavyAlarm.addRequest(new Runnable() { @Override public void run() { @@ -839,6 +847,7 @@ public class ConsoleViewImpl implements ConsoleView, ObservableConsoleView, Data myFlushAlarm.addRequest(new Runnable() { @Override public void run() { + if (myHeavyUpdateTicket != currentValue) return; myHyperlinks.adjustHighlighters(Collections.singletonList(additionalHighlight)); } }, 0);