Mercurial > projects > dwt-addons
annotate dwtx/jface/text/hyperlink/HyperlinkMessages.d @ 174:c6d7b1ea700b
First sample running
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 11 Sep 2008 00:32:24 +0200 |
parents | 1a5b8f8129df |
children |
rev | line source |
---|---|
129 | 1 /******************************************************************************* |
2 * Copyright (c) 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 dwtx.jface.text.hyperlink.HyperlinkMessages; | |
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; |
129 | 18 |
19 | |
20 /** | |
21 * Helper class to get NLSed messages. | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
133
diff
changeset
|
22 * |
129 | 23 * @since 3.4 |
24 */ | |
25 class HyperlinkMessages { | |
174 | 26 private static ResourceBundle RESOURCE_BUNDLE_;//= ResourceBundle.getBundle(BUNDLE_NAME); |
27 private static ResourceBundle RESOURCE_BUNDLE(){ | |
28 if( RESOURCE_BUNDLE_ is null ){ | |
29 synchronized(HyperlinkMessages.classinfo ){ | |
30 if( RESOURCE_BUNDLE_ is null ){ | |
31 RESOURCE_BUNDLE_ = ResourceBundle.getBundle( | |
32 getImportData!("dwtx.jface.text.hyperlink.HyperlinkMessages.properties")); | |
33 } | |
34 } | |
35 } | |
36 return RESOURCE_BUNDLE_; | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
133
diff
changeset
|
37 } |
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
133
diff
changeset
|
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 /** | |
43 * Gets a string from the resource bundle. | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
133
diff
changeset
|
44 * |
129 | 45 * @param key the string used to get the bundle value, must not be |
46 * <code>null</code> | |
47 * @return the string from the resource bundle | |
48 */ | |
49 public static String getString(String key) { | |
50 try { | |
51 return RESOURCE_BUNDLE.getString(key); | |
52 } catch (MissingResourceException e) { | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
133
diff
changeset
|
53 return '!' ~ key ~ '!'; |
129 | 54 } |
55 } | |
56 } |