01: package com.quantum.flatfiles;
02:
03: import java.net.MalformedURLException;
04: import java.net.URL;
05:
06: import org.eclipse.core.runtime.IPluginDescriptor;
07: import org.eclipse.jface.resource.ImageRegistry;
08: import org.eclipse.ui.plugin.AbstractUIPlugin;
09:
10: /**
11: *
12: * @author BC Holmes
13: */
14: public class QuantumFlatFilesPlugin extends AbstractUIPlugin {
15:
16: protected static AbstractUIPlugin plugin;
17:
18: /**
19: *
20: * TODO: BCH - this constructor has changed in Eclipse 3.0. This
21: * old version of the constructor is still necessary for running under
22: * Eclipse 2.x.
23: *
24: * @param descriptor
25: */
26: public QuantumFlatFilesPlugin(IPluginDescriptor descriptor) {
27: super (descriptor);
28: plugin = this ;
29: }
30:
31: /**
32: * This version will be invoked by 3.0
33: * In 2.x it will appear with an error, but won't matter as won't be ever called. Can be commented in 2.x
34: */
35: public QuantumFlatFilesPlugin() {
36: super ();
37: plugin = this ;
38: }
39:
40: public static AbstractUIPlugin getDefault() {
41: return QuantumFlatFilesPlugin.plugin;
42: }
43:
44: protected void initializeImageRegistry(ImageRegistry registry) {
45: super .initializeImageRegistry(registry);
46: try {
47: ImageStoreInitializer.initialize(this , getIconLocation());
48: } catch (MalformedURLException e) {
49: // this should never happen, but if it does, we don't get images.
50: }
51: }
52:
53: /**
54: * @return
55: * @throws MalformedURLException
56: */
57: private URL getIconLocation() throws MalformedURLException {
58: // For 2.x
59: //URL installURL = QuantumFlatFilesPlugin.getDefault().getDescriptor().getInstallURL();
60: // For 3.x
61: URL installURL = getBundle().getEntry("/");
62: return new URL(installURL, "icons/");
63: }
64:
65: }
|