had to rename the packages to make them compliant with buckminster
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / internal / TaxeditorNavigationPlugin.java
1 package eu.etaxonomy.taxeditor.navigation.internal;
2
3 import org.eclipse.jface.resource.ImageDescriptor;
4 import org.eclipse.ui.plugin.AbstractUIPlugin;
5 import org.osgi.framework.BundleContext;
6
7 import eu.etaxonomy.taxeditor.navigation.NavigatorStateManager;
8 import eu.etaxonomy.taxeditor.store.CdmStore;
9
10 /**
11 * The activator class controls the plug-in life cycle
12 *
13 * @author n.hoffmann
14 * @version $Id: $
15 */
16 public class TaxeditorNavigationPlugin extends AbstractUIPlugin {
17
18 // The plug-in ID
19 /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.navigator"</code> */
20 public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.navigator";
21
22 // The shared instance
23 private static TaxeditorNavigationPlugin plugin;
24
25 /**
26 * The constructor
27 */
28 public TaxeditorNavigationPlugin() {
29 }
30
31 /*
32 * (non-Javadoc)
33 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
34 */
35 /** {@inheritDoc} */
36 public void start(BundleContext context) throws Exception {
37 super.start(context);
38
39 NavigatorStateManager stateManager = new NavigatorStateManager();
40 CdmStore.getContextManager().addContextListener(stateManager);
41 plugin = this;
42 }
43
44 /*
45 * (non-Javadoc)
46 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
47 */
48 /** {@inheritDoc} */
49 public void stop(BundleContext context) throws Exception {
50 plugin = null;
51 super.stop(context);
52 }
53
54 /**
55 * Returns the shared instance
56 *
57 * @return the shared instance
58 */
59 public static TaxeditorNavigationPlugin getDefault() {
60 return plugin;
61 }
62
63 /**
64 * Returns an image descriptor for the image file at the given
65 * plug-in relative path
66 *
67 * @param path the path
68 * @return the image descriptor
69 */
70 public static ImageDescriptor getImageDescriptor(String path) {
71 return imageDescriptorFromPlugin(PLUGIN_ID, path);
72 }
73 }