X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.reflection%2Fsrc%2Forg%2Fsimantics%2Fscl%2Freflection%2Finternal%2FActivator.java;fp=bundles%2Forg.simantics.scl.reflection%2Fsrc%2Forg%2Fsimantics%2Fscl%2Freflection%2Finternal%2FActivator.java;h=9836dfe191956eeb2b2671ab03ad8dfe26a2ba91;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/internal/Activator.java b/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/internal/Activator.java new file mode 100755 index 000000000..9836dfe19 --- /dev/null +++ b/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/internal/Activator.java @@ -0,0 +1,49 @@ +package org.simantics.scl.reflection.internal; + +import org.eclipse.core.runtime.ILog; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + + private BundleContext context; + + private static Activator instance; + + @Override + public void start(BundleContext context) throws Exception { + this.context = context; + instance = this; + } + + @Override + public void stop(BundleContext context) throws Exception { + instance = null; + this.context = null; + } + + public BundleContext getContext() { + return context; + } + + public static Activator getInstance() { + return instance; + } + + public static void logError(String description, Exception e) { + System.err.println(description); + if(e != null) + e.printStackTrace(); + Bundle bundle = getInstance().getContext().getBundle(); + ILog log = Platform.getLog(bundle); + log.log(new Status(Status.ERROR, bundle.getSymbolicName(), description, e)); + } + + public static void logError(String description) { + logError(description, null); + } + +}