01: package org.openwfe.gpe;
02:
03: import org.eclipse.core.runtime.IPluginDescriptor;
04: import org.osgi.framework.BundleContext;
05: import org.eclipse.ui.plugin.*;
06: import java.util.*;
07:
08: /**
09: * Plugin class used by the graphical editor.
10: * This is the main class which is started when the editor is started
11: */
12: public class FlowPlugin extends AbstractUIPlugin {
13:
14: /**
15: * Creates a new FlowPlugin with the given descriptor
16: * @param descriptor the descriptor*/
17:
18: private static FlowPlugin singleton;
19: private ResourceBundle resourceBundle;
20:
21: public FlowPlugin(IPluginDescriptor desc) {
22: super (desc);
23: if (singleton == null) {
24: singleton = this ;
25: }
26: try {
27: resourceBundle = ResourceBundle
28: .getBundle("org.openwfe.gpe.FlowPluginResources");
29: } catch (MissingResourceException x) {
30: resourceBundle = null;
31: }
32: }
33:
34: public void start(BundleContext context) throws Exception {
35: super .start(context);
36: }
37:
38: /**
39: * This method is called when the plug-in is stopped
40: */
41: public void stop(BundleContext context) throws Exception {
42: super .stop(context);
43: }
44:
45: /**
46: * Returns the string from the plugin's resource bundle,
47: * or 'key' if not found.
48: */
49: public static String getResourceString(String key) {
50: ResourceBundle bundle = FlowPlugin.getDefault()
51: .getResourceBundle();
52: try {
53: return (bundle != null) ? bundle.getString(key) : key;
54: } catch (MissingResourceException e) {
55: return key;
56: }
57: }
58:
59: /**
60: * Returns the plugin's resource bundle,
61: */
62: public ResourceBundle getResourceBundle() {
63: return resourceBundle;
64: }
65:
66: public static FlowPlugin getDefault() {
67: return singleton;
68: }
69:
70: }
|