1 11 12 package org.eclipse.jface.internal.text.link.contentassist; 13 14 import com.ibm.icu.text.MessageFormat; 15 import java.util.MissingResourceException ; 16 import java.util.ResourceBundle ; 17 18 19 24 class ContentAssistMessages { 25 26 private static final String RESOURCE_BUNDLE= ContentAssistMessages.class.getName(); 27 28 private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); 29 30 private ContentAssistMessages() { 31 } 32 33 39 public static String getString(String key) { 40 try { 41 return fgResourceBundle.getString(key); 42 } catch (MissingResourceException e) { 43 return "!" + key + "!"; } 45 } 46 47 54 public static String getFormattedString(String key, Object [] args) { 55 String format= null; 56 try { 57 format= fgResourceBundle.getString(key); 58 } catch (MissingResourceException e) { 59 return "!" + key + "!"; } 61 return MessageFormat.format(format, args); 62 } 63 64 71 public static String getFormattedString(String key, Object arg) { 72 String format= null; 73 try { 74 format= fgResourceBundle.getString(key); 75 } catch (MissingResourceException e) { 76 return "!" + key + "!"; } 78 if (arg == null) 79 arg= ""; return MessageFormat.format(format, new Object [] { arg }); 81 } 82 } 83 | Popular Tags |