]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/Activator.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.osgi / src / org / simantics / scl / osgi / internal / Activator.java
diff --git a/bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/Activator.java b/bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/Activator.java
new file mode 100755 (executable)
index 0000000..ea11301
--- /dev/null
@@ -0,0 +1,32 @@
+package org.simantics.scl.osgi.internal;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.simantics.scl.compiler.source.repository.ModuleSourceRepository;
+import org.simantics.scl.compiler.source.repository.SourceRepositories;
+
+public class Activator implements BundleActivator {
+
+    private static BundleContext context;
+
+    public static BundleContext getContext() {
+        return context;
+    }
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public void start(BundleContext bundleContext) throws Exception {
+        Activator.context = bundleContext;
+
+        Hashtable properties = new Hashtable();
+        bundleContext.registerService(ModuleSourceRepository.class,
+                SourceRepositories.BUILTIN_SOURCE_REPOSITORY,
+                properties);
+    }
+
+    public void stop(BundleContext bundleContext) throws Exception {
+        Activator.context = null;
+    }
+
+}