Mercurial > projects > dwt-addons
annotate dwtx/jface/text/templates/JFaceTextTemplateMessages.d @ 174:c6d7b1ea700b
First sample running
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 11 Sep 2008 00:32:24 +0200 |
parents | 25f1f92fa3df |
children |
rev | line source |
---|---|
129 | 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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.jface.text.templates.JFaceTextTemplateMessages; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 | |
155
8442b6b2da2d
Fix import for ResourceBundle
Frank Benoit <benoit@tionex.de>
parents:
154
diff
changeset
|
17 import dwt.dwthelper.ResourceBundle; |
158 | 18 import dwtx.dwtxhelper.MessageFormat; |
129 | 19 |
20 /** | |
21 * @since 3.0 | |
22 */ | |
23 class JFaceTextTemplateMessages { | |
24 | |
174 | 25 private static ResourceBundle fgResourceBundle_;//= ResourceBundle.getBundle(RESOURCE_BUNDLE); |
145 | 26 |
174 | 27 private static ResourceBundle fgResourceBundle(){ |
28 if( fgResourceBundle_ is null ){ | |
29 synchronized(JFaceTextTemplateMessages.classinfo ){ | |
30 if( fgResourceBundle_ is null ){ | |
31 fgResourceBundle_ = ResourceBundle.getBundle( | |
32 getImportData!("dwtx.jface.text.templates.JFaceTextTemplateMessages.properties")); | |
33 } | |
34 } | |
35 } | |
36 return fgResourceBundle_; | |
145 | 37 } |
129 | 38 |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
39 private this() { |
129 | 40 } |
41 | |
42 public static String getString(String key) { | |
43 try { | |
44 return fgResourceBundle.getString(key); | |
45 } catch (MissingResourceException e) { | |
145 | 46 return '!' ~ key ~ '!'; |
129 | 47 } |
48 } | |
49 | |
145 | 50 public static String getFormattedString(String key, Object[] args... ) { |
129 | 51 return MessageFormat.format(getString(key), args); |
52 } | |
53 } |