@Override public void resourceChanged(IResourceChangeEvent e) { IResourceDelta delta = e.getDelta(); try { if (delta != null && isInstalled) { delta.accept(this); } } catch (CoreException x) { log.warn("Error handling resourceChanged", x); } }
/* * Gathers all the projects that changed in the workspace and sends them * to the conversion method * * (non-Javadoc) * * @see * org.eclipse.core.resources.IResourceChangeListener#resourceChanged * (org.eclipse.core.resources.IResourceChangeEvent) */ public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); IResourceDelta[] affectedChildren = delta.getAffectedChildren(); IProject[] projects = new IProject[affectedChildren.length]; for (int i = 0; i < affectedChildren.length; i++) { projects[i] = affectedChildren[i].getResource().getProject(); } try { processProjects(projects); } catch (CoreException e) { Logger.logException(e); } }
/** * For any change to the encoding file or any resource with encoding set, just discard the cache * for the corresponding project. */ @Override public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); if (delta == null) return; IResourceDelta[] projectDeltas = delta.getAffectedChildren(); // process each project in the delta Map<IProject, Boolean> projectsToSave = new HashMap<>(); for (int i = 0; i < projectDeltas.length; i++) // nothing to do if a project has been added/removed/moved if (projectDeltas[i].getKind() == IResourceDelta.CHANGED && (projectDeltas[i].getFlags() & IResourceDelta.OPEN) == 0) processEntryChanges(projectDeltas[i], projectsToSave); job.addChanges(projectsToSave); }