KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > KelpEclipse21 > KelpEclipse21Plugin


1 package KelpEclipse21;
2
3 import org.eclipse.ui.plugin.*;
4 import org.eclipse.core.runtime.*;
5 import org.eclipse.core.resources.*;
6 import java.util.*;
7
8 /**
9  * The main plugin class to be used in the desktop.
10  */

11 public class KelpEclipse21Plugin extends AbstractUIPlugin {
12     //The shared instance.
13
private static KelpEclipse21Plugin plugin;
14     //Resource bundle.
15
private ResourceBundle resourceBundle;
16     
17     /**
18      * The constructor.
19      */

20     public KelpEclipse21Plugin(IPluginDescriptor descriptor) {
21         super(descriptor);
22         plugin = this;
23         try {
24             resourceBundle= ResourceBundle.getBundle("KelpEclipse21.KelpEclipse21PluginResources");
25         } catch (MissingResourceException x) {
26             resourceBundle = null;
27         }
28     }
29
30     /**
31      * Returns the shared instance.
32      */

33     public static KelpEclipse21Plugin getDefault() {
34         return plugin;
35     }
36
37     /**
38      * Returns the workspace instance.
39      */

40     public static IWorkspace getWorkspace() {
41         return ResourcesPlugin.getWorkspace();
42     }
43
44     /**
45      * Returns the string from the plugin's resource bundle,
46      * or 'key' if not found.
47      */

48     public static String JavaDoc getResourceString(String JavaDoc key) {
49         ResourceBundle bundle= KelpEclipse21Plugin.getDefault().getResourceBundle();
50         try {
51             return bundle.getString(key);
52         } catch (MissingResourceException e) {
53             return key;
54         }
55     }
56
57     /**
58      * Returns the plugin's resource bundle,
59      */

60     public ResourceBundle getResourceBundle() {
61         return resourceBundle;
62     }
63 }
64
Popular Tags