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.grounding.sawsdl.ui;
26  
27  import org.eclipse.ui.plugin.*;
28  import java.util.*;
29  
30  /***
31   * The main plugin class to be used in the desktop.
32   */
33  public class UiPlugin extends AbstractUIPlugin {
34  	//The shared instance.
35  	private static UiPlugin plugin;
36  	//Resource bundle.
37  	private ResourceBundle resourceBundle;
38  	
39  	private static final String WSDL_1_1_SUPPORT_PROP = "wsdl11support";
40      private static final String LOCAL_IRIS_IN_TREE_PROP = "localnamesintree";
41  	/***
42  	 * The constructor.
43  	 */
44  	public UiPlugin() {
45  		super();
46  		plugin = this;
47  	}
48  
49  	/***
50  	 * Returns the shared instance.
51  	 */
52  	public static UiPlugin getDefault() {
53  		return plugin;
54  	}
55  
56  	/***
57  	 * Returns the string from the plugin's resource bundle,
58  	 * or 'key' if not found.
59  	 */
60  	public static String getResourceString(String key) {
61  		ResourceBundle bundle = UiPlugin.getDefault().getResourceBundle();
62  		try {
63  			return (bundle != null) ? bundle.getString(key) : key;
64  		} catch (MissingResourceException e) {
65  			return key;
66  		}
67  	}
68  
69  	/***
70  	 * Returns the plugin's resource bundle,
71  	 */
72  	public ResourceBundle getResourceBundle() {
73  		try {
74  			if (resourceBundle == null)
75  				resourceBundle   = ResourceBundle.getBundle("org.wsmostudio.grounding.sawsdl.UiPluginResources");
76  		} catch (MissingResourceException x) {
77  			resourceBundle = null;
78  		}
79  		return resourceBundle;
80  	}
81  	
82  	public static boolean hasWSDL11Support() {
83  		return plugin.getPreferenceStore().getBoolean(WSDL_1_1_SUPPORT_PROP);
84  	}
85  
86  	public static void setWSDL11Support(boolean stat) {
87  		plugin.getPreferenceStore().setValue(WSDL_1_1_SUPPORT_PROP, stat);
88  	}
89  
90      public static boolean isShowingLocalNames() {
91          return plugin.getPreferenceStore().getBoolean(LOCAL_IRIS_IN_TREE_PROP);
92      }
93  
94      public static void setIsShowingLocalNames(boolean stat) {
95          plugin.getPreferenceStore().setValue(LOCAL_IRIS_IN_TREE_PROP, stat);
96      }
97  
98  }
99  
100 /*
101  * $Log$
102  * Revision 1.3  2006/10/12 16:23:53  alex_simov
103  * showing full/local model references made optional making SAWSDL
104  * editor content cleaner
105  *
106  * Revision 1.2  2006/07/19 11:27:40  alex_simov
107  * WSDL 1.1 annotation support added (this option is controlled by preference
108  *  pages)
109  *
110  * Revision 1.1  2006/07/05 15:37:28  alex_simov
111  * no message
112  *
113  * Revision 1.1  2006/06/06 13:15:27  alex_simov
114  * no message
115  *
116  */