01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.text.templates.persistence;
11:
12: import com.ibm.icu.text.MessageFormat;
13: import java.util.MissingResourceException;
14: import java.util.ResourceBundle;
15:
16: /**
17: * @since 3.0
18: */
19: class TemplatePersistenceMessages {
20:
21: private static final String RESOURCE_BUNDLE = TemplatePersistenceMessages.class
22: .getName();
23: private static ResourceBundle fgResourceBundle = ResourceBundle
24: .getBundle(RESOURCE_BUNDLE);
25:
26: private TemplatePersistenceMessages() {
27: }
28:
29: public static String getString(String key) {
30: try {
31: return fgResourceBundle.getString(key);
32: } catch (MissingResourceException e) {
33: return '!' + key + '!';
34: }
35: }
36:
37: public static String getFormattedString(String key, Object arg) {
38: return MessageFormat.format(getString(key),
39: new Object[] { arg });
40: }
41:
42: public static String getFormattedString(String key, Object[] args) {
43: return MessageFormat.format(getString(key), args);
44: }
45: }
|