1 package eu
.etaxonomy
.taxeditor
;
4 import java
.util
.MissingResourceException
;
5 import java
.util
.ResourceBundle
;
7 import org
.eclipse
.core
.runtime
.IPath
;
8 import org
.eclipse
.core
.runtime
.Path
;
9 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
10 import org
.eclipse
.jface
.resource
.ImageRegistry
;
11 import org
.eclipse
.swt
.graphics
.Image
;
12 import org
.eclipse
.swt
.widgets
.Display
;
13 import org
.eclipse
.ui
.forms
.FormColors
;
14 import org
.eclipse
.ui
.plugin
.AbstractUIPlugin
;
15 import org
.osgi
.framework
.BundleContext
;
18 * The activator class controls the plug-in life cycle
20 public class Activator
extends AbstractUIPlugin
{
23 public static final String PLUGIN_ID
= "eu.etaxonomy.taxeditor";
25 // The shared instance
26 private static Activator plugin
;
36 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
38 public void start(BundleContext context
) throws Exception
{
45 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
47 /*public void stop(BundleContext context) throws Exception {
53 * Returns the shared instance
55 * @return the shared instance
57 public static Activator
getDefault() {
62 * Returns an image descriptor for the image file at the given
63 * plug-in relative path
65 * @param path the path
66 * @return the image descriptor
68 public static ImageDescriptor
getImageDescriptorOrig(String path
) {
69 return imageDescriptorFromPlugin(PLUGIN_ID
, path
);
73 * EVERYTHING BELOW HERE WAS PASTED FROM FORMARTICLEPLUGIN.JAVA
76 private ResourceBundle resourceBundle
;
77 private FormColors formColors
;
78 public static final String IMG_FORM_BG
= "formBg"; //$NON-NLS-1$
79 public static final String IMG_LARGE
= "large"; //$NON-NLS-1$
80 public static final String IMG_HORIZONTAL
= "horizontal"; //$NON-NLS-1$
81 public static final String IMG_VERTICAL
= "vertical"; //$NON-NLS-1$
82 public static final String IMG_SAMPLE
= "sample"; //$NON-NLS-1$
83 public static final String IMG_WIZBAN
= "wizban"; //$NON-NLS-1$
84 public static final String IMG_LINKTO_HELP
= "linkto_help"; //$NON-NLS-1$
85 public static final String IMG_HELP_TOPIC
= "help_topic"; //$NON-NLS-1$
86 public static final String IMG_CLOSE
= "close"; //$NON-NLS-1$
88 protected void initializeImageRegistry(ImageRegistry registry
) {
89 registerImage(registry
, IMG_FORM_BG
, "form_banner.gif"); //$NON-NLS-1$
90 registerImage(registry
, IMG_LARGE
, "large_image.gif"); //$NON-NLS-1$
91 registerImage(registry
, IMG_HORIZONTAL
, "th_horizontal.gif"); //$NON-NLS-1$
92 registerImage(registry
, IMG_VERTICAL
, "th_vertical.gif"); //$NON-NLS-1$
93 registerImage(registry
, IMG_SAMPLE
, "sample.gif"); //$NON-NLS-1$
94 registerImage(registry
, IMG_WIZBAN
, "newprj_wiz.gif"); //$NON-NLS-1$
95 registerImage(registry
, IMG_LINKTO_HELP
, "linkto_help.gif"); //$NON-NLS-1$
96 registerImage(registry
, IMG_HELP_TOPIC
, "help_topic.gif"); //$NON-NLS-1$
97 registerImage(registry
, IMG_CLOSE
, "close_view.gif"); //$NON-NLS-1$
100 private void registerImage(ImageRegistry registry
, String key
,
103 IPath path
= new Path("icons/" + fileName
); //$NON-NLS-1$
104 URL url
= find(path
);
106 ImageDescriptor desc
= ImageDescriptor
.createFromURL(url
);
107 registry
.put(key
, desc
);
109 } catch (Exception e
) {
113 public FormColors
getFormColors(Display display
) {
114 if (formColors
== null) {
115 formColors
= new FormColors(display
);
116 formColors
.markShared();
121 * Returns the workspace instance.
123 /* public static IWorkspace getWorkspace() {
124 return ResourcesPlugin.getWorkspace();
127 * Returns the string from the plugin's resource bundle, or 'key' if not
130 public static String
getResourceString(String key
) {
131 ResourceBundle bundle
= Activator
.getDefault().getResourceBundle();
133 return (bundle
!= null ? bundle
.getString(key
) : key
);
134 } catch (MissingResourceException e
) {
139 * Returns the plugin's resource bundle,
141 public ResourceBundle
getResourceBundle() {
142 return resourceBundle
;
144 public void stop(BundleContext context
) throws Exception
{
147 if (formColors
!= null) {
148 formColors
.dispose();
155 public Image
getImage(String key
) {
156 return getImageRegistry().get(key
);
158 public ImageDescriptor
getImageDescriptor(String key
) {
159 return getImageRegistry().getDescriptor(key
);