01: /*
02: *
03: * JMoney - A Personal Finance Manager
04: * Copyright (c) 2004 Nigel Westbury <westbury@users.sourceforge.net>
05: *
06: *
07: * This program is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU General Public License as published by
09: * the Free Software Foundation; either version 2 of the License, or
10: * (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20: *
21: */
22:
23: package net.sf.jmoney.reconciliation;
24:
25: import java.util.MissingResourceException;
26: import java.util.ResourceBundle;
27:
28: import org.eclipse.ui.plugin.AbstractUIPlugin;
29:
30: /**
31: * The main plug-in class for this plug-in.
32: */
33: public class ReconciliationPlugin extends AbstractUIPlugin {
34: //The shared instance.
35: private static ReconciliationPlugin plugin;
36: //Resource bundle.
37: private ResourceBundle resourceBundle;
38:
39: /**
40: * The constructor.
41: */
42: public ReconciliationPlugin() {
43: super ();
44: plugin = this ;
45: try {
46: resourceBundle = ResourceBundle
47: .getBundle("net.sf.jmoney.reconciliation.Language");
48: } catch (MissingResourceException x) {
49: resourceBundle = null;
50: }
51: }
52:
53: /**
54: * Returns the shared instance.
55: */
56: public static ReconciliationPlugin getDefault() {
57: return plugin;
58: }
59:
60: /**
61: * Returns the string from the plugin's resource bundle,
62: * or 'key' if not found.
63: */
64: public static String getResourceString(String key) {
65: ResourceBundle bundle = ReconciliationPlugin.getDefault()
66: .getResourceBundle();
67: try {
68: return (bundle != null) ? bundle.getString(key) : key;
69: } catch (MissingResourceException e) {
70: return key;
71: }
72: }
73:
74: /**
75: * Returns the plugin's resource bundle,
76: */
77: public ResourceBundle getResourceBundle() {
78: return resourceBundle;
79: }
80: }
|