a49505ec23eaddc53f357d8055a7147535afc4d4
[phpeclipse.git] /
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.debug.core;
12
13 import java.net.MalformedURLException;
14 import java.net.URL;
15
16 import org.eclipse.jface.resource.ImageDescriptor;
17 import org.eclipse.jface.resource.ImageRegistry;
18 import org.eclipse.swt.graphics.Image;
19
20 public class PHPDegugCorePluginImages {
21
22         private final static URL BASE_URL =
23                 PHPDebugCorePlugin.getDefault().getDescriptor().getInstallURL();
24         private final static ImageRegistry PLUGIN_REGISTRY =
25                 PHPDebugCorePlugin.getDefault().getImageRegistry();
26
27         public final static String ICONS_PATH = "icons/"; //$NON-NLS-1$
28
29         private static final String PATH_OBJ = ICONS_PATH + "obj16/"; //$NON-NLS-1$
30         private static final String PATH_LCL = ICONS_PATH + "elcl16/"; //$NON-NLS-1$
31         private static final String PATH_LCL_DISABLED = ICONS_PATH + "dlcl16/"; //$NON-NLS-1$
32         private static final String PATH_OVR = ICONS_PATH + "ovr16/"; //$NON-NLS-1$
33         private static final String PATH_EVENTS = ICONS_PATH + "eview16/"; //$NON-NLS-1$
34
35
36         public static final ImageDescriptor DESC_ERROR_ST_OBJ =
37                 create(PATH_OBJ, "error_st_obj.gif"); //$NON-NLS-1$
38         public static final ImageDescriptor DESC_ERROR_STACK_OBJ =
39                 create(PATH_OBJ, "error_stack.gif"); //$NON-NLS-1$
40         public static final ImageDescriptor DESC_EXT_POINT_OBJ =
41                 create(PATH_OBJ, "ext_point_obj.gif"); //$NON-NLS-1$
42         public static final ImageDescriptor DESC_EXT_POINTS_OBJ =
43                 create(PATH_OBJ, "ext_points_obj.gif"); //$NON-NLS-1$
44         public static final ImageDescriptor DESC_EXTENSION_OBJ =
45                 create(PATH_OBJ, "extension_obj.gif"); //$NON-NLS-1$
46         public static final ImageDescriptor DESC_EXTENSIONS_OBJ =
47                 create(PATH_OBJ, "extensions_obj.gif"); //$NON-NLS-1$
48         public static final ImageDescriptor DESC_GENERIC_XML_OBJ =
49                 create(PATH_OBJ, "generic_xml_obj.gif"); //$NON-NLS-1$
50         public static final ImageDescriptor DESC_INFO_ST_OBJ =
51                 create(PATH_OBJ, "info_st_obj.gif"); //$NON-NLS-1$
52         public static final ImageDescriptor DESC_JAVA_LIB_OBJ =
53                 create(PATH_OBJ, "java_lib_obj.gif"); //$NON-NLS-1$
54         public static final ImageDescriptor DESC_NATIVE_LIB_OBJ =
55                 create(PATH_OBJ, "native_lib_obj.gif"); //$NON-NLS-1$
56         public static final ImageDescriptor DESC_OK_ST_OBJ =
57                 create(PATH_OBJ, "ok_st_obj.gif"); //$NON-NLS-1$
58         public static final ImageDescriptor DESC_PLUGIN_OBJ =
59                 create(PATH_OBJ, "plugin_obj.gif"); //$NON-NLS-1$
60         public static final ImageDescriptor DESC_REQ_PLUGIN_OBJ =
61                 create(PATH_OBJ, "req_plugin_obj.gif"); //$NON-NLS-1$
62         public static final ImageDescriptor DESC_REQ_PLUGINS_OBJ =
63                 create(PATH_OBJ, "req_plugins_obj.gif"); //$NON-NLS-1$
64         public static final ImageDescriptor DESC_RUNTIME_OBJ =
65                 create(PATH_OBJ, "runtime_obj.gif"); //$NON-NLS-1$
66         public static final ImageDescriptor DESC_WARNING_ST_OBJ =
67                 create(PATH_OBJ, "warning_st_obj.gif"); //$NON-NLS-1$
68
69         /*
70          * Local tool bar image descriptors
71          */
72
73         public static final ImageDescriptor DESC_PROPERTIES =
74                 create(PATH_LCL, "properties.gif"); //$NON-NLS-1$
75         public static final ImageDescriptor DESC_OPEN_LOG =
76                 create(PATH_LCL, "open_log.gif"); //$NON-NLS-1$
77         public static final ImageDescriptor DESC_OPEN_LOG_DISABLED =
78                 create(PATH_LCL_DISABLED, "open_log.gif"); //$NON-NLS-1$
79
80         public static final ImageDescriptor DESC_PROPERTIES_DISABLED =
81                 create(PATH_LCL_DISABLED, "properties.gif"); //$NON-NLS-1$
82         public static final ImageDescriptor DESC_REFRESH =
83                 create(PATH_LCL, "refresh.gif"); //$NON-NLS-1$
84         public static final ImageDescriptor DESC_REFRESH_DISABLED =
85                 create(PATH_LCL_DISABLED, "refresh.gif"); //$NON-NLS-1$
86         public static final ImageDescriptor DESC_CLEAR = create(PATH_LCL, "clear.gif"); //$NON-NLS-1$
87         public static final ImageDescriptor DESC_CLEAR_DISABLED =
88                 create(PATH_LCL_DISABLED, "clear.gif"); //$NON-NLS-1$
89
90         public static final ImageDescriptor DESC_READ_LOG =
91                 create(PATH_LCL, "restore_log.gif"); //$NON-NLS-1$
92         public static final ImageDescriptor DESC_READ_LOG_DISABLED =
93                 create(PATH_LCL_DISABLED, "restore_log.gif"); //$NON-NLS-1$
94                 
95         public static final ImageDescriptor DESC_REMOVE_LOG =
96                 create(PATH_LCL, "remove.gif"); //$NON-NLS-1$
97         public static final ImageDescriptor DESC_REMOVE_LOG_DISABLED =
98                 create(PATH_LCL_DISABLED, "remove.gif"); //$NON-NLS-1$
99                 
100         public static final ImageDescriptor DESC_FILTER =
101                 create(PATH_LCL, "filter_ps.gif"); //$NON-NLS-1$
102         public static final ImageDescriptor DESC_FILTER_DISABLED =
103                 create(PATH_LCL_DISABLED, "filter_ps.gif"); //$NON-NLS-1$
104
105         public static final ImageDescriptor DESC_EXPORT =
106                 create(PATH_LCL, "export_log.gif"); //$NON-NLS-1$
107         public static final ImageDescriptor DESC_EXPORT_DISABLED =
108                 create(PATH_LCL_DISABLED, "export_log.gif"); //$NON-NLS-1$
109                 
110         public static final ImageDescriptor DESC_IMPORT =
111                 create(PATH_LCL, "import_log.gif"); //$NON-NLS-1$
112         public static final ImageDescriptor DESC_IMPORT_DISABLED =
113                 create(PATH_LCL_DISABLED, "import_log.gif"); //$NON-NLS-1$
114         
115         public static final ImageDescriptor DESC_COLLAPSE_ALL =
116                 create(PATH_LCL, "collapseall.gif"); //$NON-NLS-1$
117         
118         public static final ImageDescriptor DESC_HORIZONTAL_VIEW =
119                 create(PATH_LCL, "th_horizontal.gif"); //$NON-NLS-1$
120         
121         public static final ImageDescriptor DESC_HORIZONTAL_VIEW_DISABLED = 
122                 create(PATH_LCL_DISABLED, "th_horizontal.gif"); //$NON-NLS-1$
123         
124         public static final ImageDescriptor DESC_VERTICAL_VIEW =
125                 create(PATH_LCL, "th_vertical.gif"); //$NON-NLS-1$
126         
127         public static final ImageDescriptor DESC_VERTICAL_VIEW_DISABLED = 
128                 create(PATH_LCL_DISABLED, "th_vertical.gif"); //$NON-NLS-1$
129         
130         public static final ImageDescriptor DESC_HIDE_PANE =
131                 create(PATH_EVENTS, "hide_pane.gif"); //$NON-NLS-1$
132         
133         /*
134          * Event Details
135          */
136         public static final ImageDescriptor DESC_PREV_EVENT =
137                 create(PATH_EVENTS, "event_prev.gif"); //$NON-NLS-1$
138         public static final ImageDescriptor DESC_NEXT_EVENT = 
139                 create(PATH_EVENTS, "event_next.gif"); //$NON-NLS-1$
140         /*
141          * Overlays
142          */
143         public static final ImageDescriptor DESC_RUN_CO =
144                 create(PATH_OVR, "run_co.gif"); //$NON-NLS-1$
145
146         private static ImageDescriptor create(String prefix, String name) {
147                 return ImageDescriptor.createFromURL(makeIconURL(prefix, name));
148         }
149
150         public static Image get(String key) {
151                 return PLUGIN_REGISTRY.get(key);
152         }
153         private static URL makeIconURL(String prefix, String name) {
154                 String path = prefix + name;
155                 URL url = null;
156                 try {
157                         url = new URL(BASE_URL, path);
158                 } catch (MalformedURLException e) {
159                         return null;
160                 }
161                 return url;
162         }
163         public static Image manage(String key, ImageDescriptor desc) {
164                 Image image = desc.createImage();
165                 PLUGIN_REGISTRY.put(key, image);
166                 return image;
167         }
168 }