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