X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=analysis%2Forg.eclipse.tracecompass.analysis.timing.ui%2Fsrc%2Forg%2Feclipse%2Ftracecompass%2Finternal%2Fanalysis%2Ftiming%2Fui%2FActivator.java;h=ec79c2ae768d883803f1ca79f763fd31084d44e3;hb=b23cbbfcdd55a705aa3d072b40738ad4457bcfed;hp=3fa42809cd1437c885ee9be75ac75f32303b5ab2;hpb=7ab857a16bf288869c82b1561788790ec98e0e18;p=deliverable%2Ftracecompass.git diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/Activator.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/Activator.java index 3fa42809cd..ec79c2ae76 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/Activator.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/Activator.java @@ -11,6 +11,8 @@ package org.eclipse.tracecompass.internal.analysis.timing.ui; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -43,6 +45,44 @@ public class Activator extends AbstractUIPlugin { super.stop(context); } + /** + * Get the image object from a given path + * + * @param path + * The path to the image file + * @return The Image object + */ + public Image getImageFromPath(String path) { + return getImageDescripterFromPath(path).createImage(); + } + + /** + * Get the ImageDescriptor from a given path + * + * @param path + * The path to the image file + * @return The ImageDescriptor object + */ + public ImageDescriptor getImageDescripterFromPath(String path) { + return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + /** + * Get the Image from a registry + * + * @param path + * The path to the image registry + * @return The Image object + */ + public Image getImageFromImageRegistry(String path) { + Image icon = getImageRegistry().get(path); + if (icon == null) { + icon = getImageDescripterFromPath(path).createImage(); + plugin.getImageRegistry().put(path, icon); + } + return icon; + } + /** * Returns the shared instance *