org.eclipse.xtext.resource.impl.ChangedResourceDescriptionDelta Java Examples

The following examples show how to use org.eclipse.xtext.resource.impl.ChangedResourceDescriptionDelta. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValidationJobScheduler.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
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;
			}
		}
	}
}
 
Example #2
Source File: JdtToBeBuiltComputer.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
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);
}
 
Example #3
Source File: StateBasedContainerTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Test public void testBug352214() {
	container.getResourceDescriptions(); // initialize uri map
	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));
}
 
Example #4
Source File: DirtyStateEditorSupport.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected ChangedResourceDescriptionDelta createDelta(IResourceDescription.Delta delta,
		IResourceDescription.Delta prev) {
	return new ChangedResourceDescriptionDelta(prev.getOld(), delta.getNew());
}
 
Example #5
Source File: DirtyStateAwareResourceDescriptions.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected IResourceDescription.Delta createDelta(IResourceDescription old, IResourceDescription _new) {
	return new ChangedResourceDescriptionDelta(old, _new);
}
 
Example #6
Source File: DeltaConverter.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.5
 */
protected Delta createContentChangeDelta(IResourceDescription oldDescription, IResourceDescription newDescription) {
	return new ChangedResourceDescriptionDelta(oldDescription, newDescription);
}
 
Example #7
Source File: DeltaConverter.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.5
 */
protected IResourceDescription.Delta createStructureChangeDelta(IType type, IResourceDescription oldDescription,
		IResourceDescription newDescription) {
	return new ChangedResourceDescriptionDelta(oldDescription, newDescription);
}