fix #774 infinite loop in net.sourceforge.phpeclipse.builder.IdentifierIndexManager...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / preferences / PHPPreferencesMessages.java
index dfda1e6..1c60d30 100644 (file)
@@ -6,31 +6,37 @@ import java.util.ResourceBundle;
 
 public class PHPPreferencesMessages {
 
+       private static final String RESOURCE_BUNDLE = PHPPreferencesMessages.class
+                       .getName();
 
-  private static final String RESOURCE_BUNDLE= "net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages";//$NON-NLS-1$
-
-       private static ResourceBundle resourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+       private static ResourceBundle fgResourceBundle = ResourceBundle
+                       .getBundle(RESOURCE_BUNDLE);
 
        private PHPPreferencesMessages() {
        }
 
        public static String getString(String key) {
                try {
-                       return resourceBundle.getString(key);
+                       return fgResourceBundle.getString(key);
                } catch (MissingResourceException e) {
                        return '!' + key + '!';
                }
        }
-       
-       public static String getFormattedString(String key, String arg) {
-               return getFormattedString(key, new String[] { arg });
-       }
-       
-       public static String getFormattedString(String key, String[] args) {
-               return MessageFormat.format(getString(key), args);      
+
+       /**
+        * Gets a string from the resource bundle and formats it with the argument
+        * 
+        * @param key
+        *            the string used to get the bundle value, must not be null
+        */
+       public static String getFormattedString(String key, Object arg) {
+               return MessageFormat.format(getString(key), new Object[] { arg });
        }
-       
-       public static ResourceBundle getResourceBundle() {
-               return resourceBundle;
+
+       /**
+        * Gets a string from the resource bundle and formats it with arguments
+        */
+       public static String getFormattedString(String key, Object[] args) {
+               return MessageFormat.format(getString(key), args);
        }
 }