Icons.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.viewer.resources;
00002 
00003 import java.util.concurrent.atomic.AtomicBoolean;
00004 
00005 import org.eclipse.jface.resource.ImageRegistry;
00006 import org.eclipse.swt.graphics.Image;
00007 import org.eclipse.ui.plugin.AbstractUIPlugin;
00008 
00009 import edu.rice.cs.hpc.common.ui.BaseIconManager;
00010 import edu.rice.cs.hpc.viewer.framework.Activator;
00011 
00017 public class Icons  extends BaseIconManager
00018 {
00019     final static public String Image_CallFrom = "CallFrom.gif";
00020     final static public String Image_CallTo = "CallTo.gif";
00021     final static public String Image_CallFromDisabled = "CallFromDisabled.gif";
00022     final static public String Image_CallToDisabled = "CallToDisabled.gif";
00023     
00024     final static public String Image_InlineFrom = "CallFromInline.gif";
00025     final static public String Image_InlineTo = "CallToInline.gif";
00026     final static public String Image_InlineFromDisabled = "CallFromInlineDisabled.gif";
00027     final static public String Image_InlineToDisabled = "CallToInlineDisabled.gif";
00028     
00029     final static public String Image_ZoomIn = "ZoomIn.gif";
00030     final static public String Image_ZoomOut = "ZoomOut.gif";
00031     final static public String Image_Flatten = "Flatten.gif";
00032     final static public String Image_Unflatten = "Unflatten.gif";
00033     
00034     final static public String Image_CheckColumns = "checkColumns.gif";
00035     final static public String Image_FlameIcon = "flameIcon.gif";
00036     
00037     final static public String Image_FnMetric = "FnMetric.gif";
00038     final static public String Image_FontBigger = "FontBigger.gif";
00039     final static public String Image_FontSmaller = "FontSmaller.gif";
00040     final static public String Image_SaveCSV = "savecsv.gif";
00041     final static public String Image_Graph = "Graph.png";
00042     
00043     static private Icons __singleton=null;
00044     static private final AtomicBoolean isInitialized = new AtomicBoolean(false);
00045     
00046     /********
00047      * get the instance of the current icons class
00048      * We just want to make sure only ONE initialization for 
00049      * image creation and registration for each class.
00050      * 
00051      * Although initialization for each object doesn't harm, but
00052      * it's useless and time consuming 
00053      * 
00054      * @return
00055      ********/
00056     static public Icons getInstance() {
00057         if (Icons.__singleton == null) {
00058             Icons.__singleton = new Icons();
00059         }
00060         return Icons.__singleton;
00061     }   
00062     
00063     /*************
00064      * initialize images. The method only needs to be called once for the whole
00065      * window lifespan. Athough calling this multiple times is theoretically
00066      * harmless (never tried).
00067      * 
00068      * @param registry
00069      *************/
00070     public void init(ImageRegistry registry) {
00071         
00072         if (isInitialized.compareAndSet(false, true)) {
00073             registerImage(registry, getClass(), Image_CallFrom);
00074             registerImage(registry, getClass(), Image_CallTo);
00075             registerImage(registry, getClass(), Image_CallFromDisabled);
00076             registerImage(registry, getClass(), Image_CallToDisabled);
00077             
00078             registerImage(registry, getClass(), Image_InlineFrom);
00079             registerImage(registry, getClass(), Image_InlineTo);
00080             registerImage(registry, getClass(), Image_InlineFromDisabled);
00081             registerImage(registry, getClass(), Image_InlineToDisabled);
00082             
00083             registerImage(registry, getClass(), Image_ZoomIn);
00084             registerImage(registry, getClass(), Image_ZoomOut);
00085             registerImage(registry, getClass(), Image_Flatten);
00086             registerImage(registry, getClass(), Image_Unflatten);
00087             
00088             registerImage(registry, getClass(), Image_CheckColumns);
00089             registerImage(registry, getClass(), Image_FlameIcon);
00090 
00091             registerImage(registry, getClass(), Image_FnMetric);
00092             registerImage(registry, getClass(), Image_FontBigger);
00093             registerImage(registry, getClass(), Image_FontSmaller);
00094             registerImage(registry, getClass(), Image_SaveCSV);
00095             registerImage(registry, getClass(), Image_Graph);
00096         }
00097     }
00098     
00099     
00100     static public Image getImage(final String desc) {
00101         AbstractUIPlugin plugin = Activator.getDefault();
00102         return getImage(plugin, desc);
00103     }
00104 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1