use of org.eclipse.xtext.resource.impl.ListBasedDiagnosticConsumer in project xtext-core by eclipse.
the class XtextResource method doLinking.
protected void doLinking() {
if (parseResult == null || parseResult.getRootASTElement() == null)
return;
final ListBasedDiagnosticConsumer consumer = new ListBasedDiagnosticConsumer();
linker.linkModel(parseResult.getRootASTElement(), consumer);
if (!validationDisabled) {
getErrors().addAll(consumer.getResult(Severity.ERROR));
getWarnings().addAll(consumer.getResult(Severity.WARNING));
}
}
use of org.eclipse.xtext.resource.impl.ListBasedDiagnosticConsumer in project xtext-core by eclipse.
the class LazyLinkerTest method testManyValuedResolveProxiesReference.
@Test
public void testManyValuedResolveProxiesReference() throws Exception {
final EObject foo = newEObject("Foo");
final List<EObject> bars = Lists.newArrayList(newEObject("Bar"), newEObject("Bar"));
final Iterator<EObject> barsIterator = bars.iterator();
final Resource resource = new ResourceImpl(URI.createURI("http://foo/bar.ecore")) {
@Override
public EObject getEObject(String uriFragment) {
return barsIterator.next();
}
};
resourceSet.getResources().add(resource);
resource.getContents().add(foo);
final EReference eReference = (EReference) foo.eClass().getEStructuralFeature("many");
assertFalse(eReference.isResolveProxies());
final INode leafNode = newCrossReferenceAssignmentNode(eReference.getName());
final INode leafNode2 = newCrossReferenceAssignmentNode(eReference.getName());
final ICompositeNode adapter = newSimpleNodeAdapter(leafNode, leafNode2);
foo.eAdapters().add((Adapter) adapter);
linker.linkModel(foo, new ListBasedDiagnosticConsumer());
assertEquals(bars, foo.eGet(eReference, false));
}
use of org.eclipse.xtext.resource.impl.ListBasedDiagnosticConsumer in project xtext-core by eclipse.
the class LazyLinkerTest method testSingleValuedResolveProxiesReference.
@Test
public void testSingleValuedResolveProxiesReference() throws Exception {
final EObject foo = newEObject("Foo");
final EObject bar = newEObject("Bar");
final Resource resource = new ResourceImpl(URI.createURI("http://foo/bar.ecore")) {
@Override
public EObject getEObject(String uriFragment) {
return bar;
}
};
resourceSet.getResources().add(resource);
resource.getContents().add(foo);
final EReference eReference = (EReference) foo.eClass().getEStructuralFeature("single");
assertFalse(eReference.isResolveProxies());
final INode leafNode = newCrossReferenceAssignmentNode(eReference.getName());
final ICompositeNode adapter = newSimpleNodeAdapter(leafNode);
foo.eAdapters().add((Adapter) adapter);
linker.linkModel(foo, new ListBasedDiagnosticConsumer());
assertEquals(bar, foo.eGet(eReference, false));
}
Aggregations