1 package com.nightlabs.base; 2 3 import org.eclipse.ui.plugin.*; 4 import org.osgi.framework.BundleContext; 5 import java.util.*; 6 7 10 public class NLBasePlugin extends AbstractUIPlugin { 11 private static NLBasePlugin plugin; 13 private ResourceBundle resourceBundle; 15 16 19 public NLBasePlugin() { 20 super(); 21 plugin = this; 22 try { 23 resourceBundle = ResourceBundle.getBundle("com.nightlabs.base.plugin"); 24 } catch (MissingResourceException x) { 25 resourceBundle = null; 26 } 27 } 28 29 32 public void start(BundleContext context) throws Exception { 33 super.start(context); 34 } 35 36 39 public void stop(BundleContext context) throws Exception { 40 super.stop(context); 41 } 42 43 46 public static NLBasePlugin getDefault() { 47 return plugin; 48 } 49 50 54 public static String getResourceString(String key) { 55 ResourceBundle bundle = NLBasePlugin.getDefault().getResourceBundle(); 56 try { 57 return (bundle != null) ? bundle.getString(key) : key; 58 } catch (MissingResourceException e) { 59 return key; 60 } 61 } 62 63 66 public ResourceBundle getResourceBundle() { 67 return resourceBundle; 68 } 69 } 70 | Popular Tags |