A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpeclipse / ui / preferences / PHPPreferencesMessages.java
1 package net.sourceforge.phpeclipse.ui.preferences;
2
3 import java.text.MessageFormat;
4 import java.util.MissingResourceException;
5 import java.util.ResourceBundle;
6
7 public class PHPPreferencesMessages {
8
9         private static final String RESOURCE_BUNDLE = PHPPreferencesMessages.class
10                         .getName();
11
12         private static ResourceBundle fgResourceBundle = ResourceBundle
13                         .getBundle(RESOURCE_BUNDLE);
14
15         private PHPPreferencesMessages() {
16         }
17
18         public static String getString(String key) {
19                 try {
20                         return fgResourceBundle.getString(key);
21                 } catch (MissingResourceException e) {
22                         return '!' + key + '!';
23                 }
24         }
25
26         /**
27          * Gets a string from the resource bundle and formats it with the argument
28          * 
29          * @param key
30          *            the string used to get the bundle value, must not be null
31          */
32         public static String getFormattedString(String key, Object arg) {
33                 return MessageFormat.format(getString(key), new Object[] { arg });
34         }
35
36         /**
37          * Gets a string from the resource bundle and formats it with arguments
38          */
39         public static String getFormattedString(String key, Object[] args) {
40                 return MessageFormat.format(getString(key), args);
41         }
42 }