Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/src-gen/org/eclipse/papyrus/infra/gmfdiag/css3/ui/internal/CSSActivator.java')
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/src-gen/org/eclipse/papyrus/infra/gmfdiag/css3/ui/internal/CSSActivator.java95
1 files changed, 95 insertions, 0 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/src-gen/org/eclipse/papyrus/infra/gmfdiag/css3/ui/internal/CSSActivator.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/src-gen/org/eclipse/papyrus/infra/gmfdiag/css3/ui/internal/CSSActivator.java
new file mode 100644
index 00000000000..14430d49219
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css3.xtext.ui/src-gen/org/eclipse/papyrus/infra/gmfdiag/css3/ui/internal/CSSActivator.java
@@ -0,0 +1,95 @@
+/*
+ * generated by Xtext
+ */
+package org.eclipse.papyrus.infra.gmfdiag.css3.ui.internal;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.xtext.ui.shared.SharedStateModule;
+import org.eclipse.xtext.util.Modules2;
+import org.osgi.framework.BundleContext;
+
+import com.google.common.collect.Maps;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
+/**
+ * This class was generated. Customizations should only happen in a newly
+ * introduced subclass.
+ */
+public class CSSActivator extends AbstractUIPlugin {
+
+ public static final String ORG_ECLIPSE_PAPYRUS_INFRA_GMFDIAG_CSS3_CSS = "org.eclipse.papyrus.infra.gmfdiag.css3.CSS";
+
+ private static final Logger logger = Logger.getLogger(CSSActivator.class);
+
+ private static CSSActivator INSTANCE;
+
+ private Map<String, Injector> injectors = Collections.synchronizedMap(Maps.<String, Injector> newHashMapWithExpectedSize(1));
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ INSTANCE = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ injectors.clear();
+ INSTANCE = null;
+ super.stop(context);
+ }
+
+ public static CSSActivator getInstance() {
+ return INSTANCE;
+ }
+
+ public Injector getInjector(String language) {
+ synchronized (injectors) {
+ Injector injector = injectors.get(language);
+ if (injector == null) {
+ injectors.put(language, injector = createInjector(language));
+ }
+ return injector;
+ }
+ }
+
+ protected Injector createInjector(String language) {
+ try {
+ Module runtimeModule = getRuntimeModule(language);
+ Module sharedStateModule = getSharedStateModule();
+ Module uiModule = getUiModule(language);
+ Module mergedModule = Modules2.mixin(runtimeModule, sharedStateModule, uiModule);
+ return Guice.createInjector(mergedModule);
+ } catch (Exception e) {
+ logger.error("Failed to create injector for " + language);
+ logger.error(e.getMessage(), e);
+ throw new RuntimeException("Failed to create injector for " + language, e);
+ }
+ }
+
+ protected Module getRuntimeModule(String grammar) {
+ if (ORG_ECLIPSE_PAPYRUS_INFRA_GMFDIAG_CSS3_CSS.equals(grammar)) {
+ return new org.eclipse.papyrus.infra.gmfdiag.css3.CSSRuntimeModule();
+ }
+
+ throw new IllegalArgumentException(grammar);
+ }
+
+ protected Module getUiModule(String grammar) {
+ if (ORG_ECLIPSE_PAPYRUS_INFRA_GMFDIAG_CSS3_CSS.equals(grammar)) {
+ return new org.eclipse.papyrus.infra.gmfdiag.css3.ui.CSSUiModule(this);
+ }
+
+ throw new IllegalArgumentException(grammar);
+ }
+
+ protected Module getSharedStateModule() {
+ return new SharedStateModule();
+ }
+
+}

Back to the top