예제 #1
0
 private void removeUpdateListener() {
   // Remove the current listener if there is one
   if (listener != null && checker != null) {
     checker.removeUpdateCheck(listener);
     listener = null;
   }
 }
예제 #2
0
 private void scheduleUpdate() {
   // Nothing to do if we don't know what profile we are checking
   if (profileId == null) return;
   IPreferenceStore pref = AutomaticUpdatePlugin.getDefault().getPreferenceStore();
   // See if automatic search is enabled at all
   if (!pref.getBoolean(PreferenceConstants.PREF_AUTO_UPDATE_ENABLED)) return;
   String schedule = pref.getString(PreferenceConstants.PREF_AUTO_UPDATE_SCHEDULE);
   long delay = IUpdateChecker.ONE_TIME_CHECK;
   long poll = IUpdateChecker.ONE_TIME_CHECK;
   if (!schedule.equals(PreferenceConstants.PREF_UPDATE_ON_STARTUP)) {
     delay = computeDelay(pref);
     poll = computePoll(pref);
   }
   // We do not access the AutomaticUpdater directly when we register
   // the listener. This prevents the UI classes from being started up
   // too soon.
   // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=227582
   listener =
       new IUpdateListener() {
         public void updatesAvailable(UpdateEvent event) {
           AutomaticUpdatePlugin.getDefault().getAutomaticUpdater().updatesAvailable(event);
         }
       };
   checker.addUpdateCheck(profileId, getProfileQuery(), delay, poll, listener);
 }