use of org.eclipse.xtext.linking.ILinker in project xtext-core by eclipse.
the class Xtext2EcoreTransformerTest method doGetResource.
@Override
public XtextResource doGetResource(final InputStream in, final URI uri) throws Exception {
XtextResourceSet rs = this.<XtextResourceSet>get(XtextResourceSet.class);
rs.setClasspathURIContext(this.getClass());
Resource _createResource = this.getResourceFactory().createResource(uri);
final XtextResource resource = ((XtextResource) _createResource);
rs.getResources().add(resource);
XtextLinker linker = new XtextLinker() {
@Override
protected Xtext2EcoreTransformer createTransformer(final Grammar grammar, final IDiagnosticConsumer consumer) {
Xtext2EcoreTransformer result = super.createTransformer(grammar, consumer);
ErrorAcceptor _errorAcceptor = result.getErrorAcceptor();
Xtext2EcoreTransformerTest.MyErrorAcceptor _myErrorAcceptor = new Xtext2EcoreTransformerTest.MyErrorAcceptor(_errorAcceptor, Xtext2EcoreTransformerTest.this.errorAcceptorMock);
result.setErrorAcceptor(_myErrorAcceptor);
return result;
}
};
ILinker _linker = resource.getLinker();
linker.setScopeProvider(((XtextLinker) _linker).getScopeProvider());
ILinker _linker_1 = resource.getLinker();
linker.setLinkingService(((Linker) _linker_1).getLinkingService());
ILinker _linker_2 = resource.getLinker();
linker.setLinkingHelper(((Linker) _linker_2).getLinkingHelper());
XtextLinker.PackageRemover _packageRemover = new XtextLinker.PackageRemover();
linker.setPackageRemover(_packageRemover);
LinkingDiagnosticMessageProvider _linkingDiagnosticMessageProvider = new LinkingDiagnosticMessageProvider();
linker.setDiagnosticMessageProvider(_linkingDiagnosticMessageProvider);
OnChangeEvictingCache _onChangeEvictingCache = new OnChangeEvictingCache();
linker.setCache(_onChangeEvictingCache);
resource.setLinker(linker);
resource.load(in, null);
return resource;
}
Aggregations