View Javadoc

1   package de.matthias_burbach.mosaique4eclipse;
2   
3   import org.eclipse.jface.resource.ImageDescriptor;
4   import org.eclipse.ui.plugin.AbstractUIPlugin;
5   import org.osgi.framework.BundleContext;
6   
7   /***
8    * The main plugin class to be used in the desktop.
9    */
10  public class MosaiquePlugin extends AbstractUIPlugin {
11      /***
12       * The shared instance.
13       */
14      private static MosaiquePlugin plugin;
15  
16      /***
17       * The constructor.
18       */
19      public MosaiquePlugin() {
20          plugin = this;
21      }
22  
23      /*
24       * (non-Javadoc)
25       * @see org.osgi.framework.BundleActivator#start(
26       *          org.osgi.framework.BundleContext)
27       */
28      /***
29       * {@inheritDoc}
30       * This method is called upon plug-in activation.
31       */
32      public void start(final BundleContext context) throws Exception {
33          super.start(context);
34      }
35  
36      /*
37       * (non-Javadoc)
38       * @see org.osgi.framework.BundleActivator#stop(
39       *          org.osgi.framework.BundleContext)
40       */
41      /***
42       * {@inheritDoc}
43       * This method is called when the plug-in is stopped.
44       */
45      public void stop(final BundleContext context) throws Exception {
46          super.stop(context);
47          plugin = null;
48      }
49  
50      /***
51       * @return The shared instance.
52       */
53      public static MosaiquePlugin getDefault() {
54          return plugin;
55      }
56  
57      /***
58       * Returns an image descriptor for the image file at the given
59       * plug-in relative path.
60       *
61       * @param path the path
62       * @return the image descriptor
63       */
64      public static ImageDescriptor getImageDescriptor(final String path) {
65          return AbstractUIPlugin.imageDescriptorFromPlugin(
66                  "de.matthias_burbach.mosaique4eclipse", path);
67      }
68  }