--- /dev/null
+package org.simantics.scl.reflection.internal;\r
+\r
+import org.eclipse.core.runtime.ILog;\r
+import org.eclipse.core.runtime.Platform;\r
+import org.eclipse.core.runtime.Status;\r
+import org.osgi.framework.Bundle;\r
+import org.osgi.framework.BundleActivator;\r
+import org.osgi.framework.BundleContext;\r
+\r
+public class Activator implements BundleActivator {\r
+\r
+ private BundleContext context; \r
+ \r
+ private static Activator instance;\r
+ \r
+ @Override\r
+ public void start(BundleContext context) throws Exception {\r
+ this.context = context;\r
+ instance = this;\r
+ }\r
+\r
+ @Override\r
+ public void stop(BundleContext context) throws Exception {\r
+ instance = null;\r
+ this.context = null;\r
+ }\r
+ \r
+ public BundleContext getContext() {\r
+ return context;\r
+ }\r
+ \r
+ public static Activator getInstance() {\r
+ return instance;\r
+ }\r
+ \r
+ public static void logError(String description, Exception e) {\r
+ System.err.println(description);\r
+ if(e != null)\r
+ e.printStackTrace();\r
+ Bundle bundle = getInstance().getContext().getBundle();\r
+ ILog log = Platform.getLog(bundle);\r
+ log.log(new Status(Status.ERROR, bundle.getSymbolicName(), description, e));\r
+ }\r
+ \r
+ public static void logError(String description) {\r
+ logError(description, null);\r
+ }\r
+\r
+}\r