001: /*******************************************************************************
002: * Copyright (c) 2000, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.pde.internal.runtime;
011:
012: import java.net.URL;
013:
014: import org.eclipse.core.runtime.FileLocator;
015: import org.eclipse.core.runtime.Path;
016: import org.eclipse.jface.resource.ImageDescriptor;
017: import org.eclipse.jface.resource.ImageRegistry;
018: import org.eclipse.swt.graphics.Image;
019:
020: public class PDERuntimePluginImages {
021:
022: private static ImageRegistry PLUGIN_REGISTRY;
023:
024: public final static String ICONS_PATH = "icons/"; //$NON-NLS-1$
025:
026: private static final String PATH_OBJ = ICONS_PATH + "obj16/"; //$NON-NLS-1$
027: private static final String PATH_LCL = ICONS_PATH + "elcl16/"; //$NON-NLS-1$
028: private static final String PATH_LCL_DISABLED = ICONS_PATH
029: + "dlcl16/"; //$NON-NLS-1$
030: private static final String PATH_OVR = ICONS_PATH + "ovr16/"; //$NON-NLS-1$
031: private static final String PATH_EVENTS = ICONS_PATH + "eview16/"; //$NON-NLS-1$
032:
033: // Plug-in Spy related images
034: public static final String IMG_CLASS_OBJ = "class_obj.gif"; //$NON-NLS-1$
035: public static final String IMG_INTERFACE_OBJ = "int_obj.gif"; //$NON-NLS-1$
036: public static final String IMG_PLUGIN_OBJ = "plugin_obj.gif"; //$NON-NLS-1$
037: public static final String IMG_SPY_OBJ = "pdespy_obj.gif"; //$NON-NLS-1$
038: public static final String IMG_MENU_OBJ = "menu_obj.gif"; //$NON-NLS-1$
039: public static final String IMG_ID_OBJ = "generic_xml_obj.gif"; //$NON-NLS-1$
040: public static final String IMG_MENUSPY_OBJ = "menuspy_obj.gif"; //$NON-NLS-1$
041:
042: public static final ImageDescriptor CLASS_OBJ = create(PATH_OBJ,
043: IMG_CLASS_OBJ);
044: public static final ImageDescriptor INTERFACE_OBJ = create(
045: PATH_OBJ, IMG_INTERFACE_OBJ);
046: public static final ImageDescriptor PLUGIN_OBJ = create(PATH_OBJ,
047: IMG_PLUGIN_OBJ);
048: public static final ImageDescriptor SPY_OBJ = create(PATH_OBJ,
049: IMG_SPY_OBJ);
050: public static final ImageDescriptor MENU_OBJ = create(PATH_OBJ,
051: IMG_MENU_OBJ);
052: public static final ImageDescriptor ID_OBJ = create(PATH_OBJ,
053: IMG_ID_OBJ);
054: public static final ImageDescriptor MENUSPY_OBJ = create(PATH_OBJ,
055: IMG_MENUSPY_OBJ);
056:
057: public static final ImageDescriptor DESC_ERROR_ST_OBJ = create(
058: PATH_OBJ, "error_st_obj.gif"); //$NON-NLS-1$
059: public static final ImageDescriptor DESC_ERROR_STACK_OBJ = create(
060: PATH_OBJ, "error_stack.gif"); //$NON-NLS-1$
061: public static final ImageDescriptor DESC_EXT_POINT_OBJ = create(
062: PATH_OBJ, "ext_point_obj.gif"); //$NON-NLS-1$
063: public static final ImageDescriptor DESC_EXT_POINTS_OBJ = create(
064: PATH_OBJ, "ext_points_obj.gif"); //$NON-NLS-1$
065: public static final ImageDescriptor DESC_EXTENSION_OBJ = create(
066: PATH_OBJ, "extension_obj.gif"); //$NON-NLS-1$
067: public static final ImageDescriptor DESC_EXTENSIONS_OBJ = create(
068: PATH_OBJ, "extensions_obj.gif"); //$NON-NLS-1$
069: public static final ImageDescriptor DESC_GENERIC_XML_OBJ = create(
070: PATH_OBJ, "generic_xml_obj.gif"); //$NON-NLS-1$
071: public static final ImageDescriptor DESC_ATTR_XML_OBJ = create(
072: PATH_OBJ, "attr_xml_obj.gif"); //$NON-NLS-1$
073: public static final ImageDescriptor DESC_INFO_ST_OBJ = create(
074: PATH_OBJ, "info_st_obj.gif"); //$NON-NLS-1$
075: public static final ImageDescriptor DESC_JAVA_LIB_OBJ = create(
076: PATH_OBJ, "java_lib_obj.gif"); //$NON-NLS-1$
077: public static final ImageDescriptor DESC_NATIVE_LIB_OBJ = create(
078: PATH_OBJ, "native_lib_obj.gif"); //$NON-NLS-1$
079: public static final ImageDescriptor DESC_OK_ST_OBJ = create(
080: PATH_OBJ, "ok_st_obj.gif"); //$NON-NLS-1$
081: public static final ImageDescriptor DESC_PLUGIN_OBJ = create(
082: PATH_OBJ, "plugin_obj.gif"); //$NON-NLS-1$
083: public static final ImageDescriptor DESC_REQ_PLUGIN_OBJ = create(
084: PATH_OBJ, "req_plugin_obj.gif"); //$NON-NLS-1$
085: public static final ImageDescriptor DESC_REQ_PLUGINS_OBJ = create(
086: PATH_OBJ, "req_plugins_obj.gif"); //$NON-NLS-1$
087: public static final ImageDescriptor DESC_RUNTIME_OBJ = create(
088: PATH_OBJ, "runtime_obj.gif"); //$NON-NLS-1$
089: public static final ImageDescriptor DESC_WARNING_ST_OBJ = create(
090: PATH_OBJ, "warning_st_obj.gif"); //$NON-NLS-1$
091: public static final ImageDescriptor DESC_LOCATION = create(
092: PATH_OBJ, "location_obj.gif"); //$NON-NLS-1$
093:
094: /*
095: * Local tool bar image descriptors
096: */
097:
098: public static final ImageDescriptor DESC_PROPERTIES = create(
099: PATH_LCL, "properties.gif"); //$NON-NLS-1$
100: public static final ImageDescriptor DESC_OPEN_LOG = create(
101: PATH_LCL, "open_log.gif"); //$NON-NLS-1$
102: public static final ImageDescriptor DESC_OPEN_LOG_DISABLED = create(
103: PATH_LCL_DISABLED, "open_log.gif"); //$NON-NLS-1$
104:
105: public static final ImageDescriptor DESC_PROPERTIES_DISABLED = create(
106: PATH_LCL_DISABLED, "properties.gif"); //$NON-NLS-1$
107: public static final ImageDescriptor DESC_REFRESH = create(PATH_LCL,
108: "refresh.gif"); //$NON-NLS-1$
109: public static final ImageDescriptor DESC_REFRESH_DISABLED = create(
110: PATH_LCL_DISABLED, "refresh.gif"); //$NON-NLS-1$
111: public static final ImageDescriptor DESC_CLEAR = create(PATH_LCL,
112: "clear.gif"); //$NON-NLS-1$
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(
117: PATH_LCL, "restore_log.gif"); //$NON-NLS-1$
118: public static final ImageDescriptor DESC_READ_LOG_DISABLED = create(
119: PATH_LCL_DISABLED, "restore_log.gif"); //$NON-NLS-1$
120:
121: public static final ImageDescriptor DESC_REMOVE_LOG = create(
122: PATH_LCL, "remove.gif"); //$NON-NLS-1$
123: public static final ImageDescriptor DESC_REMOVE_LOG_DISABLED = create(
124: PATH_LCL_DISABLED, "remove.gif"); //$NON-NLS-1$
125:
126: public static final ImageDescriptor DESC_FILTER = create(PATH_LCL,
127: "filter_ps.gif"); //$NON-NLS-1$
128: public static final ImageDescriptor DESC_FILTER_DISABLED = create(
129: PATH_LCL_DISABLED, "filter_ps.gif"); //$NON-NLS-1$
130:
131: public static final ImageDescriptor DESC_EXPORT = create(PATH_LCL,
132: "export_log.gif"); //$NON-NLS-1$
133: public static final ImageDescriptor DESC_EXPORT_DISABLED = create(
134: PATH_LCL_DISABLED, "export_log.gif"); //$NON-NLS-1$
135:
136: public static final ImageDescriptor DESC_IMPORT = create(PATH_LCL,
137: "import_log.gif"); //$NON-NLS-1$
138: public static final ImageDescriptor DESC_IMPORT_DISABLED = create(
139: PATH_LCL_DISABLED, "import_log.gif"); //$NON-NLS-1$
140:
141: public static final ImageDescriptor DESC_COLLAPSE_ALL = create(
142: PATH_LCL, "collapseall.gif"); //$NON-NLS-1$
143:
144: /*
145: * Event Details
146: */
147: public static final ImageDescriptor DESC_PREV_EVENT = create(
148: PATH_EVENTS, "event_prev.gif"); //$NON-NLS-1$
149: public static final ImageDescriptor DESC_NEXT_EVENT = create(
150: PATH_EVENTS, "event_next.gif"); //$NON-NLS-1$
151: /*
152: * Overlays
153: */
154: public static final ImageDescriptor DESC_RUN_CO = create(PATH_OVR,
155: "run_co.gif"); //$NON-NLS-1$
156: public static final ImageDescriptor DESC_EXPORT_CO = create(
157: PATH_OVR, "export_co.gif"); //$NON-NLS-1$
158: public static final ImageDescriptor DESC_ERROR_CO = create(
159: PATH_OVR, "error_co.gif"); //$NON-NLS-1$
160:
161: private static final void initialize() {
162: PLUGIN_REGISTRY = PDERuntimePlugin.getDefault()
163: .getImageRegistry();
164: manage(IMG_CLASS_OBJ, CLASS_OBJ);
165: manage(IMG_INTERFACE_OBJ, INTERFACE_OBJ);
166: manage(IMG_PLUGIN_OBJ, PLUGIN_OBJ);
167: manage(IMG_SPY_OBJ, SPY_OBJ);
168: manage(IMG_MENU_OBJ, MENU_OBJ);
169: manage(IMG_ID_OBJ, ID_OBJ);
170: manage(IMG_MENUSPY_OBJ, MENUSPY_OBJ);
171: }
172:
173: private static ImageDescriptor create(String prefix, String name) {
174: return ImageDescriptor.createFromURL(makeIconURL(prefix, name));
175: }
176:
177: public static Image get(String key) {
178: if (PLUGIN_REGISTRY == null)
179: initialize();
180: return PLUGIN_REGISTRY.get(key);
181: }
182:
183: private static URL makeIconURL(String prefix, String name) {
184: String path = "$nl$/" + prefix + name; //$NON-NLS-1$
185: return FileLocator.find(PDERuntimePlugin.getDefault()
186: .getBundle(), new Path(path), null);
187: }
188:
189: public static Image manage(String key, ImageDescriptor desc) {
190: Image image = desc.createImage();
191: PLUGIN_REGISTRY.put(key, image);
192: return image;
193: }
194:
195: }
|