/mdt-ocl-3.0.0/org.eclipse.ocl.examples.xtext.essentialocl.ui/src-gen/org/eclipse/ocl/examples/xtext/essentialocl/ui/internal/EssentialOCLActivator.java

# · Java · 73 lines · 48 code · 19 blank · 6 comment · 2 complexity · acbd3272f87547bd472e06ee85541f12 MD5 · raw file

  1. /*
  2. * generated by Xtext
  3. */
  4. package org.eclipse.ocl.examples.xtext.essentialocl.ui.internal;
  5. import org.apache.log4j.Logger;
  6. import org.eclipse.ui.plugin.AbstractUIPlugin;
  7. import org.osgi.framework.BundleContext;
  8. import com.google.inject.Guice;
  9. import com.google.inject.Injector;
  10. import com.google.inject.Module;
  11. import com.google.inject.util.Modules;
  12. import java.util.Map;
  13. import java.util.HashMap;
  14. /**
  15. * Generated
  16. */
  17. public class EssentialOCLActivator extends AbstractUIPlugin {
  18. private Map<String,Injector> injectors = new HashMap<String,Injector>();
  19. private static EssentialOCLActivator INSTANCE;
  20. public Injector getInjector(String languageName) {
  21. return injectors.get(languageName);
  22. }
  23. @Override
  24. public void start(BundleContext context) throws Exception {
  25. super.start(context);
  26. INSTANCE = this;
  27. try {
  28. injectors.put("org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCL", Guice.createInjector(
  29. Modules.override(Modules.override(getRuntimeModule("org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCL")).with(getUiModule("org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCL"))).with(getSharedStateModule())
  30. ));
  31. } catch (Exception e) {
  32. Logger.getLogger(getClass()).error(e.getMessage(), e);
  33. throw e;
  34. }
  35. }
  36. public static EssentialOCLActivator getInstance() {
  37. return INSTANCE;
  38. }
  39. protected Module getRuntimeModule(String grammar) {
  40. if ("org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCL".equals(grammar)) {
  41. return new org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCLRuntimeModule();
  42. }
  43. throw new IllegalArgumentException(grammar);
  44. }
  45. protected Module getUiModule(String grammar) {
  46. if ("org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCL".equals(grammar)) {
  47. return new org.eclipse.ocl.examples.xtext.essentialocl.ui.EssentialOCLUiModule(this);
  48. }
  49. throw new IllegalArgumentException(grammar);
  50. }
  51. protected Module getSharedStateModule() {
  52. return new org.eclipse.xtext.ui.shared.SharedStateModule();
  53. }
  54. }