Source:
private void createResourceChangeListener() { resourceChangeListener = new IResourceChangeListener() { private final Map<IProject, IPath> deletedProjects = new HashMap<>(); @Override public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); boolean projectPreDelete = false; if (event.getType() == IResourceChangeEvent.PRE_DELETE && event.getResource().getType() == IResource.PROJECT) { projectPreDelete = true; } if ((delta.getKind() == IResourceDelta.CHANGED && (delta.getFlags() & INTERESTING_CHANGES) == 0) || !projectPreDelete) { return; } Repository repository = getRepository(); if (repository == null) { ResourcesPlugin.getWorkspace() .removeResourceChangeListener(this); resourceChangeListener = null; return; } if (projectPreDelete) { IResource resource = event.getResource(); IPath projectPath = resource.getLocation(); if (projectPath != null) { IPath repoPath = ResourceUtil.getRepositoryRelativePath( projectPath, repository); if (repoPath != null) { deletedProjects.put((IProject) resource, projectPath); } } return; } GitResourceDeltaVisitor visitor = new GitResourceDeltaVisitor( repository, deletedProjects); try { delta.accept(visitor); } catch (CoreException e) { Activator.logError(e.getMessage(), e); return; } if (visitor.getGitIgnoreChanged()) { scheduleReloadJob("A .gitignore changed"); } else if (visitor.isProjectDeleted()) { scheduleReloadJob("A project was deleted"); } else if (indexDiffData == null) { scheduleReloadJob("Resource changed, no diff available"); } else { Collection<String> filesToUpdate = visitor .getFilesToUpdate(); Collection<IResource> resourcesToUpdate = visitor .getResourcesToUpdate(); if (!filesToUpdate.isEmpty()) { scheduleUpdateJob(filesToUpdate, resourcesToUpdate); } } } }; ResourcesPlugin.getWorkspace().addResourceChangeListener( resourceChangeListener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE); }

Target:
private void createResourceChangeListener() { resourceChangeListener = new IResourceChangeListener() { private final Map<IProject, IPath> deletedProjects = new HashMap<>(); @Override public void resourceChanged(IResourceChangeEvent event) { if (event.getDelta() != null) { SkipNotInterestingDeltaVisitor skipNotInterestingVisitor = new SkipNotInterestingDeltaVisitor(); try { event.getDelta().accept(skipNotInterestingVisitor); if (!skipNotInterestingVisitor .hasAtLeastOneInterestingDelta()) { return; } } catch (CoreException e) { Activator.logError(e.getMessage(), e); } } Repository repository = getRepository(); if (repository == null) { ResourcesPlugin.getWorkspace() .removeResourceChangeListener(this); resourceChangeListener = null; return; } if (event.getType() == IResourceChangeEvent.PRE_DELETE) { IResource resource = event.getResource(); if (resource.getType() == IResource.PROJECT) { IPath projectPath = resource.getLocation(); if (projectPath != null) { IPath repoPath = ResourceUtil .getRepositoryRelativePath(projectPath, repository); if (repoPath != null) { deletedProjects.put((IProject) resource, projectPath); } } } return; } GitResourceDeltaVisitor visitor = new GitResourceDeltaVisitor( repository, deletedProjects); try { event.getDelta().accept(visitor); } catch (CoreException e) { Activator.logError(e.getMessage(), e); return; } if (visitor.getGitIgnoreChanged()) { scheduleReloadJob("A .gitignore changed"); } else if (visitor.isProjectDeleted()) { scheduleReloadJob("A project was deleted"); } else if (indexDiffData == null) { scheduleReloadJob("Resource changed, no diff available"); } else { Collection<String> filesToUpdate = visitor .getFilesToUpdate(); Collection<IResource> resourcesToUpdate = visitor .getResourcesToUpdate(); if (!filesToUpdate.isEmpty()) { scheduleUpdateJob(filesToUpdate, resourcesToUpdate); } } } }; ResourcesPlugin.getWorkspace().addResourceChangeListener( resourceChangeListener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE); }