sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.wizards/src/com/nokia/carbide/cpp/pi/wizards/WizardsPlugin.java
changeset 12 ae255c9aa552
parent 2 b9ab3b238396
--- a/sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.wizards/src/com/nokia/carbide/cpp/pi/wizards/WizardsPlugin.java	Wed Jun 23 14:49:59 2010 +0300
+++ b/sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.wizards/src/com/nokia/carbide/cpp/pi/wizards/WizardsPlugin.java	Wed Jun 23 15:05:09 2010 +0300
@@ -17,6 +17,7 @@
 
 package com.nokia.carbide.cpp.pi.wizards;
 
+import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
@@ -43,14 +44,14 @@
 	/**
 	 * This method is called upon plug-in activation
 	 */
-	public void start(BundleContext context) throws Exception {
+	public void start(final BundleContext context) throws Exception {
 		super.start(context);
 	}
 
 	/**
 	 * This method is called when the plug-in is stopped
 	 */
-	public void stop(BundleContext context) throws Exception {
+	public void stop(final BundleContext context) throws Exception {
 		super.stop(context);
 		plugin = null;
 	}
@@ -61,4 +62,23 @@
 	public static WizardsPlugin getDefault() {
 		return plugin;
 	}
+	
+	/**
+	 * Returns an image descriptor for the image file at the given plug-in
+	 * relative path.
+	 * 
+	 * @param path
+	 *            the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(final String path) {
+		ImageDescriptor descriptor = getDefault().getImageRegistry()
+				.getDescriptor(path);
+		if (descriptor == null) {
+			descriptor = ImageDescriptor.createFromURL(getDefault().getBundle()
+					.getEntry(path));
+			getDefault().getImageRegistry().put(path, descriptor);
+		}
+		return descriptor;
+	}
  }