1 | package de.uka.ipd.sdq.codegen.simucontroller; |
2 | |
3 | import org.eclipse.jface.resource.ImageDescriptor; |
4 | import org.eclipse.jface.resource.ImageRegistry; |
5 | |
6 | /** |
7 | * The class is used for the administration the images stored in the Plug-In. |
8 | * |
9 | * @author Roman Andrej |
10 | */ |
11 | public class SimuControllerImages { |
12 | |
13 | /** |
14 | * Names of images used to represent actions in ToolBar |
15 | */ |
16 | public static final String CONFIGURATION = "configuration"; |
17 | public static final String MODELS_LIST = "models_list"; |
18 | public static final String SIMU_START = "nav_start"; |
19 | public static final String SIMU_STOP = "nav_stop"; |
20 | public static final String SIMU_GENERATE = "new_plugin"; |
21 | public static final String SIMU_DELETE = "del_plugin"; |
22 | public static final String SIMUCOM_CONF = "simucom_conf"; |
23 | public static final String MASCHINE = "pc_box2"; |
24 | public static final String MASCHINE_BUSY = "screen_blue"; |
25 | public static final String MASCHINE_PAUSE = "screen_pause"; |
26 | |
27 | // For the toolbar images |
28 | public static ImageRegistry imageRegistry = new ImageRegistry(); |
29 | |
30 | /** |
31 | * Note: An image registry owns all of the image objects registered with it, |
32 | * and automatically disposes of them the SWT Display is disposed. |
33 | */ |
34 | |
35 | static { |
36 | String iconPath = "icons/"; |
37 | |
38 | imageRegistry.put(MASCHINE, |
39 | getImageDescriptor(iconPath + MASCHINE + ".gif") |
40 | ); |
41 | |
42 | imageRegistry.put(MASCHINE_BUSY, |
43 | getImageDescriptor(iconPath + MASCHINE_BUSY + ".gif") |
44 | ); |
45 | |
46 | imageRegistry.put(MASCHINE_PAUSE, |
47 | getImageDescriptor(iconPath + MASCHINE_PAUSE + ".gif") |
48 | ); |
49 | |
50 | imageRegistry.put(CONFIGURATION, |
51 | getImageDescriptor(iconPath + CONFIGURATION + ".gif") |
52 | ); |
53 | |
54 | imageRegistry.put(MODELS_LIST, |
55 | getImageDescriptor(iconPath + MODELS_LIST + ".gif") |
56 | ); |
57 | imageRegistry.put(SIMU_START, |
58 | getImageDescriptor(iconPath + SIMU_START + ".gif") |
59 | ); |
60 | imageRegistry.put(SIMU_STOP, |
61 | getImageDescriptor(iconPath + SIMU_STOP + ".gif") |
62 | ); |
63 | imageRegistry.put(SIMU_GENERATE, |
64 | getImageDescriptor(iconPath + SIMU_GENERATE + ".gif") |
65 | ); |
66 | imageRegistry.put(SIMU_DELETE, |
67 | getImageDescriptor(iconPath + SIMU_DELETE + ".gif") |
68 | ); |
69 | imageRegistry.put(SIMUCOM_CONF, |
70 | getImageDescriptor(iconPath + SIMUCOM_CONF + ".gif") |
71 | ); |
72 | } |
73 | |
74 | /** |
75 | * @param imageFilePath |
76 | * the relative to the root of the plug-in; the path must be |
77 | * legal |
78 | * @return an image descriptor, or null if no image could be found |
79 | */ |
80 | public static ImageDescriptor getImageDescriptor(String imageFilePath) { |
81 | return SimuControllerPlugin.imageDescriptorFromPlugin( |
82 | SimuControllerPlugin.PLUGIN_ID, imageFilePath); |
83 | } |
84 | } |