sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.wizards/src/com/nokia/carbide/cpp/pi/wizards/WizardsPlugin.java
changeset 12 ae255c9aa552
parent 2 b9ab3b238396
equal deleted inserted replaced
11:5b9d4d8641ce 12:ae255c9aa552
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 package com.nokia.carbide.cpp.pi.wizards;
    18 package com.nokia.carbide.cpp.pi.wizards;
    19 
    19 
       
    20 import org.eclipse.jface.resource.ImageDescriptor;
    20 import org.eclipse.ui.plugin.AbstractUIPlugin;
    21 import org.eclipse.ui.plugin.AbstractUIPlugin;
    21 import org.osgi.framework.BundleContext;
    22 import org.osgi.framework.BundleContext;
    22 
    23 
    23 /**
    24 /**
    24  * The main plugin class to be used in the desktop.
    25  * The main plugin class to be used in the desktop.
    41 	}
    42 	}
    42 
    43 
    43 	/**
    44 	/**
    44 	 * This method is called upon plug-in activation
    45 	 * This method is called upon plug-in activation
    45 	 */
    46 	 */
    46 	public void start(BundleContext context) throws Exception {
    47 	public void start(final BundleContext context) throws Exception {
    47 		super.start(context);
    48 		super.start(context);
    48 	}
    49 	}
    49 
    50 
    50 	/**
    51 	/**
    51 	 * This method is called when the plug-in is stopped
    52 	 * This method is called when the plug-in is stopped
    52 	 */
    53 	 */
    53 	public void stop(BundleContext context) throws Exception {
    54 	public void stop(final BundleContext context) throws Exception {
    54 		super.stop(context);
    55 		super.stop(context);
    55 		plugin = null;
    56 		plugin = null;
    56 	}
    57 	}
    57 
    58 
    58 	/**
    59 	/**
    59 	 * Returns the shared instance.
    60 	 * Returns the shared instance.
    60 	 */
    61 	 */
    61 	public static WizardsPlugin getDefault() {
    62 	public static WizardsPlugin getDefault() {
    62 		return plugin;
    63 		return plugin;
    63 	}
    64 	}
       
    65 	
       
    66 	/**
       
    67 	 * Returns an image descriptor for the image file at the given plug-in
       
    68 	 * relative path.
       
    69 	 * 
       
    70 	 * @param path
       
    71 	 *            the path
       
    72 	 * @return the image descriptor
       
    73 	 */
       
    74 	public static ImageDescriptor getImageDescriptor(final String path) {
       
    75 		ImageDescriptor descriptor = getDefault().getImageRegistry()
       
    76 				.getDescriptor(path);
       
    77 		if (descriptor == null) {
       
    78 			descriptor = ImageDescriptor.createFromURL(getDefault().getBundle()
       
    79 					.getEntry(path));
       
    80 			getDefault().getImageRegistry().put(path, descriptor);
       
    81 		}
       
    82 		return descriptor;
       
    83 	}
    64  }
    84  }