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