View Javadoc
1   /*
2    WSMO Studio - a Semantic Web Service Editor
3    Copyright (c) 2004-2006, OntoText Lab. / SIRMA Group
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 org.wsmostudio.ui;
26  
27  import org.eclipse.ui.plugin.*;
28  import org.osgi.framework.BundleContext;
29  import org.wsmostudio.ui.editors.extension.ExtensionManager;
30  
31  import java.util.*;
32  
33  /***
34   * The main WSMO plugin class to be used in the studio.
35   */
36  public class WsmoUIPlugin extends AbstractUIPlugin {
37  	//The shared instance.
38  	private static WsmoUIPlugin plugin;
39  	//Resource bundle.
40  	private ResourceBundle resourceBundle;
41      
42      private ExtensionManager extManager;
43  	
44  	/***
45  	 * The constructor.
46  	 */
47  	public WsmoUIPlugin() {
48  		super();
49  		plugin = this;
50  		try {
51  			resourceBundle = ResourceBundle.getBundle("org.wsmostudio.ui.WsmoUIPluginResources");
52  		} 
53  		catch (MissingResourceException x) {
54  			resourceBundle = null;
55  		}
56  	}
57  
58  	/***
59  	 * This method is called upon plug-in activation
60  	 */
61  	public void start(BundleContext context) throws Exception {
62          extManager = new ExtensionManager();
63  		super.start(context);
64  	}
65  
66  	/***
67  	 * This method is called when the plug-in is stopped
68  	 */
69  	public void stop(BundleContext context) throws Exception {
70  		super.stop(context);
71  	}
72  
73  	/***
74  	 * Returns the shared instance.
75  	 */
76  	public static WsmoUIPlugin getDefault() {
77  		return plugin;
78  	}
79  
80  	/***
81  	 * Returns the string from the plugin's resource bundle,
82  	 * or 'key' if not found.
83  	 */
84  	public static String getResourceString(String key) {
85  		ResourceBundle bundle = WsmoUIPlugin.getDefault().getResourceBundle();
86  		try {
87  			return (bundle != null) ? bundle.getString(key) : key;
88  		} catch (MissingResourceException e) {
89  			return key;
90  		}
91  	}
92  
93  	/***
94  	 * Returns the plugin's resource bundle,
95  	 */
96  	public ResourceBundle getResourceBundle() {
97  		return resourceBundle;
98  	}
99      
100     public ExtensionManager getExtensionManager() {
101         return extManager;
102     }
103 }
104 
105 /*
106  * $Log$
107  * Revision 1.4  2006/01/09 12:51:13  alex_simov
108  * Copyright message in header updated
109  *
110  * Revision 1.3  2005/07/25 12:59:19  alex_simov
111  * WSML serializer now accepts an array of TopEntities
112  *
113  */