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