KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > templates > persistence > TemplatePersistenceMessages


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.text.templates.persistence;
12
13 import com.ibm.icu.text.MessageFormat;
14 import java.util.MissingResourceException JavaDoc;
15 import java.util.ResourceBundle JavaDoc;
16
17 /**
18  * @since 3.0
19  */

20 class TemplatePersistenceMessages {
21
22     private static final String JavaDoc RESOURCE_BUNDLE= TemplatePersistenceMessages.class.getName();
23     private static ResourceBundle JavaDoc fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
24
25     private TemplatePersistenceMessages() {
26     }
27
28     public static String JavaDoc getString(String JavaDoc key) {
29         try {
30             return fgResourceBundle.getString(key);
31         } catch (MissingResourceException JavaDoc e) {
32             return '!' + key + '!';
33         }
34     }
35
36     public static String JavaDoc getFormattedString(String JavaDoc key, Object JavaDoc arg) {
37         return MessageFormat.format(getString(key), new Object JavaDoc[] { arg });
38     }
39
40     public static String JavaDoc getFormattedString(String JavaDoc key, Object JavaDoc[] args) {
41         return MessageFormat.format(getString(key), args);
42     }
43 }
44
Popular Tags