1 27 28 package org.nightlabs.editor2d; 29 30 import org.eclipse.core.runtime.Platform; 31 import org.eclipse.ui.plugin.*; 32 import org.osgi.framework.BundleContext; 33 import java.util.*; 34 35 38 public class EditorPlugin 39 extends AbstractUIPlugin 40 { 41 private static EditorPlugin plugin; 43 private static ResourceBundle resourceBundle; 45 46 public static String PLUGIN_ID = "org.nightlabs.editor2d"; 47 48 51 public EditorPlugin() 52 { 53 super(); 54 plugin = this; 55 } 56 57 60 public void start(BundleContext context) throws Exception 61 { 62 super.start(context); 63 resourceBundle = Platform.getResourceBundle(getBundle()); 64 } 65 66 69 public void stop(BundleContext context) throws Exception 70 { 71 super.stop(context); 72 plugin = null; 73 resourceBundle = null; 74 } 75 76 79 public static EditorPlugin getDefault() { 80 return plugin; 81 } 82 83 90 public static String getResourceString(String key) { 91 try { 92 return resourceBundle.getString(key); 93 } catch (Exception e) { 94 return key; 95 } 96 } 97 98 104 public ResourceBundle getResourceBundle() { 105 return resourceBundle; 106 } 107 108 } 137 | Popular Tags |