View Javadoc

1   /* ======================================
2    * Copyright (c) 2004-2005 Achim Nierbeck
3    * All rights reserved.
4    *
5    * You may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *       http://www.gnu.org/licenses/lgpl.html
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   * ======================================
16   */
17  
18  /*
19   * Messages.java
20   * $Revision: 1.2 $
21   * Date 14.12.2005
22   * 
23   * $Author: nierbeck $ 
24   * $Date: 2006/02/02 21:33:07 $ 
25   * 
26   */
27  package de.nierbeck.timeTrack.views;
28  
29  import java.util.MissingResourceException;
30  import java.util.ResourceBundle;
31  
32  /***
33   * Needed to access the resources (bundle)
34   * 
35   * @author Achim
36   *
37   */
38  public class Messages {
39  	private static final String BUNDLE_NAME = "de.nierbeck.timeTrack.views.messages";//$NON-NLS-1$
40  
41  	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
42  			.getBundle(BUNDLE_NAME);
43  
44  	private Messages() {
45  	}
46  
47  	/***
48  	 * resource string
49  	 * 
50  	 * @param key - the key to translate
51  	 * @return the string connected to the key
52  	 */
53  	public static String getString(String key) {
54  		// TODO Auto-generated method stub
55  		try {
56  			return RESOURCE_BUNDLE.getString(key);
57  		} catch (MissingResourceException e) {
58  			return '!' + key + '!';
59  		}
60  	}
61  }