1 11 package org.eclipse.pde.internal.junit.runtime; 12 13 import java.util.*; 14 15 import org.eclipse.core.runtime.*; 16 17 21 public class PdeJUnitPlugin extends Plugin { 22 23 private static PdeJUnitPlugin inst; 24 private ResourceBundle resourceBundle; 25 26 public PdeJUnitPlugin(IPluginDescriptor descriptor) { 27 super(descriptor); 28 inst = this; 29 try { 30 resourceBundle = 31 ResourceBundle.getBundle( 32 "org.eclipse.pde.internal.junit.runtime.junitresources"); } catch (MissingResourceException x) { 34 resourceBundle = null; 35 } 36 } 37 38 public static PdeJUnitPlugin getDefault() { 39 return inst; 40 } 41 42 public static String getFormattedMessage(String key, String arg) { 43 String text = getResourceString(key); 44 return java.text.MessageFormat.format(text, new Object [] { arg }); 45 } 46 47 public static String getFormattedMessage(String key, String [] args) { 48 String text = getResourceString(key); 49 return java.text.MessageFormat.format(text, args); 50 } 51 52 static IPath getInstallLocation() { 53 return new Path(inst.getDescriptor().getInstallURL().getFile()); 54 } 55 56 public static String getPluginId() { 57 return inst.getDescriptor().getUniqueIdentifier(); 58 } 59 60 public static String getResourceString(String key) { 61 ResourceBundle bundle = inst.getResourceBundle(); 62 if (bundle != null) { 63 try { 64 String bundleString = bundle.getString(key); 65 return bundleString; 66 } catch (MissingResourceException e) { 67 } 68 } 69 return key; 70 } 71 72 public ResourceBundle getResourceBundle() { 73 return resourceBundle; 74 } 75 76 77 } 78 | Popular Tags |