Exemplo n.º 1
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);
 }
Exemplo n.º 2
0
 /** The constructor. */
 public AutomaticUpdateScheduler() {
   AutomaticUpdatePlugin.getDefault().setScheduler(this);
   IProvisioningAgent agent =
       (IProvisioningAgent)
           ServiceHelper.getService(
               AutomaticUpdatePlugin.getContext(), IProvisioningAgent.SERVICE_NAME);
   checker = (IUpdateChecker) agent.getService(IUpdateChecker.SERVICE_NAME);
   if (checker == null) {
     // Something did not initialize properly
     IStatus status =
         new Status(
             IStatus.ERROR,
             AutomaticUpdatePlugin.PLUGIN_ID,
             AutomaticUpdateMessages.AutomaticUpdateScheduler_UpdateNotInitialized);
     StatusManager.getManager().handle(status, StatusManager.LOG);
     return;
   }
   profileId = IProfileRegistry.SELF;
 }
Exemplo n.º 3
0
 public void rescheduleUpdate() {
   removeUpdateListener();
   IPreferenceStore pref = AutomaticUpdatePlugin.getDefault().getPreferenceStore();
   String schedule = pref.getString(PreferenceConstants.PREF_AUTO_UPDATE_SCHEDULE);
   // See if we have a scheduled check or startup only.  If it is
   // startup only, there is nothing more to do now, a listener will
   // be created on the next startup.
   if (schedule.equals(PreferenceConstants.PREF_UPDATE_ON_STARTUP)) {
     return;
   }
   scheduleUpdate();
 }