01: package KelpEclipse;
02:
03: import org.eclipse.ui.plugin.*;
04: import org.eclipse.core.runtime.*;
05: import org.eclipse.core.resources.*;
06: import java.util.*;
07:
08: /**
09: * The main plugin class to be used in the desktop.
10: */
11: public class KelpEclipsePlugin extends AbstractUIPlugin {
12: //The shared instance.
13: private static KelpEclipsePlugin plugin;
14: //Resource bundle.
15: private ResourceBundle resourceBundle;
16:
17: /**
18: * The constructor.
19: */
20: public KelpEclipsePlugin(IPluginDescriptor descriptor) {
21: super (descriptor);
22: plugin = this ;
23: try {
24: resourceBundle = ResourceBundle
25: .getBundle("KelpEclipse.KelpEclipsePluginResources");
26: } catch (MissingResourceException x) {
27: resourceBundle = null;
28: }
29: }
30:
31: /**
32: * Returns the shared instance.
33: */
34: public static KelpEclipsePlugin getDefault() {
35: return plugin;
36: }
37:
38: /**
39: * Returns the workspace instance.
40: */
41: public static IWorkspace getWorkspace() {
42: return ResourcesPlugin.getWorkspace();
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 = KelpEclipsePlugin.getDefault()
51: .getResourceBundle();
52: try {
53: return bundle.getString(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: }
|