From c4c5d9cb844d7ea70e3c00b80e320f09be4cc83e Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 6 Sep 2012 11:25:47 +0200 Subject: [PATCH] update status bar progress only when there is progress (IDEA-88837) --- .../wm/impl/status/InfoAndProgressPanel.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java index 0af9250822fb..b689f68bf456 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java @@ -55,10 +55,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.lang.ref.Reference; import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; +import java.util.*; public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidget { private final ProcessPopup myPopup; @@ -635,11 +632,13 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge private void runQuery() { if (getRootPane() == null) return; - synchronized (myOriginals) { - for (InlineProgressIndicator each : myInline2Original.keySet()) { - each.updateProgress(); - } + Set indicators = getCurrentInlineIndicators(); + if (indicators.isEmpty()) return; + + for (InlineProgressIndicator each : indicators) { + each.updateProgress(); } + myQueryAlarm.cancelAllRequests(); myQueryAlarm.addRequest(new Runnable() { @Override public void run() { @@ -647,4 +646,10 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge } }, 2000); } + + private Set getCurrentInlineIndicators() { + synchronized (myOriginals) { + return myInline2Original.keySet(); + } + } }