| 1 package com.nightlabs.editor2d; 2 3 import org.eclipse.ui.plugin.*; 4 import org.osgi.framework.BundleContext; 5 import java.util.*; 6 7 10 public class EditorPlugin 11 extends AbstractUIPlugin 12 { 13 private static EditorPlugin plugin; 15 private ResourceBundle resourceBundle; 17 18 public static String PLUGIN_ID = "com.nightlabs.editor2d"; 19 20 23 public EditorPlugin() { 24 super(); 25 plugin = this; 26 try { 27 resourceBundle = ResourceBundle.getBundle("com.nightlabs.editor2d.plugin"); 28 } catch (MissingResourceException x) { 29 resourceBundle = null; 30 } 31 } 32 33 36 public void start(BundleContext context) throws Exception { 37 super.start(context); 38 } 39 40 43 public void stop(BundleContext context) throws Exception { 44 super.stop(context); 45 } 46 47 50 public static EditorPlugin getDefault() { 51 return plugin; 52 } 53 54 58 public static String getResourceString(String key) { 59 ResourceBundle bundle = EditorPlugin.getDefault().getResourceBundle(); 60 try { 61 return (bundle != null) ? bundle.getString(key) : key; 62 } catch (MissingResourceException e) { 63 return key; 64 } 65 } 66 67 70 public ResourceBundle getResourceBundle() 71 { 72 if (resourceBundle == null) 73 { 74 try { 75 resourceBundle = ResourceBundle.getBundle("com.nightlabs.editor2d.plugin"); 76 } catch (MissingResourceException x) { 77 resourceBundle = null; 78 } 79 } 80 return resourceBundle; 81 } 82 } 83 | Popular Tags |