All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.contextmapper.dsl.ContextMappingDSLStandaloneSetupGenerated Maven / Gradle / Ivy

/*
 * generated by Xtext 2.20.0
 */
package org.contextmapper.dsl;

import com.google.inject.Guice;
import com.google.inject.Injector;
import org.contextmapper.dsl.contextMappingDSL.ContextMappingDSLPackage;
import org.contextmapper.tactic.dsl.TacticDDDLanguageStandaloneSetup;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.ISetup;
import org.eclipse.xtext.resource.IResourceFactory;
import org.eclipse.xtext.resource.IResourceServiceProvider;

@SuppressWarnings("all")
public class ContextMappingDSLStandaloneSetupGenerated implements ISetup {

	@Override
	public Injector createInjectorAndDoEMFRegistration() {
		TacticDDDLanguageStandaloneSetup.doSetup();

		Injector injector = createInjector();
		register(injector);
		return injector;
	}
	
	public Injector createInjector() {
		return Guice.createInjector(new ContextMappingDSLRuntimeModule());
	}
	
	public void register(Injector injector) {
		if (!EPackage.Registry.INSTANCE.containsKey("http://www.contextmapper.org/dsl/ContextMappingDSL")) {
			EPackage.Registry.INSTANCE.put("http://www.contextmapper.org/dsl/ContextMappingDSL", ContextMappingDSLPackage.eINSTANCE);
		}
		IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
		IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);
		
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("cml", resourceFactory);
		IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("cml", serviceProvider);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy