01: package net.refractions.udig.style;
02:
03: import java.net.URL;
04:
05: import org.eclipse.ui.plugin.AbstractUIPlugin;
06: import org.osgi.framework.BundleContext;
07:
08: public class StylePlugin extends AbstractUIPlugin {
09:
10: /** The id of the plug-in */
11: public static final String ID = "net.refractions.udig.style"; //$NON-NLS-1$
12:
13: /** Icons path (value "icons/") */
14: public final static String ICONS_PATH = "icons/";//$NON-NLS-1$
15:
16: /** The shared instance **/
17: private static StylePlugin plugin;
18:
19: /** Managed Images instance */
20: private Images images = new Images();
21:
22: /**
23: * The constructor.
24: */
25: public StylePlugin() {
26: super ();
27: plugin = this ;
28: }
29:
30: /**
31: * Set up shared images.
32: *
33: * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
34: * @param context
35: * @throws Exception
36: */
37: public void start(BundleContext context) throws Exception {
38: super .start(context);
39: final URL iconsUrl = context.getBundle().getEntry(ICONS_PATH);
40: images.initializeImages(iconsUrl, getImageRegistry());
41: }
42:
43: /**
44: * Returns the shared instance.
45: * @return StylePlugin singleton
46: */
47: public static StylePlugin getDefault() {
48: return plugin;
49: }
50:
51: /**
52: * Images instance for use with ImageConstants.
53: *
54: * @return Images for use with ImageConstants.
55: */
56: public Images getImages() {
57: return images;
58: }
59:
60: public void stop(BundleContext context) throws Exception {
61: super.stop(context);
62: }
63: }
|