Mercurial > projects > dwt2
comparison org.eclipse.text/src/org/eclipse/jface/text/TextMessages.d @ 12:bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 14 Mar 2009 18:23:29 +0100 |
parents | |
children | ebefa5c2eab4 |
comparison
equal
deleted
inserted
replaced
11:43904fec5dca | 12:bc29606a740c |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007, 2008 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 org.eclipse.jface.text.TextMessages; | |
14 | |
15 import java.lang.all; | |
16 | |
17 import java.util.ResourceBundle; | |
18 import java.util.MissingResourceException; | |
19 import java.text.MessageFormat; | |
20 | |
21 | |
22 /** | |
23 * Helper class to get NLSed messages. | |
24 * | |
25 * @since 3.4 | |
26 */ | |
27 class TextMessages { | |
28 // private static const String BUNDLE_NAME= "org.eclipse.jface.text.TextMessages"; //$NON-NLS-1$ | |
29 | |
30 private static ResourceBundle RESOURCE_BUNDLE_;//= ResourceBundle.getBundle(BUNDLE_NAME); | |
31 private static ResourceBundle RESOURCE_BUNDLE(){ | |
32 if( RESOURCE_BUNDLE_ is null ){ | |
33 synchronized(TextMessages.classinfo ){ | |
34 if( RESOURCE_BUNDLE_ is null ){ | |
35 RESOURCE_BUNDLE_ = ResourceBundle.getBundle( | |
36 getImportData!("org.eclipse.jface.text.TextMessages.properties")); | |
37 } | |
38 } | |
39 } | |
40 return RESOURCE_BUNDLE_; | |
41 } | |
42 | |
43 private this() { | |
44 } | |
45 | |
46 public static String getString(String key) { | |
47 try { | |
48 return RESOURCE_BUNDLE.getString(key); | |
49 } catch (MissingResourceException e) { | |
50 return '!' ~ key ~ '!'; | |
51 } | |
52 } | |
53 | |
54 public static String getFormattedString(String key, Object[] args...) { | |
55 return MessageFormat.format(getString(key), args); | |
56 } | |
57 | |
58 } |