use of org.eclipse.xtext.ide.serializer.impl.RelatedResourcesProvider.RelatedResource in project xtext-core by eclipse.
the class ResourceLifecycleManager method openAndApplyReferences.
public Resource openAndApplyReferences(ResourceSet resourceSet, RelatedResource toLoad) {
Resource resource = resourceSet.getResource(toLoad.getUri(), true);
for (IReferenceSnapshot desc : toLoad.outgoingReferences) {
EObject source = resource.getEObject(desc.getSourceEObjectUri().fragment());
EObject target = desc.getTarget().getObject();
EReference reference = desc.getEReference();
if (reference.isMany()) {
@SuppressWarnings("unchecked") List<Object> list = (EList<Object>) source.eGet(reference, false);
list.set(desc.getIndexInList(), target);
} else {
source.eSet(reference, target);
}
}
return resource;
}
use of org.eclipse.xtext.ide.serializer.impl.RelatedResourcesProvider.RelatedResource in project xtext-core by eclipse.
the class ChangeSerializer method endRecordChanges.
protected void endRecordChanges(IAcceptor<IEmfResourceChange> changeAcceptor) {
if (updaters.isEmpty()) {
return;
}
List<IResourceSnapshot> snapshots = getSnapshots();
Deltas deltas = deltaProvider.getDelta(this, snapshots);
List<ResourceUpdater> updaters = Lists.newArrayList(this.updaters.values());
if (updateRelatedFiles && updateCrossReferences) {
List<RelatedResource> related = relatedResourcesProvider.getRelatedResources(deltas.getSnapshots());
for (RelatedResource ref : related) {
RelatedResourceUpdater updater = createResourceUpdater(ref);
updaters.add(updater);
}
}
monitor.beginTask("Creating Text Changes...", updaters.size());
for (ResourceUpdater updater : updaters) {
updater.applyChange(deltas, changeAcceptor);
monitor.worked(1);
checkCanceled();
}
for (ResourceUpdater updater : updaters) {
updater.unload();
}
}
Aggregations