IDEA-125494 taskbar icon constantly flashes for no reason
authorMaxim.Mossienko <Maxim.Mossienko@jetbrains.com>
Wed, 13 Aug 2014 16:20:42 +0000 (18:20 +0200)
committerMaxim.Mossienko <Maxim.Mossienko@jetbrains.com>
Wed, 13 Aug 2014 16:23:51 +0000 (18:23 +0200)
platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java

index a20df87718cc9e4ed9afc7d488376c0df5ce76e0..308edb2d81a601f62804d3040b1974e6fe3ba6fc 100644 (file)
@@ -392,7 +392,7 @@ public class DumbServiceImpl extends DumbService implements Disposable {
   }
 
   private class AppIconProgress extends ProgressIndicatorBase {
-    double lastFraction;
+    private double lastFraction;
 
     @Override
     public void setFraction(final double fraction) {
@@ -408,16 +408,18 @@ public class DumbServiceImpl extends DumbService implements Disposable {
 
     @Override
     public void finish(@NotNull TaskInfo task) {
-      UIUtil.invokeLaterIfNeeded(new Runnable() {
-        @Override
-        public void run() {
-          AppIcon appIcon = AppIcon.getInstance();
-          if (appIcon.hideProgress(myProject, "indexUpdate")) {
-            appIcon.requestAttention(myProject, false);
-            appIcon.setOkBadge(myProject, true);
+      if (lastFraction != 0) { // we should call setProgress at least once before
+        UIUtil.invokeLaterIfNeeded(new Runnable() {
+          @Override
+          public void run() {
+            AppIcon appIcon = AppIcon.getInstance();
+            if (appIcon.hideProgress(myProject, "indexUpdate")) {
+              appIcon.requestAttention(myProject, false);
+              appIcon.setOkBadge(myProject, true);
+            }
           }
-        }
-      });
+        });
+      }
     }
   }
 }