use of org.eclipse.xtext.resource.impl.ChangedResourceDescriptionDelta in project xtext-core by eclipse.
the class StateBasedContainerTest method testBug352214.
@Override
@Test
public void testBug352214() {
// initialize uri map
container.getResourceDescriptions();
ResourceDescriptionChangeEvent event = new ResourceDescriptionChangeEvent(Collections.<IResourceDescription.Delta>singletonList(new ChangedResourceDescriptionDelta(resourceDescription, null)));
simulateEmpty = true;
container.descriptionsChanged(event);
assertEquals(0, container.getResourceDescriptionCount());
assertTrue(Iterables.all(container.getResourceDescriptions(), Predicates.notNull()));
assertFalse(container.hasResourceDescription(uri));
assertNull(container.getResourceDescription(uri));
}
use of org.eclipse.xtext.resource.impl.ChangedResourceDescriptionDelta in project xtext-eclipse by eclipse.
the class ValidationJobScheduler method doScheduleInitialValidation.
protected void doScheduleInitialValidation(XtextDocument document) {
URI uri = document.getResourceURI();
if (uri == null)
return;
IResourceDescription documentDescription = resourceDescriptions.getResourceDescription(uri);
if (documentDescription == null) {
// resource was just created - build is likely to be running in background
return;
}
if (dirtyStateManager instanceof IDirtyStateManagerExtension && builderStateProvider != null) {
IResourceDescriptions persistedDescriptions = builderStateProvider.get();
List<URI> dirtyResourceURIs = ((IDirtyStateManagerExtension) dirtyStateManager).getDirtyResourceURIs();
for (URI dirtyResourceURI : dirtyResourceURIs) {
IResourceDescription dirtyDescription = dirtyStateManager.getDirtyResourceDescription(dirtyResourceURI);
if (dirtyDescription != null) {
IResourceDescription persistedDescription = persistedDescriptions.getResourceDescription(dirtyResourceURI);
// Shortcut to make sure we don't waste time with more involving haveEObjectDescriptionChanged computation
ChangedResourceDescriptionDelta delta = new ChangedResourceDescriptionDelta(persistedDescription, dirtyDescription);
if (resourceDescriptionManager.isAffected(delta, documentDescription)) {
document.checkAndUpdateAnnotations();
return;
}
}
}
} else {
Set<URI> outgoingReferences = descriptionUtils.collectOutgoingReferences(documentDescription);
for (URI outgoing : outgoingReferences) {
if (isDirty(outgoing)) {
document.checkAndUpdateAnnotations();
return;
}
}
}
}
use of org.eclipse.xtext.resource.impl.ChangedResourceDescriptionDelta in project xtext-eclipse by eclipse.
the class JdtToBeBuiltComputer method queueJavaChange.
protected void queueJavaChange(String typeName) {
URI typeURI = URIHelperConstants.OBJECTS_URI.appendSegment(typeName);
QualifiedName qualifiedName = QualifiedName.create(Strings.split(typeName, '.'));
NameBasedEObjectDescription nameBasedEObjectDescription = new NameBasedEObjectDescription(qualifiedName);
TypeResourceDescription oldDescription = new TypeResourceDescription(typeURI, Collections.<IEObjectDescription>singletonList(nameBasedEObjectDescription));
Delta delta = new ChangedResourceDescriptionDelta(oldDescription, null);
queuedBuildData.queueChange(delta);
}
Aggregations