Mercurial > projects > dwt-addons
annotate dwtx/jface/internal/text/link/contentassist/ContentAssistMessages.d @ 158:25f1f92fa3df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 26 Aug 2008 02:46:34 +0200 |
parents | 8442b6b2da2d |
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 *******************************************************************************/ | |
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 | |
155
8442b6b2da2d
Fix import for ResourceBundle
Frank Benoit <benoit@tionex.de>
parents:
154
diff
changeset
|
28 import dwt.dwthelper.ResourceBundle; |
158 | 29 import dwtx.dwtxhelper.MessageFormat; |
129 | 30 |
31 | |
32 /** | |
33 * Helper class to get NLSed messages. | |
34 * | |
35 * @since 3.0 | |
36 */ | |
37 class ContentAssistMessages { | |
38 | |
158 | 39 // private static const String RESOURCE_BUNDLE= ContentAssistMessages.classinfo.getName(); |
150 | 40 |
41 private static ResourceBundle fgResourceBundle;//= ResourceBundle.getBundle(RESOURCE_BUNDLE); | |
129 | 42 |
150 | 43 static this() { |
44 fgResourceBundle = ResourceBundle.getBundle( | |
45 getImportData!("dwtx.jface.internal.text.link.contentassist.ContentAssistMessages.properties")); | |
46 } | |
129 | 47 |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
48 private this() { |
129 | 49 } |
50 | |
51 /** | |
52 * Gets a string from the resource bundle. | |
53 * | |
54 * @param key the string used to get the bundle value, must not be null | |
55 * @return the string from the resource bundle | |
56 */ | |
57 public static String getString(String key) { | |
58 try { | |
59 return fgResourceBundle.getString(key); | |
60 } catch (MissingResourceException e) { | |
150 | 61 return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$ |
129 | 62 } |
63 } | |
64 | |
65 /** | |
66 * Gets a string from the resource bundle and formats it with the given arguments. | |
67 * | |
68 * @param key the string used to get the bundle value, must not be null | |
69 * @param args the arguments used to format the string | |
70 * @return the formatted string | |
71 */ | |
150 | 72 public static String getFormattedString(String key, Object[] args... ) { |
129 | 73 String format= null; |
74 try { | |
75 format= fgResourceBundle.getString(key); | |
76 } catch (MissingResourceException e) { | |
150 | 77 return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$ |
129 | 78 } |
79 return MessageFormat.format(format, args); | |
80 } | |
81 | |
150 | 82 |
129 | 83 } |