source: default/trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src-gen/de/ugoe/cs/swe/bnftools/ui/internal/EbnfActivator.java @ 5

Last change on this file since 5 was 5, checked in by zeiss, 14 years ago
  • Property svn:mime-type set to text/plain
File size: 1.8 KB
Line 
1
2/*
3 * generated by Xtext
4 */
5package de.ugoe.cs.swe.bnftools.ui.internal;
6
7import org.apache.log4j.Logger;
8
9import org.eclipse.ui.plugin.AbstractUIPlugin;
10import org.osgi.framework.BundleContext;
11
12import com.google.inject.Guice;
13import com.google.inject.Injector;
14import com.google.inject.Module;
15import com.google.inject.util.Modules;
16
17import java.util.Map;
18import java.util.HashMap;
19
20/**
21 * Generated
22 */
23public class EbnfActivator extends AbstractUIPlugin {
24
25        private Map<String,Injector> injectors = new HashMap<String,Injector>();
26        private static EbnfActivator INSTANCE;
27
28        public Injector getInjector(String languageName) {
29                return injectors.get(languageName);
30        }
31       
32        @Override
33        public void start(BundleContext context) throws Exception {
34                super.start(context);
35                INSTANCE = this;
36                try {
37                       
38                        injectors.put("de.ugoe.cs.swe.bnftools.Ebnf", Guice.createInjector(
39                                Modules.override(Modules.override(getRuntimeModule("de.ugoe.cs.swe.bnftools.Ebnf")).with(getUiModule("de.ugoe.cs.swe.bnftools.Ebnf"))).with(getSharedStateModule())
40                        ));
41                       
42                } catch (Exception e) {
43                        Logger.getLogger(getClass()).error(e.getMessage(), e);
44                        throw e;
45                }
46        }
47       
48        public static EbnfActivator getInstance() {
49                return INSTANCE;
50        }
51       
52        protected Module getRuntimeModule(String grammar) {
53               
54                if ("de.ugoe.cs.swe.bnftools.Ebnf".equals(grammar)) {
55                  return new de.ugoe.cs.swe.bnftools.EbnfRuntimeModule();
56                }
57               
58                throw new IllegalArgumentException(grammar);
59        }
60        protected Module getUiModule(String grammar) {
61               
62                if ("de.ugoe.cs.swe.bnftools.Ebnf".equals(grammar)) {
63                  return new de.ugoe.cs.swe.bnftools.ui.EbnfUiModule(this);
64                }
65               
66                throw new IllegalArgumentException(grammar);
67        }
68       
69        protected Module getSharedStateModule() {
70                return new org.eclipse.xtext.ui.shared.SharedStateModule();
71        }
72       
73}
Note: See TracBrowser for help on using the repository browser.