1 11 package org.eclipse.help.ui.internal.ide; 12 import java.net.*; 13 import java.text.*; 14 import java.util.*; 15 16 import org.eclipse.core.runtime.*; 17 21 public class HelpIdeResources { 22 private static ResourceBundle resBundle; 23 static { 24 resBundle = ResourceBundle.getBundle(HelpIdeResources.class.getName()); 25 } 26 29 public HelpIdeResources() { 30 super(); 31 } 32 35 public static URL getImagePath(String name) { 36 IPath path = new Path("icons/").append(name); return Platform.find(HelpIdePlugin.getDefault().getBundle(), path); 38 } 39 42 public static String getString(String name) { 43 try { 44 return resBundle.getString(name); 45 } catch (Exception e) { 46 return name; 47 } 48 49 } 50 53 public static String getString(String name, String replace0) { 54 try { 55 String stringFromPropertiesFile = resBundle.getString(name); 56 stringFromPropertiesFile = MessageFormat.format( 57 stringFromPropertiesFile, new Object []{replace0}); 58 return stringFromPropertiesFile; 59 } catch (Exception e) { 60 return name; 61 } 62 63 } 64 67 public static String getString(String name, String replace0, String replace1) { 68 try { 69 String stringFromPropertiesFile = resBundle.getString(name); 70 stringFromPropertiesFile = MessageFormat.format( 71 stringFromPropertiesFile, new Object []{replace0, replace1}); 72 return stringFromPropertiesFile; 73 } catch (Exception e) { 74 return name; 75 } 76 77 } 78 81 public static String getString(String name, String replace0, 82 String replace1, String replace2) { 83 try { 84 String stringFromPropertiesFile = resBundle.getString(name); 85 stringFromPropertiesFile = MessageFormat.format( 86 stringFromPropertiesFile, new Object []{replace0, replace1, 87 replace2}); 88 return stringFromPropertiesFile; 89 } catch (Exception e) { 90 return name; 91 } 92 93 } 94 97 public static String getString(String name, String replace0, 98 String replace1, String replace2, String replace3) { 99 try { 100 String stringFromPropertiesFile = resBundle.getString(name); 101 stringFromPropertiesFile = MessageFormat.format( 102 stringFromPropertiesFile, new Object []{replace0, replace1, 103 replace2, replace3}); 104 return stringFromPropertiesFile; 105 } catch (Exception e) { 106 return name; 107 } 108 109 } 110 113 public static String getString(String name, String replace0, 114 String replace1, String replace2, String replace3, String replace4) { 115 try { 116 String stringFromPropertiesFile = resBundle.getString(name); 117 stringFromPropertiesFile = MessageFormat.format( 118 stringFromPropertiesFile, new Object []{replace0, replace1, 119 replace2, replace3, replace4}); 120 return stringFromPropertiesFile; 121 } catch (Exception e) { 122 return name; 123 } 124 125 } 126 129 public static String getString(String name, String replace0, 130 String replace1, String replace2, String replace3, String replace4, 131 String replace5) { 132 try { 133 String stringFromPropertiesFile = resBundle.getString(name); 134 stringFromPropertiesFile = MessageFormat.format( 135 stringFromPropertiesFile, new Object []{replace0, replace1, 136 replace2, replace3, replace4, replace5}); 137 return stringFromPropertiesFile; 138 } catch (Exception e) { 139 return name; 140 } 141 142 } 143 } 144 | Popular Tags |