comparison dwtx/text/undo/UndoMessages.d @ 129:eb30df5ca28b

Added JFace Text sources
author Frank Benoit <benoit@tionex.de>
date Sat, 23 Aug 2008 19:10:48 +0200
parents
children b56e9be9fe88
comparison
equal deleted inserted replaced
128:8df1d4193877 129:eb30df5ca28b
1 /*******************************************************************************
2 * Copyright (c) 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 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module dwtx.text.undo.UndoMessages;
14
15 import dwt.dwthelper.utils;
16
17 import java.util.MissingResourceException;
18 import java.util.ResourceBundle;
19
20 import com.ibm.icu.text.MessageFormat;
21
22 /**
23 * Helper class to get NLSed messages.
24 *
25 * @since 3.2
26 */
27 final class UndoMessages {
28
29 private static final String BUNDLE_NAME= "dwtx.text.undo.UndoMessages"; //$NON-NLS-1$
30
31 private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME);
32
33 private UndoMessages() {
34 }
35
36 public static String getString(String key) {
37 try {
38 return RESOURCE_BUNDLE.getString(key);
39 } catch (MissingResourceException e) {
40 return '!' + key + '!';
41 }
42 }
43
44 public static String getFormattedString(String key, Object arg) {
45 return getFormattedString(key, new Object[] { arg });
46 }
47
48 public static String getFormattedString(String key, Object[] args) {
49 return MessageFormat.format(getString(key), args);
50 }
51 }