org.eclipse.xtext.linking.impl.Linker Java Examples
The following examples show how to use
org.eclipse.xtext.linking.impl.Linker.
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: FragmentsEagerLinkingInjectorProvider.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Override protected Injector internalCreateInjector() { return new FragmentTestLanguageStandaloneSetup() { @Override public Injector createInjector() { return Guice.createInjector(new FragmentTestLanguageRuntimeModule() { @Override public Class<? extends XtextResource> bindXtextResource() { return XtextResource.class; } @Override public Class<? extends ILinker> bindILinker() { return Linker.class; } }); } }.createInjectorAndDoEMFRegistration(); }
Example #2
Source File: Xtext2EcoreTransformerTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public XtextResource doGetResource(InputStream in, URI uri) throws Exception { XtextResourceSet rs = get(XtextResourceSet.class); Map<URI, URI> uriMap = rs.getURIConverter().getURIMap(); uriMap.put(URI.createPlatformPluginURI("org.eclipse.xtext/", false), URI.createURI("classpath:/")); uriMap.put(URI.createPlatformPluginURI("org.eclipse.xtext.xbase/", false), URI.createURI("classpath:/")); uriMap.put(URI.createPlatformPluginURI("org.eclipse.xtext.common.types/", false), URI.createURI("classpath:/")); uriMap.put(URI.createPlatformPluginURI("org.eclipse.emf.ecore/", false), URI.createURI("classpath:/")); uriMap.put(URI.createPlatformResourceURI("org.eclipse.xtext.xbase/", false), URI.createURI("classpath:/")); uriMap.put(URI.createPlatformResourceURI("org.eclipse.emf.ecore/", false), URI.createURI("classpath:/")); uriMap.put(URI.createPlatformResourceURI("org.eclipse.xtext.common.types/", false), URI.createURI("classpath:/")); rs.setClasspathURIContext(getClass()); XtextResource resource = ((XtextResource) getResourceFactory().createResource(uri)); rs.getResources().add(resource); XtextLinker linker = new XtextLinker() { @Override protected Xtext2EcoreTransformer createTransformer(Grammar grammar, IDiagnosticConsumer consumer) { Xtext2EcoreTransformer result = super.createTransformer(grammar, consumer); result.setErrorAcceptor(new Xtext2EcoreTransformerTest.MyErrorAcceptor(result.getErrorAcceptor(), Xtext2EcoreTransformerTest.this.errorAcceptorMock)); return result; } }; linker.setScopeProvider(((XtextLinker) resource.getLinker()).getScopeProvider()); linker.setLinkingService(((Linker) resource.getLinker()).getLinkingService()); linker.setLinkingHelper(((Linker) resource.getLinker()).getLinkingHelper()); linker.setPackageRemover(new XtextLinker.PackageRemover()); linker.setDiagnosticMessageProvider(new LinkingDiagnosticMessageProvider()); linker.setCache(new OnChangeEvictingCache()); resource.setLinker(linker); resource.load(in, null); return resource; }
Example #3
Source File: Bug287988WithEagerLinkingTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); factory = new ResourceFactoryImpl(){ @Override public Resource createResource(URI uri) { XtextResource resource = new XtextResource(); injectMembers(resource); resource.setLinker(get(Linker.class)); resource.setURI(uri); return resource; } }; Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("bug287988testlanguage", factory); }
Example #4
Source File: PartialLinkingTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
protected void replaceLinker(XtextResource resource) { Linker linker = new Linker(); DefaultLinkingService linkingService = new DefaultLinkingService(); getInjector().injectMembers(linkingService); linkingService.setScopeProvider(this); linker.setLinkingService(linkingService); linker.setDiagnosticMessageProvider(new LinkingDiagnosticMessageProvider()); linker.setLinkingHelper(getInjector().getInstance(LinkingHelper.class)); resource.setLinker(linker); }
Example #5
Source File: Xtext2EcoreTransformerTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@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; }
Example #6
Source File: Bug313089TestLanguageRuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends ILinker> bindILinker() { return Linker.class; }
Example #7
Source File: SGenTestRuntimeModule.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override public Class<? extends ILinker> bindILinker() { return Linker.class; }