129
|
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
|
131
|
15 import dwtx.text.undo.DocumentUndoManager; // packageimport
|
|
16 import dwtx.text.undo.DocumentUndoManagerRegistry; // packageimport
|
|
17 import dwtx.text.undo.DocumentUndoEvent; // packageimport
|
|
18 import dwtx.text.undo.IDocumentUndoListener; // packageimport
|
|
19 import dwtx.text.undo.IDocumentUndoManager; // packageimport
|
|
20
|
|
21
|
129
|
22 import dwt.dwthelper.utils;
|
|
23
|
|
24 import java.util.MissingResourceException;
|
|
25 import java.util.ResourceBundle;
|
|
26
|
|
27 import com.ibm.icu.text.MessageFormat;
|
|
28
|
|
29 /**
|
|
30 * Helper class to get NLSed messages.
|
|
31 *
|
|
32 * @since 3.2
|
|
33 */
|
|
34 final class UndoMessages {
|
|
35
|
147
|
36 private static const String BUNDLE_NAME= "dwtx.text.undo.UndoMessages"; //$NON-NLS-1$
|
129
|
37
|
147
|
38 private static const ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME);
|
129
|
39
|
130
|
40 private this() {
|
129
|
41 }
|
|
42
|
|
43 public static String getString(String key) {
|
|
44 try {
|
|
45 return RESOURCE_BUNDLE.getString(key);
|
|
46 } catch (MissingResourceException e) {
|
|
47 return '!' + key + '!';
|
|
48 }
|
|
49 }
|
|
50
|
|
51 public static String getFormattedString(String key, Object arg) {
|
|
52 return getFormattedString(key, new Object[] { arg });
|
|
53 }
|
|
54
|
|
55 public static String getFormattedString(String key, Object[] args) {
|
|
56 return MessageFormat.format(getString(key), args);
|
|
57 }
|
|
58 }
|