1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 /***
19 * <p>Title: WSMO Studio</p>
20 * <p>Description: Semantic Web Service Editor</p>
21 * <p>Copyright: Copyright (c) 2004-2006</p>
22 * <p>Company: OntoText Lab. / SIRMA </p>
23 */
24
25 package org.wsmostudio.runtime;
26
27 import org.eclipse.ui.plugin.*;
28 import org.osgi.framework.BundleContext;
29 import org.wsmostudio.runtime.cache.WSMLResourceListener;
30 import org.eclipse.core.resources.*;
31
32 import java.util.*;
33
34 /***
35 * The main Runtime plugin class which represents the base of the WSMO Studio.
36 *
37 * @author not attributable
38 * @version $Revision: 469 $ $Date: 2006-01-09 14:51:14 +0200 $
39 */
40
41 public class RuntimePlugin extends AbstractUIPlugin {
42
43 private static RuntimePlugin plugin;
44
45 private ResourceBundle resourceBundle;
46
47 public static final String PLUGIN_ID = "org.wsmostudio.runtime";
48
49 /***
50 * The constructor.
51 */
52 public RuntimePlugin() {
53 super();
54 plugin = this;
55 try {
56 resourceBundle = ResourceBundle.getBundle("org.wsmostudio.runtime.RuntimePluginResources");
57 } catch (MissingResourceException x) {
58 resourceBundle = null;
59 }
60 }
61
62 /***
63 * This method is called upon plug-in activation
64 */
65 public void start(BundleContext context) throws Exception {
66 super.start(context);
67
68
69 WSMLResourceListener resourceListener = new WSMLResourceListener();
70 ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceListener);
71 WSMORuntime.getCache().reinit();
72 }
73
74 /***
75 * This method is called when the plug-in is stopped
76 */
77 public void stop(BundleContext context) throws Exception {
78 super.stop(context);
79 }
80
81 /***
82 * Returns the shared instance.
83 */
84 public static RuntimePlugin getDefault() {
85 return plugin;
86 }
87
88 /***
89 * Returns the string from the plugin's resource bundle,
90 * or 'key' if not found.
91 */
92 public static String getResourceString(String key) {
93 ResourceBundle bundle = RuntimePlugin.getDefault().getResourceBundle();
94 try {
95 return (bundle != null) ? bundle.getString(key) : key;
96 } catch (MissingResourceException e) {
97 return key;
98 }
99 }
100
101 /***
102 * Returns the plugin's resource bundle,
103 */
104 public ResourceBundle getResourceBundle() {
105 return resourceBundle;
106 }
107 }
108
109
110
111
112
113
114
115
116
117