re-factoring - removed dependencies on Image related class
diff --git a/2.0/plugins/org.eclipse.epf.common/META-INF/MANIFEST.MF b/2.0/plugins/org.eclipse.epf.common/META-INF/MANIFEST.MF
index a86e03b..8d78a6e 100644
--- a/2.0/plugins/org.eclipse.epf.common/META-INF/MANIFEST.MF
+++ b/2.0/plugins/org.eclipse.epf.common/META-INF/MANIFEST.MF
@@ -20,6 +20,4 @@
org.eclipse.epf.common.utils,
org.eclipse.epf.common.xml
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Import-Package: org.eclipse.jface.resource,
- org.eclipse.swt.graphics
diff --git a/2.0/plugins/org.eclipse.epf.common/src/org/eclipse/epf/common/AbstractActivator.java b/2.0/plugins/org.eclipse.epf.common/src/org/eclipse/epf/common/AbstractActivator.java
index 87a072e..a685937 100644
--- a/2.0/plugins/org.eclipse.epf.common/src/org/eclipse/epf/common/AbstractActivator.java
+++ b/2.0/plugins/org.eclipse.epf.common/src/org/eclipse/epf/common/AbstractActivator.java
@@ -13,7 +13,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.text.MessageFormat;
@@ -35,8 +34,6 @@
import org.eclipse.epf.common.serviceability.Logger;
import org.eclipse.epf.common.utils.FileUtil;
import org.eclipse.epf.common.utils.I18nUtil;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -59,7 +56,7 @@
//private static Map<String, MsgDialog> msgDialogs = new HashMap<String, MsgDialog>();
// The shared image hash map.
- private static Map<String, Image> sharedImages = new HashMap<String, Image>();
+ //private static Map<String, Image> sharedImages = new HashMap<String, Image>();
// The resource bundle for this plug-in.
private ResourceBundle resourceBundle;
@@ -105,13 +102,13 @@
*/
public void stop(BundleContext context) throws Exception {
// Free the shared images.
- for (Iterator images = sharedImages.values().iterator(); images
- .hasNext();) {
- Image image = (Image) images.next();
- if (image != null && !image.isDisposed()) {
- image.dispose();
- }
- }
+// for (Iterator images = sharedImages.values().iterator(); images
+// .hasNext();) {
+// Image image = (Image) images.next();
+// if (image != null && !image.isDisposed()) {
+// image.dispose();
+// }
+// }
super.stop(context);
@@ -404,68 +401,68 @@
}
}
- /**
- * Returns the image descriptor given the relative path.
- *
- * @param relativePath
- * The image's path relative to the plug-in's root.
- * @return The image descriptor.
- */
- public ImageDescriptor getImageDescriptor(String relativePath) {
- try {
- URL url = new URL(iconURL, relativePath);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- return ImageDescriptor.getMissingImageDescriptor();
- }
- }
-
- /**
- * Returns the image given the relative path.
- * <p>
- * Note: The returned image need to be freed by the caller.
- *
- * @param relativePath
- * The image's path relative to the plug-in's root.
- * @return The image.
- */
- public Image getImage(String relativePath) {
- Image image = null;
-
- ImageDescriptor imageDescriptor = getImageDescriptor(relativePath);
- if (imageDescriptor != null) {
- image = imageDescriptor.createImage(false);
- }
-
- return image;
- }
-
- /**
- * Returns the shared image given the relative path.
- * <p>
- * Note: The returned image will be automatically freed when the plug-in
- * shuts down.
- *
- * @param relativePath
- * The image's path relative to the plug-in's root.
- * @return The image.
- */
- public Image getSharedImage(String relativePath) {
- Image image = (Image) sharedImages.get(relativePath);
- if (image != null) {
- return image;
- }
-
- ImageDescriptor imageDescriptor = getImageDescriptor(relativePath);
- if (imageDescriptor != null) {
- image = imageDescriptor.createImage(false);
- if (image != null) {
- sharedImages.put(relativePath, image);
- }
- }
-
- return image;
- }
+// /**
+// * Returns the image descriptor given the relative path.
+// *
+// * @param relativePath
+// * The image's path relative to the plug-in's root.
+// * @return The image descriptor.
+// */
+// public ImageDescriptor getImageDescriptor(String relativePath) {
+// try {
+// URL url = new URL(iconURL, relativePath);
+// return ImageDescriptor.createFromURL(url);
+// } catch (MalformedURLException e) {
+// return ImageDescriptor.getMissingImageDescriptor();
+// }
+// }
+//
+// /**
+// * Returns the image given the relative path.
+// * <p>
+// * Note: The returned image need to be freed by the caller.
+// *
+// * @param relativePath
+// * The image's path relative to the plug-in's root.
+// * @return The image.
+// */
+// public Image getImage(String relativePath) {
+// Image image = null;
+//
+// ImageDescriptor imageDescriptor = getImageDescriptor(relativePath);
+// if (imageDescriptor != null) {
+// image = imageDescriptor.createImage(false);
+// }
+//
+// return image;
+// }
+//
+// /**
+// * Returns the shared image given the relative path.
+// * <p>
+// * Note: The returned image will be automatically freed when the plug-in
+// * shuts down.
+// *
+// * @param relativePath
+// * The image's path relative to the plug-in's root.
+// * @return The image.
+// */
+// public Image getSharedImage(String relativePath) {
+// Image image = (Image) sharedImages.get(relativePath);
+// if (image != null) {
+// return image;
+// }
+//
+// ImageDescriptor imageDescriptor = getImageDescriptor(relativePath);
+// if (imageDescriptor != null) {
+// image = imageDescriptor.createImage(false);
+// if (image != null) {
+// sharedImages.put(relativePath, image);
+// }
+// }
+//
+// return image;
+// }
/**
* Returns the profiling flag.