01: package org.eclipse.ui.tutorials.rcp.part2;
02:
03: import org.eclipse.ui.plugin.*;
04: import org.eclipse.jface.resource.ImageDescriptor;
05: import org.osgi.framework.BundleContext;
06:
07: /**
08: * The main plugin class to be used in the desktop.
09: */
10: public class Part2Plugin extends AbstractUIPlugin {
11:
12: //The shared instance.
13: private static Part2Plugin plugin;
14:
15: /**
16: * The constructor.
17: */
18: public Part2Plugin() {
19: plugin = this ;
20: }
21:
22: /**
23: * This method is called upon plug-in activation
24: */
25: public void start(BundleContext context) throws Exception {
26: super .start(context);
27: }
28:
29: /**
30: * This method is called when the plug-in is stopped
31: */
32: public void stop(BundleContext context) throws Exception {
33: super .stop(context);
34: plugin = null;
35: }
36:
37: /**
38: * Returns the shared instance.
39: */
40: public static Part2Plugin getDefault() {
41: return plugin;
42: }
43:
44: /**
45: * Returns an image descriptor for the image file at the given
46: * plug-in relative path.
47: *
48: * @param path the path
49: * @return the image descriptor
50: */
51: public static ImageDescriptor getImageDescriptor(String path) {
52: return AbstractUIPlugin.imageDescriptorFromPlugin(
53: "org.eclipse.ui.tutorials.rcp.part2", path);
54: }
55: }
|