Source:
public IStatus run(IProgressMonitor monitor) { Set<Repository> repos; synchronized (repositoriesChanged) { if (repositoriesChanged.isEmpty()) { return Status.OK_STATUS; } repos = new LinkedHashSet<>(repositoriesChanged); repositoriesChanged.clear(); } IWorkspace workspace = ResourcesPlugin.getWorkspace(); IProject[] projects = workspace.getRoot().getProjects(); final Set<IProject> toRefresh = new LinkedHashSet<>(); for (IProject p : projects) { if (!p.isAccessible()) { continue; } RepositoryMapping mapping = RepositoryMapping.getMapping(p); if (mapping != null && repos.contains(mapping.getRepository())) { toRefresh.add(p); } } if (toRefresh.isEmpty()) { return Status.OK_STATUS; } try { workspace.run(new IWorkspaceRunnable() { @Override public void run(IProgressMonitor m) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(m, UIText.Activator_refreshingProjects, toRefresh.size()); for (IProject p : toRefresh) { if (m.isCanceled()) { return; } ISchedulingRule rule = p.getWorkspace().getRuleFactory().refreshRule(p); try { getJobManager().beginRule(rule, m); if (p.isAccessible()) { p.refreshLocal(IResource.DEPTH_INFINITE, subMonitor); } } catch (CoreException e) { handleError(UIText.Activator_refreshFailed, e, false); } finally { getJobManager().endRule(rule); } } } }, workspace.getRuleFactory().refreshRule(workspace.getRoot()), IWorkspace.AVOID_UPDATE, monitor); } catch (CoreException e) { handleError(UIText.Activator_refreshFailed, e, false); return new Status(IStatus.ERROR, getPluginId(), e.getMessage()); } if (!monitor.isCanceled()) { synchronized (repositoriesChanged) { if (!repositoriesChanged.isEmpty()) { schedule(100); } } } monitor.done(); return Status.OK_STATUS; }

Target:
public IStatus run(IProgressMonitor monitor) { Set<Repository> repos; synchronized (repositoriesChanged) { if (repositoriesChanged.isEmpty()) { return Status.OK_STATUS; } repos = new LinkedHashSet<>(repositoriesChanged); repositoriesChanged.clear(); } IWorkspace workspace = ResourcesPlugin.getWorkspace(); IProject[] projects = workspace.getRoot().getProjects(); final Set<IProject> toRefresh = new LinkedHashSet<>(); for (IProject p : projects) { if (!p.isAccessible()) { continue; } RepositoryMapping mapping = RepositoryMapping.getMapping(p); if (mapping != null && repos.contains(mapping.getRepository())) { toRefresh.add(p); } } if (toRefresh.isEmpty()) { return Status.OK_STATUS; } try { workspace.run(new IWorkspaceRunnable() { @Override public void run(IProgressMonitor m) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(m, UIText.Activator_refreshingProjects, toRefresh.size()); for (IProject p : toRefresh) { if (m.isCanceled()) { return; } ISchedulingRule rule = p.getWorkspace().getRuleFactory().refreshRule(p); try { getJobManager().beginRule(rule, m); if (p.isAccessible()) { p.refreshLocal(IResource.DEPTH_INFINITE, subMonitor.newChild(1)); } } catch (CoreException e) { handleError(UIText.Activator_refreshFailed, e, false); } finally { getJobManager().endRule(rule); } } } }, workspace.getRuleFactory().refreshRule(workspace.getRoot()), IWorkspace.AVOID_UPDATE, monitor); } catch (CoreException e) { handleError(UIText.Activator_refreshFailed, e, false); return new Status(IStatus.ERROR, getPluginId(), e.getMessage()); } if (!monitor.isCanceled()) { synchronized (repositoriesChanged) { if (!repositoriesChanged.isEmpty()) { schedule(100); } } } monitor.done(); return Status.OK_STATUS; }