Mercurial > projects > dwt-addons
diff 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 |
line wrap: on
line diff
--- a/dwtx/jface/internal/text/link/contentassist/ContentAssistMessages.d Sun Aug 24 22:41:48 2008 +0200 +++ b/dwtx/jface/internal/text/link/contentassist/ContentAssistMessages.d Sun Aug 24 23:05:26 2008 +0200 @@ -10,6 +10,7 @@ * Port to the D programming language: * Frank Benoit <benoit@tionex.de> *******************************************************************************/ +module dwtx.jface.internal.text.link.contentassist.ContentAssistMessages; import dwtx.jface.internal.text.link.contentassist.IProposalListener; // packageimport @@ -22,8 +23,6 @@ import dwtx.jface.internal.text.link.contentassist.ContentAssistant2; // packageimport import dwtx.jface.internal.text.link.contentassist.AdditionalInfoController2; // packageimport -module dwtx.jface.internal.text.link.contentassist.ContentAssistMessages; - import dwt.dwthelper.utils; import java.util.MissingResourceException; @@ -39,9 +38,14 @@ */ class ContentAssistMessages { - private static const String RESOURCE_BUNDLE= ContentAssistMessages.class.getName(); +// private static const String RESOURCE_BUNDLE= ContentAssistMessages.class.getName(); + + private static ResourceBundle fgResourceBundle;//= ResourceBundle.getBundle(RESOURCE_BUNDLE); - private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); + static this() { + fgResourceBundle = ResourceBundle.getBundle( + getImportData!("dwtx.jface.internal.text.link.contentassist.ContentAssistMessages.properties")); + } private this() { } @@ -56,7 +60,7 @@ try { return fgResourceBundle.getString(key); } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ + return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$ } } @@ -67,32 +71,15 @@ * @param args the arguments used to format the string * @return the formatted string */ - public static String getFormattedString(String key, Object[] args) { + public static String getFormattedString(String key, Object[] args... ) { String format= null; try { format= fgResourceBundle.getString(key); } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ + return "!" ~ key ~ "!";//$NON-NLS-2$ //$NON-NLS-1$ } return MessageFormat.format(format, args); } - /** - * Gets a string from the resource bundle and formats it with the given argument. - * - * @param key the string used to get the bundle value, must not be null - * @param arg the argument used to format the string - * @return the formatted string - */ - public static String getFormattedString(String key, Object arg) { - String format= null; - try { - format= fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ - } - if (arg is null) - arg= ""; //$NON-NLS-1$ - return MessageFormat.format(format, new Object[] { arg }); - } + }