cb042db529bd1a62e90fb72bbfb8b3cdeba335f9
[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 = PHPDebugCorePlugin.getDefault()
23                         .getBundle().getEntry("/");
24
25         private final static ImageRegistry PLUGIN_REGISTRY = PHPDebugCorePlugin
26                         .getDefault().getImageRegistry();
27
28         public final static String ICONS_PATH = "icons/"; //$NON-NLS-1$
29
30         private static final String PATH_OBJ = ICONS_PATH + "obj16/"; //$NON-NLS-1$
31
32         private static final String PATH_LCL = ICONS_PATH + "elcl16/"; //$NON-NLS-1$
33
34         private static final String PATH_LCL_DISABLED = ICONS_PATH + "dlcl16/"; //$NON-NLS-1$
35
36         private static final String PATH_OVR = ICONS_PATH + "ovr16/"; //$NON-NLS-1$
37
38         private static final String PATH_EVENTS = ICONS_PATH + "eview16/"; //$NON-NLS-1$
39
40         public static final ImageDescriptor DESC_ERROR_ST_OBJ = create(PATH_OBJ,
41                         "error_st_obj.gif"); //$NON-NLS-1$
42
43         public static final ImageDescriptor DESC_ERROR_STACK_OBJ = create(PATH_OBJ,
44                         "error_stack.gif"); //$NON-NLS-1$
45
46         public static final ImageDescriptor DESC_EXT_POINT_OBJ = create(PATH_OBJ,
47                         "ext_point_obj.gif"); //$NON-NLS-1$
48
49         public static final ImageDescriptor DESC_EXT_POINTS_OBJ = create(PATH_OBJ,
50                         "ext_points_obj.gif"); //$NON-NLS-1$
51
52         public static final ImageDescriptor DESC_EXTENSION_OBJ = create(PATH_OBJ,
53                         "extension_obj.gif"); //$NON-NLS-1$
54
55         public static final ImageDescriptor DESC_EXTENSIONS_OBJ = create(PATH_OBJ,
56                         "extensions_obj.gif"); //$NON-NLS-1$
57
58         public static final ImageDescriptor DESC_GENERIC_XML_OBJ = create(PATH_OBJ,
59                         "generic_xml_obj.gif"); //$NON-NLS-1$
60
61         public static final ImageDescriptor DESC_INFO_ST_OBJ = create(PATH_OBJ,
62                         "info_st_obj.gif"); //$NON-NLS-1$
63
64         public static final ImageDescriptor DESC_JAVA_LIB_OBJ = create(PATH_OBJ,
65                         "java_lib_obj.gif"); //$NON-NLS-1$
66
67         public static final ImageDescriptor DESC_NATIVE_LIB_OBJ = create(PATH_OBJ,
68                         "native_lib_obj.gif"); //$NON-NLS-1$
69
70         public static final ImageDescriptor DESC_OK_ST_OBJ = create(PATH_OBJ,
71                         "ok_st_obj.gif"); //$NON-NLS-1$
72
73         public static final ImageDescriptor DESC_PLUGIN_OBJ = create(PATH_OBJ,
74                         "plugin_obj.gif"); //$NON-NLS-1$
75
76         public static final ImageDescriptor DESC_REQ_PLUGIN_OBJ = create(PATH_OBJ,
77                         "req_plugin_obj.gif"); //$NON-NLS-1$
78
79         public static final ImageDescriptor DESC_REQ_PLUGINS_OBJ = create(PATH_OBJ,
80                         "req_plugins_obj.gif"); //$NON-NLS-1$
81
82         public static final ImageDescriptor DESC_RUNTIME_OBJ = create(PATH_OBJ,
83                         "runtime_obj.gif"); //$NON-NLS-1$
84
85         public static final ImageDescriptor DESC_WARNING_ST_OBJ = create(PATH_OBJ,
86                         "warning_st_obj.gif"); //$NON-NLS-1$
87
88         /*
89          * Local tool bar image descriptors
90          */
91
92         public static final ImageDescriptor DESC_PROPERTIES = create(PATH_LCL,
93                         "properties.gif"); //$NON-NLS-1$
94
95         public static final ImageDescriptor DESC_OPEN_LOG = create(PATH_LCL,
96                         "open_log.gif"); //$NON-NLS-1$
97
98         public static final ImageDescriptor DESC_OPEN_LOG_DISABLED = create(
99                         PATH_LCL_DISABLED, "open_log.gif"); //$NON-NLS-1$
100
101         public static final ImageDescriptor DESC_PROPERTIES_DISABLED = create(
102                         PATH_LCL_DISABLED, "properties.gif"); //$NON-NLS-1$
103
104         public static final ImageDescriptor DESC_REFRESH = create(PATH_LCL,
105                         "refresh.gif"); //$NON-NLS-1$
106
107         public static final ImageDescriptor DESC_REFRESH_DISABLED = create(
108                         PATH_LCL_DISABLED, "refresh.gif"); //$NON-NLS-1$
109
110         public static final ImageDescriptor DESC_CLEAR = create(PATH_LCL,
111                         "clear.gif"); //$NON-NLS-1$
112
113         public static final ImageDescriptor DESC_CLEAR_DISABLED = create(
114                         PATH_LCL_DISABLED, "clear.gif"); //$NON-NLS-1$
115
116         public static final ImageDescriptor DESC_READ_LOG = create(PATH_LCL,
117                         "restore_log.gif"); //$NON-NLS-1$
118
119         public static final ImageDescriptor DESC_READ_LOG_DISABLED = create(
120                         PATH_LCL_DISABLED, "restore_log.gif"); //$NON-NLS-1$
121
122         public static final ImageDescriptor DESC_REMOVE_LOG = create(PATH_LCL,
123                         "remove.gif"); //$NON-NLS-1$
124
125         public static final ImageDescriptor DESC_REMOVE_LOG_DISABLED = create(
126                         PATH_LCL_DISABLED, "remove.gif"); //$NON-NLS-1$
127
128         public static final ImageDescriptor DESC_FILTER = create(PATH_LCL,
129                         "filter_ps.gif"); //$NON-NLS-1$
130
131         public static final ImageDescriptor DESC_FILTER_DISABLED = create(
132                         PATH_LCL_DISABLED, "filter_ps.gif"); //$NON-NLS-1$
133
134         public static final ImageDescriptor DESC_EXPORT = create(PATH_LCL,
135                         "export_log.gif"); //$NON-NLS-1$
136
137         public static final ImageDescriptor DESC_EXPORT_DISABLED = create(
138                         PATH_LCL_DISABLED, "export_log.gif"); //$NON-NLS-1$
139
140         public static final ImageDescriptor DESC_IMPORT = create(PATH_LCL,
141                         "import_log.gif"); //$NON-NLS-1$
142
143         public static final ImageDescriptor DESC_IMPORT_DISABLED = create(
144                         PATH_LCL_DISABLED, "import_log.gif"); //$NON-NLS-1$
145
146         public static final ImageDescriptor DESC_COLLAPSE_ALL = create(PATH_LCL,
147                         "collapseall.gif"); //$NON-NLS-1$
148
149         public static final ImageDescriptor DESC_HORIZONTAL_VIEW = create(PATH_LCL,
150                         "th_horizontal.gif"); //$NON-NLS-1$
151
152         public static final ImageDescriptor DESC_HORIZONTAL_VIEW_DISABLED = create(
153                         PATH_LCL_DISABLED, "th_horizontal.gif"); //$NON-NLS-1$
154
155         public static final ImageDescriptor DESC_VERTICAL_VIEW = create(PATH_LCL,
156                         "th_vertical.gif"); //$NON-NLS-1$
157
158         public static final ImageDescriptor DESC_VERTICAL_VIEW_DISABLED = create(
159                         PATH_LCL_DISABLED, "th_vertical.gif"); //$NON-NLS-1$
160
161         public static final ImageDescriptor DESC_HIDE_PANE = create(PATH_EVENTS,
162                         "hide_pane.gif"); //$NON-NLS-1$
163
164         /*
165          * Event Details
166          */
167         public static final ImageDescriptor DESC_PREV_EVENT = create(PATH_EVENTS,
168                         "event_prev.gif"); //$NON-NLS-1$
169
170         public static final ImageDescriptor DESC_NEXT_EVENT = create(PATH_EVENTS,
171                         "event_next.gif"); //$NON-NLS-1$
172
173         /*
174          * Overlays
175          */
176         public static final ImageDescriptor DESC_RUN_CO = create(PATH_OVR,
177                         "run_co.gif"); //$NON-NLS-1$
178
179         private static ImageDescriptor create(String prefix, String name) {
180                 return ImageDescriptor.createFromURL(makeIconURL(prefix, name));
181         }
182
183         public static Image get(String key) {
184                 return PLUGIN_REGISTRY.get(key);
185         }
186
187         private static URL makeIconURL(String prefix, String name) {
188                 String path = prefix + name;
189                 URL url = null;
190                 try {
191                         url = new URL(BASE_URL, path);
192                 } catch (MalformedURLException e) {
193                         return null;
194                 }
195                 return url;
196         }
197
198         public static Image manage(String key, ImageDescriptor desc) {
199                 Image image = desc.createImage();
200                 PLUGIN_REGISTRY.put(key, image);
201                 return image;
202         }
203 }