use of org.eclipse.xtext.resource.impl.CoarseGrainedChangeEvent in project xtext-eclipse by eclipse.
the class ProjectClasspathChangeListener method elementChanged.
@Override
public void elementChanged(ElementChangedEvent event) {
if (workspace != null && workspace.isAutoBuilding()) {
try {
if (event.getDelta() != null) {
Set<IJavaProject> javaProjects = getJavaProjectsWithClasspathChange(event.getDelta());
if (!javaProjects.isEmpty()) {
Set<IProject> projects = FluentIterable.from(javaProjects).filter(Predicates.notNull()).transform(IJavaProject::getProject).toSet();
dirtyStateManager.notifyListeners(new CoarseGrainedChangeEvent());
Set<IProject> mutableProjects = Sets.newLinkedHashSet(projects);
for (IProject project : projects) {
mutableProjects.addAll(projectDependencyGraph.getDependentXtextProjects(project));
}
scheduleBuildIfNecessary(mutableProjects);
}
}
} catch (WrappedException e) {
log.error(e.getCause().getMessage(), e.getCause());
} catch (RuntimeException e) {
log.error(e.getMessage(), e);
}
}
}
use of org.eclipse.xtext.resource.impl.CoarseGrainedChangeEvent in project xtext-eclipse by eclipse.
the class DirtyStateAwareResourceDescriptions method dirtyDescriptionsChanged.
public void dirtyDescriptionsChanged(IResourceDescription.Event event) {
if (event instanceof CoarseGrainedChangeEvent) {
notifyListeners(event);
return;
}
ResourceDescriptionChangeEvent changeEvent = new ResourceDescriptionChangeEvent(Iterables.transform(event.getDeltas(), new Function<IResourceDescription.Delta, IResourceDescription.Delta>() {
@Override
public IResourceDescription.Delta apply(IResourceDescription.Delta from) {
IResourceDescription.Delta result = from;
if (from.getNew() == null) {
result = createDelta(from.getOld(), globalDescriptions.getResourceDescription(from.getUri()));
} else if (from.getOld() == null) {
result = createDelta(globalDescriptions.getResourceDescription(from.getUri()), from.getNew());
}
return result;
}
}));
notifyListeners(changeEvent);
}
Aggregations