decf4925feb4c3d686b2694420a4202d777b6aaf
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpdt / internal / ui / text / link / LinkedPositionMessages.java
1 /*
2  * (c) Copyright IBM Corp. 2000, 2001.
3  * All Rights Reserved.
4  */
5 package net.sourceforge.phpdt.internal.ui.text.link;
6
7 import java.text.MessageFormat;
8 import java.util.MissingResourceException;
9 import java.util.ResourceBundle;
10
11 public class LinkedPositionMessages {
12
13         private static final String RESOURCE_BUNDLE = LinkedPositionMessages.class
14                         .getName();
15
16         private static ResourceBundle fgResourceBundle = ResourceBundle
17                         .getBundle(RESOURCE_BUNDLE);
18
19         private LinkedPositionMessages() {
20         }
21
22         public static String getString(String key) {
23                 try {
24                         return fgResourceBundle.getString(key);
25                 } catch (MissingResourceException e) {
26                         return '!' + key + '!';
27                 }
28         }
29
30         /**
31          * Gets a string from the resource bundle and formats it with the argument
32          * 
33          * @param key
34          *            the string used to get the bundle value, must not be null
35          */
36         public static String getFormattedString(String key, Object arg) {
37                 return MessageFormat.format(getString(key), new Object[] { arg });
38         }
39
40         /**
41          * Gets a string from the resource bundle and formats it with arguments
42          */
43         public static String getFormattedString(String key, Object[] args) {
44                 return MessageFormat.format(getString(key), args);
45         }
46 }