diff options
Diffstat (limited to 'tests/org.eclipse.etrice.core.etmap.tests/src-gen/org/eclipse/etrice/core/etmap/ETMapInjectorProvider.java')
-rw-r--r-- | tests/org.eclipse.etrice.core.etmap.tests/src-gen/org/eclipse/etrice/core/etmap/ETMapInjectorProvider.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/org.eclipse.etrice.core.etmap.tests/src-gen/org/eclipse/etrice/core/etmap/ETMapInjectorProvider.java b/tests/org.eclipse.etrice.core.etmap.tests/src-gen/org/eclipse/etrice/core/etmap/ETMapInjectorProvider.java new file mode 100644 index 000000000..516bdc63f --- /dev/null +++ b/tests/org.eclipse.etrice.core.etmap.tests/src-gen/org/eclipse/etrice/core/etmap/ETMapInjectorProvider.java @@ -0,0 +1,45 @@ +/* +* generated by Xtext +*/ +package org.eclipse.etrice.core.etmap; + +import org.eclipse.xtext.junit4.GlobalRegistries; +import org.eclipse.xtext.junit4.GlobalRegistries.GlobalStateMemento; +import org.eclipse.xtext.junit4.IInjectorProvider; +import org.eclipse.xtext.junit4.IRegistryConfigurator; + +import com.google.inject.Injector; + +public class ETMapInjectorProvider implements IInjectorProvider, IRegistryConfigurator { + + protected GlobalStateMemento stateBeforeInjectorCreation; + protected GlobalStateMemento stateAfterInjectorCreation; + protected Injector injector; + + static { + GlobalRegistries.initializeDefaults(); + } + + public Injector getInjector() + { + if (injector == null) { + stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); + this.injector = internalCreateInjector(); + stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); + } + return injector; + } + + protected Injector internalCreateInjector() { + return new ETMapStandaloneSetup().createInjectorAndDoEMFRegistration(); + } + + public void restoreRegistry() { + stateBeforeInjectorCreation.restoreGlobalState(); + } + + public void setupRegistry() { + getInjector(); + stateAfterInjectorCreation.restoreGlobalState(); + } +} |