1 |
| |
2 |
| |
3 |
| |
4 |
| package net.sourceforge.astyleclipse; |
5 |
| |
6 |
| import java.util.MissingResourceException; |
7 |
| import java.util.ResourceBundle; |
8 |
| |
9 |
| import org.eclipse.ui.plugin.AbstractUIPlugin; |
10 |
| import org.osgi.framework.BundleContext; |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| public class Activator extends AbstractUIPlugin { |
16 |
| |
17 |
| |
18 |
| public static final String PLUGIN_ID = "net.sourceforge.astyleclipse"; |
19 |
| |
20 |
| |
21 |
| private static Activator plugin; |
22 |
| private ResourceBundle resourceBundle; |
23 |
| |
24 |
| |
25 |
| |
26 |
0
| public Activator() {
|
27 |
| |
28 |
0
| plugin = this;
|
29 |
0
| try {
|
30 |
0
| resourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.indent.FormatterPluginResources");
|
31 |
| } catch (MissingResourceException x) { |
32 |
0
| resourceBundle = null;
|
33 |
| } |
34 |
| } |
35 |
| |
36 |
| |
37 |
| |
38 |
| |
39 |
| |
40 |
0
| public void start(BundleContext context) throws Exception {
|
41 |
| |
42 |
0
| super.start(context);
|
43 |
| } |
44 |
| |
45 |
| |
46 |
| |
47 |
| |
48 |
| |
49 |
0
| public void stop(BundleContext context) throws Exception {
|
50 |
0
| plugin = null;
|
51 |
0
| super.stop(context);
|
52 |
| } |
53 |
| |
54 |
| |
55 |
| |
56 |
| |
57 |
| |
58 |
0
| public static String getResourceString(String key) {
|
59 |
0
| ResourceBundle bundle = Activator.getDefault().getResourceBundle();
|
60 |
0
| try {
|
61 |
0
| return (bundle != null) ? bundle.getString(key) : key;
|
62 |
| } catch (MissingResourceException e) { |
63 |
0
| return key;
|
64 |
| } |
65 |
| } |
66 |
| |
67 |
| |
68 |
| |
69 |
| |
70 |
| |
71 |
0
| public static Activator getDefault() {
|
72 |
0
| return plugin;
|
73 |
| } |
74 |
| |
75 |
| |
76 |
| |
77 |
0
| public ResourceBundle getResourceBundle() {
|
78 |
0
| return resourceBundle;
|
79 |
| } |
80 |
| } |