| 1 | package de.uka.ipd.sdq.cip.runtime; |
| 2 | |
| 3 | import org.eclipse.jface.resource.ImageDescriptor; |
| 4 | import org.eclipse.jface.resource.ImageRegistry; |
| 5 | import org.eclipse.swt.graphics.Image; |
| 6 | |
| 7 | |
| 8 | /** |
| 9 | * The class is used for the administration the images stored in the Plug-In. |
| 10 | * |
| 11 | * @author Roman Andrej |
| 12 | * @author Thomas Schuischel |
| 13 | */ |
| 14 | public class RunConfigImages { |
| 15 | |
| 16 | /** |
| 17 | * Names of images used to represent actions in ToolBar |
| 18 | */ |
| 19 | public static final String COMPLETION_TAB = "completion_tab"; |
| 20 | public static final String FOLDER_ICON = "folder_icon"; |
| 21 | public static final String ANNOTATION_ICON = "annotation_icon"; |
| 22 | public static final String ANNOTATION_NEW_ICON = "annotation_new_icon"; |
| 23 | public static final String CHILI_ICON = "chili"; |
| 24 | |
| 25 | /** For the toolbar images */ |
| 26 | public static ImageRegistry imageRegistry = new ImageRegistry(); |
| 27 | |
| 28 | /** |
| 29 | * Note: An image registry owns all of the image objects registered with it, |
| 30 | * and automatically disposes of them the SWT Display is disposed. |
| 31 | */ |
| 32 | static { |
| 33 | String iconPath = "icons/"; |
| 34 | |
| 35 | imageRegistry.put(COMPLETION_TAB, |
| 36 | getImageDescriptor(iconPath + COMPLETION_TAB + ".gif")); |
| 37 | |
| 38 | imageRegistry.put(FOLDER_ICON, |
| 39 | getImageDescriptor(iconPath + FOLDER_ICON + ".png")); |
| 40 | |
| 41 | imageRegistry.put(ANNOTATION_ICON, |
| 42 | getImageDescriptor(iconPath + ANNOTATION_ICON + ".png")); |
| 43 | |
| 44 | imageRegistry.put(ANNOTATION_NEW_ICON, |
| 45 | getImageDescriptor(iconPath + ANNOTATION_NEW_ICON + ".png")); |
| 46 | |
| 47 | imageRegistry.put(CHILI_ICON, |
| 48 | getImageDescriptor(iconPath + CHILI_ICON + ".jpg")); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * @param imageFilePath |
| 53 | * the relative to the root of the plug-in; the path must be |
| 54 | * legal |
| 55 | * @return an image descriptor, or null if no image could be found |
| 56 | */ |
| 57 | public static ImageDescriptor getImageDescriptor(String imageFilePath) { |
| 58 | return CipRuntimePlugin.imageDescriptorFromPlugin(CipRuntimePlugin.PLUGIN_ID, imageFilePath); |
| 59 | } |
| 60 | |
| 61 | public static Image getCompletionTabImage() { |
| 62 | return imageRegistry.get(COMPLETION_TAB); |
| 63 | } |
| 64 | |
| 65 | public static Image getFileNamesTabImage() { |
| 66 | // TODO Auto-generated method stub |
| 67 | return null; |
| 68 | } |
| 69 | |
| 70 | public static Image getFolderIcon() { |
| 71 | return imageRegistry.get(FOLDER_ICON); |
| 72 | } |
| 73 | |
| 74 | public static Image getAnnotationIcon() { |
| 75 | return imageRegistry.get(ANNOTATION_ICON); |
| 76 | } |
| 77 | |
| 78 | public static Image getAnnotationNewIcon() { |
| 79 | return imageRegistry.get(ANNOTATION_NEW_ICON); |
| 80 | } |
| 81 | |
| 82 | public static ImageDescriptor getChiliIconDescriptor() { |
| 83 | return imageRegistry.getDescriptor(CHILI_ICON); |
| 84 | } |
| 85 | } |