1 package org.dbe.studio.tools.accounting.metering;
2
3 import org.eclipse.ui.plugin.*;
4 import org.osgi.framework.BundleContext;
5 import java.util.*;
6
7 /***
8 * The main plugin class to be used in the desktop.
9 */
10 public class MeteringPlugin extends AbstractUIPlugin {
11
12 private static MeteringPlugin plugin;
13
14 private ResourceBundle resourceBundle;
15
16 /***
17 * The constructor.
18 */
19 public MeteringPlugin() {
20 super();
21 plugin = this;
22 try {
23 resourceBundle = ResourceBundle.getBundle("org.dbe.studio.tools.accounting.metering.AccountingPluginResources");
24 } catch (MissingResourceException x) {
25 resourceBundle = null;
26 }
27 }
28
29 /***
30 * This method is called upon plug-in activation
31 */
32 public void start(BundleContext context) throws Exception {
33 super.start(context);
34 }
35
36 /***
37 * This method is called when the plug-in is stopped
38 */
39 public void stop(BundleContext context) throws Exception {
40 super.stop(context);
41 }
42
43 /***
44 * Returns the shared instance.
45 */
46 public static MeteringPlugin getDefault() {
47 return plugin;
48 }
49
50 /***
51 * Returns the string from the plugin's resource bundle,
52 * or 'key' if not found.
53 */
54 public static String getResourceString(String key) {
55 ResourceBundle bundle = MeteringPlugin.getDefault().getResourceBundle();
56 try {
57 return (bundle != null) ? bundle.getString(key) : key;
58 } catch (MissingResourceException e) {
59 return key;
60 }
61 }
62
63 /***
64 * Returns the plugin's resource bundle,
65 */
66 public ResourceBundle getResourceBundle() {
67 return resourceBundle;
68 }
69 }