Java Code Examples for org.eclipse.xtext.ISetup#createInjectorAndDoEMFRegistration()

The following examples show how to use org.eclipse.xtext.ISetup#createInjectorAndDoEMFRegistration() . 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: ResourceServiceProviderServiceLoader.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
private Registry loadRegistry() {
	ResourceServiceProviderRegistryImpl registry = new ResourceServiceProviderRegistryImpl();
	for (ISetup cp : setupLoader) {
		Injector injector = cp.createInjectorAndDoEMFRegistration();
		IResourceServiceProvider resourceServiceProvider = injector.getInstance(IResourceServiceProvider.class);
		FileExtensionProvider extensionProvider = injector.getInstance(FileExtensionProvider.class);
		String primaryFileExtension = extensionProvider.getPrimaryFileExtension();
		for (String ext : extensionProvider.getFileExtensions()) {
			if (registry.getExtensionToFactoryMap().containsKey(ext)) {
				if (primaryFileExtension.equals(ext))
					registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider);
			} else {
				registry.getExtensionToFactoryMap().put(ext, resourceServiceProvider);
			}
		}
	}
	return registry;
}
 
Example 2
Source File: GeneratorComponent.java    From xtext-core with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * registering an {@link ISetup}, which causes the execution of {@link ISetup#createInjectorAndDoEMFRegistration()}
 * the resulting {@link com.google.inject.Inject} is stored and used to obtain the used {@link IGenerator}. 
 */
public void setRegister(ISetup setup) {
	injector = setup.createInjectorAndDoEMFRegistration();
}