View Javadoc

1   /*
2    WSMO Studio - a Semantic Web Service Editor
3    Copyright (c) 2004-2006, Ontotext Lab. / SIRMA
4    
5    This library is free software; you can redistribute it and/or modify it under
6    the terms of the GNU Lesser General Public License as published by the Free
7    Software Foundation; either version 2.1 of the License, or (at your option)
8    any later version.
9    This library is distributed in the hope that it will be useful, but WITHOUT
10   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   details.
13   You should have received a copy of the GNU Lesser General Public License along
14   with this library; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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 com.ontotext.wsmo4j;
26  
27  import org.eclipse.ui.plugin.*;
28  import org.osgi.framework.BundleContext;
29  import java.util.*;
30  
31  /***
32   * The main plugin class to be used in the desktop.
33   */
34  public class Wsmo4jPlugin extends AbstractUIPlugin {
35  	//The shared instance.
36  	private static Wsmo4jPlugin plugin;
37  	//Resource bundle.
38  	private ResourceBundle resourceBundle;
39  	
40  	/***
41  	 * The constructor.
42  	 */
43  	public Wsmo4jPlugin() {
44  		super();
45  		plugin = this;
46  		try {
47  			resourceBundle = ResourceBundle.getBundle("com.ontotext.wsmo4j.Wsmo4jPluginResources");
48  		} catch (MissingResourceException x) {
49  			resourceBundle = null;
50  		}
51  	}
52  
53  	/***
54  	 * This method is called upon plug-in activation
55  	 */
56  	public void start(BundleContext context) throws Exception {
57  		super.start(context);
58  	}
59  
60  	/***
61  	 * This method is called when the plug-in is stopped
62  	 */
63  	public void stop(BundleContext context) throws Exception {
64  		super.stop(context);
65  	}
66  
67  	/***
68  	 * Returns the shared instance.
69  	 */
70  	public static Wsmo4jPlugin getDefault() {
71  		return plugin;
72  	}
73  
74  	/***
75  	 * Returns the string from the plugin's resource bundle,
76  	 * or 'key' if not found.
77  	 */
78  	public static String getResourceString(String key) {
79  		ResourceBundle bundle = Wsmo4jPlugin.getDefault().getResourceBundle();
80  		try {
81  			return (bundle != null) ? bundle.getString(key) : key;
82  		} catch (MissingResourceException e) {
83  			return key;
84  		}
85  	}
86  
87  	/***
88  	 * Returns the plugin's resource bundle,
89  	 */
90  	public ResourceBundle getResourceBundle() {
91  		return resourceBundle;
92  	}
93  }