![JAR search and dependency download from the Maven repository](/logo.png)
com.reprezen.genflow.test.common.RapidMLInjectorProvider Maven / Gradle / Ivy
/*
* generated by Xtext 2.9.2
*/
package com.reprezen.genflow.test.common;
import org.eclipse.xtext.testing.GlobalRegistries;
import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento;
import org.eclipse.xtext.testing.IInjectorProvider;
import org.eclipse.xtext.testing.IRegistryConfigurator;
import com.google.inject.Injector;
import com.reprezen.rapidml.xtext.XtextDslStandaloneSetup;
public class RapidMLInjectorProvider implements IInjectorProvider, IRegistryConfigurator {
protected GlobalStateMemento stateBeforeInjectorCreation;
protected GlobalStateMemento stateAfterInjectorCreation;
protected Injector injector;
static {
GlobalRegistries.initializeDefaults();
}
@Override
public Injector getInjector() {
if (injector == null) {
stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
this.injector = internalCreateInjector();
stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
}
return injector;
}
protected Injector internalCreateInjector() {
return new XtextDslStandaloneSetup().createInjectorAndDoEMFRegistration();
}
@Override
public void restoreRegistry() {
stateBeforeInjectorCreation.restoreGlobalState();
}
@Override
public void setupRegistry() {
getInjector();
stateAfterInjectorCreation.restoreGlobalState();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy