fixed bug in template expansion
[phpeclipse.git] / net.sourceforge.phpeclipse / 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.getName();
14         private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
15
16         private LinkedPositionMessages() {
17         }
18
19         public static String getString(String key) {
20                 try {
21                         return fgResourceBundle.getString(key);
22                 } catch (MissingResourceException e) {
23                         return '!' + key + '!';
24                 }
25         }
26         
27         /**
28          * Gets a string from the resource bundle and formats it with the argument
29          * 
30          * @param key   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         /**
38          * Gets a string from the resource bundle and formats it with arguments
39          */     
40         public static String getFormattedString(String key, Object[] args) {
41                 return MessageFormat.format(getString(key), args);
42         }
43 }