KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > runtime > PDERuntimePluginImages


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.runtime;
12
13 import java.net.URL JavaDoc;
14
15 import org.eclipse.core.runtime.FileLocator;
16 import org.eclipse.core.runtime.Path;
17 import org.eclipse.jface.resource.ImageDescriptor;
18 import org.eclipse.jface.resource.ImageRegistry;
19 import org.eclipse.swt.graphics.Image;
20
21 public class PDERuntimePluginImages {
22
23     private final static ImageRegistry PLUGIN_REGISTRY =
24         PDERuntimePlugin.getDefault().getImageRegistry();
25
26     public final static String JavaDoc ICONS_PATH = "icons/"; //$NON-NLS-1$
27

28     private static final String JavaDoc PATH_OBJ = ICONS_PATH + "obj16/"; //$NON-NLS-1$
29
private static final String JavaDoc PATH_LCL = ICONS_PATH + "elcl16/"; //$NON-NLS-1$
30
private static final String JavaDoc PATH_LCL_DISABLED = ICONS_PATH + "dlcl16/"; //$NON-NLS-1$
31
private static final String JavaDoc PATH_OVR = ICONS_PATH + "ovr16/"; //$NON-NLS-1$
32
private static final String JavaDoc PATH_EVENTS = ICONS_PATH + "eview16/"; //$NON-NLS-1$
33

34
35     public static final ImageDescriptor DESC_ERROR_ST_OBJ =
36         create(PATH_OBJ, "error_st_obj.gif"); //$NON-NLS-1$
37
public static final ImageDescriptor DESC_ERROR_STACK_OBJ =
38         create(PATH_OBJ, "error_stack.gif"); //$NON-NLS-1$
39
public static final ImageDescriptor DESC_EXT_POINT_OBJ =
40         create(PATH_OBJ, "ext_point_obj.gif"); //$NON-NLS-1$
41
public static final ImageDescriptor DESC_EXT_POINTS_OBJ =
42         create(PATH_OBJ, "ext_points_obj.gif"); //$NON-NLS-1$
43
public static final ImageDescriptor DESC_EXTENSION_OBJ =
44         create(PATH_OBJ, "extension_obj.gif"); //$NON-NLS-1$
45
public static final ImageDescriptor DESC_EXTENSIONS_OBJ =
46         create(PATH_OBJ, "extensions_obj.gif"); //$NON-NLS-1$
47
public static final ImageDescriptor DESC_GENERIC_XML_OBJ =
48         create(PATH_OBJ, "generic_xml_obj.gif"); //$NON-NLS-1$
49
public static final ImageDescriptor DESC_ATTR_XML_OBJ =
50         create(PATH_OBJ, "attr_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
public static final ImageDescriptor DESC_LOCATION =
70         create(PATH_OBJ, "location_obj.gif"); //$NON-NLS-1$
71

72     /*
73      * Local tool bar image descriptors
74      */

75
76     public static final ImageDescriptor DESC_PROPERTIES =
77         create(PATH_LCL, "properties.gif"); //$NON-NLS-1$
78
public static final ImageDescriptor DESC_OPEN_LOG =
79         create(PATH_LCL, "open_log.gif"); //$NON-NLS-1$
80
public static final ImageDescriptor DESC_OPEN_LOG_DISABLED =
81         create(PATH_LCL_DISABLED, "open_log.gif"); //$NON-NLS-1$
82

83     public static final ImageDescriptor DESC_PROPERTIES_DISABLED =
84         create(PATH_LCL_DISABLED, "properties.gif"); //$NON-NLS-1$
85
public static final ImageDescriptor DESC_REFRESH =
86         create(PATH_LCL, "refresh.gif"); //$NON-NLS-1$
87
public static final ImageDescriptor DESC_REFRESH_DISABLED =
88         create(PATH_LCL_DISABLED, "refresh.gif"); //$NON-NLS-1$
89
public static final ImageDescriptor DESC_CLEAR = create(PATH_LCL, "clear.gif"); //$NON-NLS-1$
90
public static final ImageDescriptor DESC_CLEAR_DISABLED =
91         create(PATH_LCL_DISABLED, "clear.gif"); //$NON-NLS-1$
92

93     public static final ImageDescriptor DESC_READ_LOG =
94         create(PATH_LCL, "restore_log.gif"); //$NON-NLS-1$
95
public static final ImageDescriptor DESC_READ_LOG_DISABLED =
96         create(PATH_LCL_DISABLED, "restore_log.gif"); //$NON-NLS-1$
97

98     public static final ImageDescriptor DESC_REMOVE_LOG =
99         create(PATH_LCL, "remove.gif"); //$NON-NLS-1$
100
public static final ImageDescriptor DESC_REMOVE_LOG_DISABLED =
101         create(PATH_LCL_DISABLED, "remove.gif"); //$NON-NLS-1$
102

103     public static final ImageDescriptor DESC_FILTER =
104         create(PATH_LCL, "filter_ps.gif"); //$NON-NLS-1$
105
public static final ImageDescriptor DESC_FILTER_DISABLED =
106         create(PATH_LCL_DISABLED, "filter_ps.gif"); //$NON-NLS-1$
107

108     public static final ImageDescriptor DESC_EXPORT =
109         create(PATH_LCL, "export_log.gif"); //$NON-NLS-1$
110
public static final ImageDescriptor DESC_EXPORT_DISABLED =
111         create(PATH_LCL_DISABLED, "export_log.gif"); //$NON-NLS-1$
112

113     public static final ImageDescriptor DESC_IMPORT =
114         create(PATH_LCL, "import_log.gif"); //$NON-NLS-1$
115
public static final ImageDescriptor DESC_IMPORT_DISABLED =
116         create(PATH_LCL_DISABLED, "import_log.gif"); //$NON-NLS-1$
117

118     public static final ImageDescriptor DESC_COLLAPSE_ALL =
119         create(PATH_LCL, "collapseall.gif"); //$NON-NLS-1$
120

121     /*
122      * Event Details
123      */

124     public static final ImageDescriptor DESC_PREV_EVENT =
125         create(PATH_EVENTS, "event_prev.gif"); //$NON-NLS-1$
126
public static final ImageDescriptor DESC_NEXT_EVENT =
127         create(PATH_EVENTS, "event_next.gif"); //$NON-NLS-1$
128
/*
129      * Overlays
130      */

131     public static final ImageDescriptor DESC_RUN_CO =
132         create(PATH_OVR, "run_co.gif"); //$NON-NLS-1$
133
public static final ImageDescriptor DESC_EXPORT_CO =
134         create(PATH_OVR, "export_co.gif"); //$NON-NLS-1$
135
public static final ImageDescriptor DESC_ERROR_CO =
136         create(PATH_OVR, "error_co.gif"); //$NON-NLS-1$
137

138     private static ImageDescriptor create(String JavaDoc prefix, String JavaDoc name) {
139         return ImageDescriptor.createFromURL(makeIconURL(prefix, name));
140     }
141
142     public static Image get(String JavaDoc key) {
143         return PLUGIN_REGISTRY.get(key);
144     }
145     private static URL JavaDoc makeIconURL(String JavaDoc prefix, String JavaDoc name) {
146         String JavaDoc path = "$nl$/" + prefix + name; //$NON-NLS-1$
147
return FileLocator.find(PDERuntimePlugin.getDefault().getBundle(), new Path(path), null);
148     }
149     public static Image manage(String JavaDoc key, ImageDescriptor desc) {
150         Image image = desc.createImage();
151         PLUGIN_REGISTRY.put(key, image);
152         return image;
153     }
154 }
155
Popular Tags