1 package org.hibernate.eclipse.help; 2 3 4 import java.util.MissingResourceException ; 5 import java.util.ResourceBundle ; 6 7 import org.eclipse.ui.plugin.AbstractUIPlugin; 8 import org.osgi.framework.BundleContext; 9 10 11 14 public class HelpPlugin extends AbstractUIPlugin { 15 private static HelpPlugin plugin; 17 private ResourceBundle resourceBundle; 19 20 23 public HelpPlugin() { 24 super(); 25 plugin = this; 26 } 27 28 31 public void start(BundleContext context) throws Exception { 32 super.start(context); 33 } 34 35 38 public void stop(BundleContext context) throws Exception { 39 super.stop(context); 40 plugin = null; 41 resourceBundle = null; 42 } 43 44 47 public static HelpPlugin getDefault() { 48 return plugin; 49 } 50 51 55 public static String getResourceString(String key) { 56 ResourceBundle bundle = HelpPlugin.getDefault().getResourceBundle(); 57 try { 58 return (bundle != null) ? bundle.getString(key) : key; 59 } catch (MissingResourceException e) { 60 return key; 61 } 62 } 63 64 67 public ResourceBundle getResourceBundle() { 68 try { 69 if (resourceBundle == null) 70 resourceBundle = ResourceBundle.getBundle("org.hibernate.eclipse.help2.Help2PluginResources"); 71 } catch (MissingResourceException x) { 72 resourceBundle = null; 73 } 74 return resourceBundle; 75 } 76 } 77 | Popular Tags |