1 | package de.uka.ipd.sdq.pcm.dialogs; |
2 | |
3 | import org.eclipse.jface.resource.ImageDescriptor; |
4 | import org.eclipse.jface.resource.ImageRegistry; |
5 | import org.eclipse.ui.plugin.AbstractUIPlugin; |
6 | |
7 | /** |
8 | * @author roman Compilation of the pictures used in |
9 | * de.uka.ipd.sdq.dialogs-Plugin |
10 | */ |
11 | public class DialogsImages { |
12 | |
13 | /** |
14 | * Names of images used to represent actions in ToolBar |
15 | */ |
16 | public static final String ADD = "add_action"; |
17 | public static final String DELETE = "delete_action"; |
18 | public static final String UP = "up_action"; |
19 | public static final String DOWN = "down_action"; |
20 | public static final String ERROR = "error"; |
21 | public static final String WARNING = "warning"; |
22 | |
23 | public static ImageRegistry imageRegistry = new ImageRegistry(); |
24 | |
25 | /** |
26 | * Note: An image registry owns all of the image objects registered with it, |
27 | * and automatically disposes of them the SWT Display is disposed. |
28 | */ |
29 | static { |
30 | String iconPath = "icons/"; |
31 | |
32 | imageRegistry.put(ADD, getImageDescriptor(iconPath + ADD + ".gif")); |
33 | |
34 | imageRegistry.put(DELETE, |
35 | getImageDescriptor(iconPath + DELETE + ".gif")); |
36 | imageRegistry.put(DOWN, getImageDescriptor(iconPath + DOWN + ".gif")); |
37 | imageRegistry.put(UP, getImageDescriptor(iconPath + UP + ".gif")); |
38 | imageRegistry.put(ERROR, |
39 | getImageDescriptor(iconPath + ERROR + ".gif")); |
40 | imageRegistry.put(WARNING, |
41 | getImageDescriptor(iconPath + WARNING + ".gif")); |
42 | } |
43 | |
44 | /** |
45 | * @param imageFilePath |
46 | * the relative to the root of the plug-in; the path must be |
47 | * legal |
48 | * @return an image descriptor, or null if no image could be found |
49 | */ |
50 | public static ImageDescriptor getImageDescriptor(String imageFilePath) { |
51 | return AbstractUIPlugin.imageDescriptorFromPlugin( |
52 | PCMDialogPluginActivator.PLUGIN_ID, imageFilePath); |
53 | } |
54 | |
55 | } |