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