/* * Starts or stops auto-refresh depending on the auto-refresh preference. */ protected void manageAutoRefresh(boolean enabled) { // do nothing if we have already shutdown if (refreshJob == null) return; if (enabled) { refreshJob.start(); monitors.start(); } else { refreshJob.stop(); monitors.stop(); } }
/** Shuts down the refresh manager. This only happens when the resources plugin is going away. */ public void shutdown(IProgressMonitor monitor) { ResourcesPlugin.getPlugin().getPluginPreferences().removePropertyChangeListener(this); if (monitors != null) { monitors.stop(); monitors = null; } if (refreshJob != null) { refreshJob.stop(); refreshJob = null; } }
private void runRefreshJob(Collection<IPath> paths) { Job[] jobs = Job.getJobManager().find(ResourcesPlugin.FAMILY_MANUAL_REFRESH); RefreshJob refreshJob = null; if (jobs != null) { for (int index = 0; index < jobs.length; index++) { // We are only concerned about ExternalSourceArchiveManager.RefreshJob if (jobs[index] instanceof RefreshJob) { refreshJob = (RefreshJob) jobs[index]; refreshJob.addSourceArchivesToRefresh(paths); if (refreshJob.getState() == Job.NONE) { refreshJob.schedule(); } break; } } } if (refreshJob == null) { refreshJob = new RefreshJob(new Vector<>(paths)); refreshJob.schedule(); } }
/* (non-Javadoc) * @see org.eclipse.core.resources.refresh.IRefreshResult#refresh(org.eclipse.core.resources.IResource) */ public void refresh(IResource resource) { // do nothing if we have already shutdown if (refreshJob != null) refreshJob.refresh(resource); }