IDEA-136333 (warning severity increased; background check postponed)
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Thu, 12 Feb 2015 15:24:53 +0000 (16:24 +0100)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Thu, 12 Feb 2015 15:24:53 +0000 (16:24 +0100)
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateCheckerComponent.java

index 162a2a499f10466218fa2a603ee2b77418d7d9ce..f4436da4a5ee6776ce0a10bee7810dfb22c40ab0 100644 (file)
@@ -60,17 +60,12 @@ public class UpdateCheckerComponent implements ApplicationComponent {
         public void run() {
           String title = IdeBundle.message("update.notifications.title");
           String message = IdeBundle.message("update.sni.disabled.notification");
-          UpdateChecker.NOTIFICATIONS.createNotification(title, message, NotificationType.WARNING, null).notify(null);
+          UpdateChecker.NOTIFICATIONS.createNotification(title, message, NotificationType.ERROR, null).notify(null);
         }
       }, ModalityState.NON_MODAL);
     }
 
-    app.getMessageBus().connect(app).subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() {
-      @Override
-      public void appFrameCreated(String[] commandLineArgs, @NotNull Ref<Boolean> willOpenProject) {
-        scheduleOnStartCheck();
-      }
-    });
+    scheduleOnStartCheck(app);
   }
 
   @Override
@@ -78,20 +73,25 @@ public class UpdateCheckerComponent implements ApplicationComponent {
     PluginsAdvertiser.ensureDeleted();
   }
 
-  private void scheduleOnStartCheck() {
-    if (!mySettings.CHECK_NEEDED) {
+  private void scheduleOnStartCheck(@NotNull Application app) {
+    if (!mySettings.CHECK_NEEDED || mySettings.SECURE_CONNECTION && !NetUtils.isSniEnabled()) {
       return;
     }
 
-    String currentBuild = ApplicationInfo.getInstance().getBuild().asString();
-    long timeToNextCheck = mySettings.LAST_TIME_CHECKED + CHECK_INTERVAL - System.currentTimeMillis();
+    app.getMessageBus().connect(app).subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() {
+      @Override
+      public void appFrameCreated(String[] commandLineArgs, @NotNull Ref<Boolean> willOpenProject) {
+        String currentBuild = ApplicationInfo.getInstance().getBuild().asString();
+        long timeToNextCheck = mySettings.LAST_TIME_CHECKED + CHECK_INTERVAL - System.currentTimeMillis();
 
-    if (StringUtil.compareVersionNumbers(mySettings.LAST_BUILD_CHECKED, currentBuild) < 0 || timeToNextCheck <= 0) {
-      myCheckRunnable.run();
-    }
-    else {
-      queueNextCheck(timeToNextCheck);
-    }
+        if (StringUtil.compareVersionNumbers(mySettings.LAST_BUILD_CHECKED, currentBuild) < 0 || timeToNextCheck <= 0) {
+          myCheckRunnable.run();
+        }
+        else {
+          queueNextCheck(timeToNextCheck);
+        }
+      }
+    });
   }
 
   private void queueNextCheck(long interval) {