added todos
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPeclipsePlugin.java
1 package net.sourceforge.phpeclipse;
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 PHPeclipsePlugin extends AbstractUIPlugin {
12         //The shared instance.
13         private static PHPeclipsePlugin plugin;
14         //Resource bundle.
15         private ResourceBundle resourceBundle;
16
17         /**
18          * The constructor.
19          */
20         public PHPeclipsePlugin(IPluginDescriptor descriptor) {
21                 super(descriptor);
22                 plugin = this;
23                 try {
24                         resourceBundle =
25                                 ResourceBundle.getBundle(
26                                         "net.sourceforge.PHPeclipsePluginResources");
27                 } catch (MissingResourceException x) {
28                         resourceBundle = null;
29                 }
30         }
31
32         /**
33          * Returns the shared instance.
34          */
35         public static PHPeclipsePlugin getDefault() {
36                 return plugin;
37         }
38
39         /**
40          * Returns the workspace instance.
41          */
42         public static IWorkspace getWorkspace() {
43                 return ResourcesPlugin.getWorkspace();
44         }
45
46         /**
47          * Returns the string from the plugin's resource bundle,
48          * or 'key' if not found.
49          */
50         public static String getResourceString(String key) {
51                 ResourceBundle bundle =
52                         PHPeclipsePlugin.getDefault().getResourceBundle();
53                 try {
54                         return bundle.getString(key);
55                 } catch (MissingResourceException e) {
56                         return key;
57                 }
58         }
59
60         /**
61          * Returns the plugin's resource bundle,
62          */
63         public ResourceBundle getResourceBundle() {
64                 return resourceBundle;
65         }
66 }