1 package net.sourceforge.phpeclipse.preferences;
3 import java.text.MessageFormat;
4 import java.util.MissingResourceException;
5 import java.util.ResourceBundle;
7 import net.sourceforge.phpeclipse.IPreferenceConstants;
8 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
10 import org.eclipse.jface.preference.IPreferenceStore;
12 public class PHPPreferencesMessages {
14 static IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
15 static String resourceBundleName;
17 resourceBundleName = store.getString(IPreferenceConstants.RESOURCE_BUNDLE);
19 private static ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceBundleName);
21 private PHPPreferencesMessages() {
24 public static String getString(String key) {
26 return resourceBundle.getString(key);
27 } catch (MissingResourceException e) {
28 return '!' + key + '!';
31 public static void setResourceBundle(String newResourceBundle) {
32 resourceBundle = ResourceBundle.getBundle(newResourceBundle);
35 public static String getFormattedString(String key, String arg) {
36 return getFormattedString(key, new String[] { arg });
39 public static String getFormattedString(String key, String[] args) {
40 return MessageFormat.format(getString(key), args);
43 public static ResourceBundle getResourceBundle() {
44 return resourceBundle;