1 package org.simantics.diagram.profile.view;
\r
5 import org.eclipse.ui.plugin.AbstractUIPlugin;
\r
6 import org.osgi.framework.BundleContext;
\r
7 import org.osgi.util.tracker.ServiceTracker;
\r
9 public class Activator extends AbstractUIPlugin {
\r
12 public static final String PLUGIN_ID = "org.simantics.diagram.profile";
\r
14 // The shared instance
\r
15 private static Activator plugin;
\r
17 private BundleContext bundleContext;
\r
19 private ServiceTracker<?, ?> logTracker;
\r
24 public Activator() {
\r
28 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
\r
31 public void start(BundleContext context) throws Exception {
\r
32 super.start(context);
\r
33 this.bundleContext = context;
\r
38 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
\r
41 public void stop(BundleContext context) throws Exception {
\r
42 if (logTracker != null) {
\r
47 this.bundleContext = null;
\r
49 super.stop(context);
\r
53 * Returns the shared instance
\r
55 * @return the shared instance
\r
57 public static Activator getDefault() {
\r
61 public BundleContext getContext() {
\r
62 return bundleContext;
\r
65 public static URL getDefaultResource(String name) {
\r
66 Activator plugin = getDefault();
\r
67 if(plugin == null) throw new IllegalStateException("The plugin is not active.");
\r
68 return plugin.getBundle().getResource(name);
\r