Mercurial > projects > dwt-addons
annotate dwtx/jface/internal/text/link/contentassist/ContentAssistMessages.d @ 150:5cf141e43417
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 23:05:26 +0200 |
parents | 000f9136b8f7 |
children | 77b70cbb4c8d |
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 *******************************************************************************/ | |
150 | 13 module dwtx.jface.internal.text.link.contentassist.ContentAssistMessages; |
129 | 14 |
131 | 15 |
16 import dwtx.jface.internal.text.link.contentassist.IProposalListener; // packageimport | |
17 import dwtx.jface.internal.text.link.contentassist.LineBreakingReader; // packageimport | |
18 import dwtx.jface.internal.text.link.contentassist.CompletionProposalPopup2; // packageimport | |
19 import dwtx.jface.internal.text.link.contentassist.ContextInformationPopup2; // packageimport | |
20 import dwtx.jface.internal.text.link.contentassist.Helper2; // packageimport | |
21 import dwtx.jface.internal.text.link.contentassist.PopupCloser2; // packageimport | |
22 import dwtx.jface.internal.text.link.contentassist.IContentAssistListener2; // packageimport | |
23 import dwtx.jface.internal.text.link.contentassist.ContentAssistant2; // packageimport | |
24 import dwtx.jface.internal.text.link.contentassist.AdditionalInfoController2; // packageimport | |
25 | |
129 | 26 import dwt.dwthelper.utils; |
27 | |
28 import java.util.MissingResourceException; | |
29 import java.util.ResourceBundle; | |
30 | |
31 import com.ibm.icu.text.MessageFormat; | |
32 | |
33 | |
34 /** | |
35 * Helper class to get NLSed messages. | |
36 * | |
37 * @since 3.0 | |
38 */ | |
39 class ContentAssistMessages { | |
40 | |
150 | 41 // private static const String RESOURCE_BUNDLE= ContentAssistMessages.class.getName(); |
42 | |
43 private static ResourceBundle fgResourceBundle;//= ResourceBundle.getBundle(RESOURCE_BUNDLE); | |
129 | 44 |
150 | 45 static this() { |
46 fgResourceBundle = ResourceBundle.getBundle( | |
47 getImportData!("dwtx.jface.internal.text.link.contentassist.ContentAssistMessages.properties")); | |
48 } | |
129 | 49 |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
50 private this() { |
129 | 51 } |
52 | |
53 /** | |
54 * Gets a string from the resource bundle. | |
55 * | |
56 * @param key the string used to get the bundle value, must not be null | |
57 * @return the string from the resource bundle | |
58 */ | |
59 public static String getString(String key) { | |
60 try { | |
61 return fgResourceBundle.getString(key); | |
62 } catch (MissingResourceException e) { | |
150 | 63 return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$ |
129 | 64 } |
65 } | |
66 | |
67 /** | |
68 * Gets a string from the resource bundle and formats it with the given arguments. | |
69 * | |
70 * @param key the string used to get the bundle value, must not be null | |
71 * @param args the arguments used to format the string | |
72 * @return the formatted string | |
73 */ | |
150 | 74 public static String getFormattedString(String key, Object[] args... ) { |
129 | 75 String format= null; |
76 try { | |
77 format= fgResourceBundle.getString(key); | |
78 } catch (MissingResourceException e) { | |
150 | 79 return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$ |
129 | 80 } |
81 return MessageFormat.format(format, args); | |
82 } | |
83 | |
150 | 84 |
129 | 85 } |