1 package net.sourceforge.phpdt.internal.ui;
3 import java.net.MalformedURLException;
5 import java.util.HashMap;
6 import java.util.Iterator;
8 //import net.sourceforge.phpeclipse.PHPeclipsePlugin;
9 import net.sourceforge.phpeclipse.ui.WebUI;
11 import org.eclipse.jface.action.IAction;
12 import org.eclipse.jface.resource.ImageDescriptor;
13 import org.eclipse.jface.resource.ImageRegistry;
14 import org.eclipse.swt.graphics.Image;
16 public class PHPUiImages {
18 protected static final String NAME_PREFIX = "net.sourceforge.phpdt.internal.ui.";
20 protected static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
22 protected static URL fgIconBaseURL = null;
25 // String pathSuffix = "icons/";
34 // } catch (MalformedURLException e) {
35 // PHPeclipsePlugin.log(e);
39 // Determine display depth. If depth > 4 then we use high color images.
40 // Otherwise low color
43 fgIconBaseURL = WebUI.getDefault().getBundle().getEntry(
44 "/icons/"); //$NON-NLS-1$
47 private static ImageRegistry fgImageRegistry = null;
49 private static HashMap fgAvoidSWTErrorMap = null;
51 protected static final String OBJ_PREFIX = "obj16";
53 protected static final String OVR_PREFIX = "ovr16";
55 protected static final String CTOOL_PREFIX = "ctool16";
57 public static final String IMG_CLASS = NAME_PREFIX
58 + "class_default_obj.gif";
60 public static final String IMG_DEFINE = NAME_PREFIX + "define_obj.gif";
62 public static final String IMG_BUILTIN = NAME_PREFIX + "builtin_obj.gif";
64 public static final String IMG_FUN = NAME_PREFIX + "fun_obj.gif";
66 public static final String IMG_INC = NAME_PREFIX + "impc_obj.gif";
68 public static final String IMG_VAR = NAME_PREFIX + "var_obj.gif";
70 public static final String IMG_TABLE = NAME_PREFIX + "table_obj.gif";
72 public static final String IMG_COLUMN = NAME_PREFIX + "column_obj.gif";
74 public static final String IMG_OBJS_WARNING = NAME_PREFIX
77 public static final String IMG_OBJS_INFO = NAME_PREFIX + "info_obj.gif";
79 public static final String IMG_CTOOLS_PHP_PAGE = NAME_PREFIX
82 public static final String IMG_CTOOLS_PHP = NAME_PREFIX + "php.gif";
84 public static final String IMG_CLEAR = NAME_PREFIX + "clear.gif";
86 public static final ImageDescriptor DESC_CLASS = createManaged(OBJ_PREFIX,
89 public static final ImageDescriptor DESC_DEFINE = createManaged(OBJ_PREFIX,
92 public static final ImageDescriptor DESC_BUILTIN = createManaged(
93 OBJ_PREFIX, IMG_BUILTIN);
95 public static final ImageDescriptor DESC_FUN = createManaged(OBJ_PREFIX,
98 public static final ImageDescriptor DESC_INC = createManaged(OBJ_PREFIX,
101 public static final ImageDescriptor DESC_VAR = createManaged(OBJ_PREFIX,
104 public static final ImageDescriptor DESC_TABLE = createManaged(OBJ_PREFIX,
107 public static final ImageDescriptor DESC_COLUMN = createManaged(OBJ_PREFIX,
110 public static final ImageDescriptor DESC_OBJS_WARNING = createManaged(
111 OBJ_PREFIX, IMG_OBJS_WARNING);
113 public static final ImageDescriptor DESC_OBJS_INFO = createManaged(
114 OBJ_PREFIX, IMG_OBJS_INFO);
116 public static final ImageDescriptor DESC_CTOOL_PHP_PAGE = createManaged(
117 CTOOL_PREFIX, IMG_CTOOLS_PHP_PAGE);
119 public static final ImageDescriptor DESC_CTOOL_PHP = createManaged(
120 CTOOL_PREFIX, IMG_CTOOLS_PHP);
122 public static final ImageDescriptor DESC_CLEAR = createManaged(OBJ_PREFIX,
126 * Set of predefined Image Descriptors.
128 private static final String T_OBJ = "obj16"; //$NON-NLS-1$
130 private static final String T_OVR = "ovr16"; //$NON-NLS-1$
132 private static final String T_WIZBAN = "wizban"; //$NON-NLS-1$
134 private static final String T_CLCL = "clcl16"; //$NON-NLS-1$
136 private static final String T_DLCL = "dlcl16"; //$NON-NLS-1$
138 private static final String T_ELCL = "elcl16"; //$NON-NLS-1$
140 private static final String T_CTOOL = "ctool16"; //$NON-NLS-1$
142 private static final String T_CVIEW = "cview16"; //$NON-NLS-1$
144 public static final ImageDescriptor DESC_WIZBAN_NEWCLASS = create(T_WIZBAN,
145 "newclass_wiz.gif"); //$NON-NLS-1$
147 public static final ImageDescriptor DESC_ELCL_FILTER = create(T_ELCL,
148 "filter_ps.gif"); //$NON-NLS-1$
150 public static final ImageDescriptor DESC_DLCL_FILTER = create(T_DLCL,
151 "filter_ps.gif"); //$NON-NLS-1$
154 * Available cached Images in the Java plugin image registry.
156 public static final String IMG_MISC_PUBLIC = NAME_PREFIX
157 + "methpub_obj.gif"; //$NON-NLS-1$
159 public static final String IMG_MISC_PROTECTED = NAME_PREFIX
160 + "methpro_obj.gif"; //$NON-NLS-1$
162 public static final String IMG_MISC_PRIVATE = NAME_PREFIX
163 + "methpri_obj.gif"; //$NON-NLS-1$
165 public static final String IMG_MISC_DEFAULT = NAME_PREFIX
166 + "methdef_obj.gif"; //$NON-NLS-1$
168 public static final String IMG_FIELD_PUBLIC = NAME_PREFIX
169 + "field_public_obj.gif"; //$NON-NLS-1$
171 public static final String IMG_FIELD_PROTECTED = NAME_PREFIX
172 + "field_protected_obj.gif"; //$NON-NLS-1$
174 public static final String IMG_FIELD_PRIVATE = NAME_PREFIX
175 + "field_private_obj.gif"; //$NON-NLS-1$
177 public static final String IMG_FIELD_DEFAULT = NAME_PREFIX
178 + "field_default_obj.gif"; //$NON-NLS-1$
180 public static final String IMG_OBJS_GHOST = NAME_PREFIX + "ghost.gif"; //$NON-NLS-1$
182 public static final String IMG_OBJS_SEARCH_TSK = NAME_PREFIX
183 + "search_tsk.gif"; //$NON-NLS-1$
185 public static final String IMG_OBJS_PACKDECL = NAME_PREFIX
186 + "packd_obj.gif"; //$NON-NLS-1$
188 public static final String IMG_OBJS_IMPDECL = NAME_PREFIX + "imp_obj.gif"; //$NON-NLS-1$
190 public static final String IMG_OBJS_IMPCONT = NAME_PREFIX + "impc_obj.gif"; //$NON-NLS-1$
192 public static final String IMG_OBJS_JSEARCH = NAME_PREFIX
193 + "jsearch_obj.gif"; //$NON-NLS-1$
195 public static final String IMG_OBJS_SEARCH_DECL = NAME_PREFIX
196 + "search_decl_obj.gif"; //$NON-NLS-1$
198 public static final String IMG_OBJS_SEARCH_REF = NAME_PREFIX
199 + "search_ref_obj.gif"; //$NON-NLS-1$
201 public static final String IMG_OBJS_CLASS = NAME_PREFIX + "class_obj.gif"; //$NON-NLS-1$
203 public static final String IMG_OBJS_CLASSALT = NAME_PREFIX
204 + "classfo_obj.gif"; //$NON-NLS-1$
206 public static final String IMG_OBJS_CLASS_DEFAULT = NAME_PREFIX
207 + "class_default_obj.gif"; //$NON-NLS-1$
209 public static final String IMG_OBJS_INTERFACE = NAME_PREFIX + "int_obj.gif"; //$NON-NLS-1$
211 public static final String IMG_OBJS_INTERFACEALT = NAME_PREFIX
212 + "intf_obj.gif"; //$NON-NLS-1$
214 public static final String IMG_OBJS_INTERFACE_DEFAULT = NAME_PREFIX
215 + "int_default_obj.gif"; //$NON-NLS-1$
217 public static final String IMG_OBJS_CUNIT = NAME_PREFIX + "phpedit.png"; //$NON-NLS-1$
219 public static final String IMG_OBJS_CUNIT_RESOURCE = NAME_PREFIX
220 + "jcu_resource_obj.gif"; //$NON-NLS-1$
222 public static final String IMG_OBJS_CFILE = NAME_PREFIX + "classf_obj.gif"; //$NON-NLS-1$
224 public static final String IMG_OBJS_CFILECLASS = NAME_PREFIX
225 + "class_obj.gif"; //$NON-NLS-1$
227 public static final String IMG_OBJS_CFILEINT = NAME_PREFIX + "int_obj.gif"; //$NON-NLS-1$
229 public static final String IMG_OBJS_LOGICAL_PACKAGE = NAME_PREFIX
230 + "logical_package_obj.gif";//$NON-NLS-1$
232 public static final String IMG_OJS_EMPTY_LOGICAL_PACKAGE = NAME_PREFIX
233 + "empty_logical_package_obj.gif";//$NON-NLS-1$
235 public static final String IMG_OBJS_PACKAGE = NAME_PREFIX
236 + "package_obj.gif"; //$NON-NLS-1$
238 public static final String IMG_OBJS_EMPTY_PACK_RESOURCE = NAME_PREFIX
239 + "empty_pack_fldr_obj.gif"; //$NON-NLS-1$
241 public static final String IMG_OBJS_EMPTY_PACKAGE = NAME_PREFIX
242 + "empty_pack_obj.gif"; //$NON-NLS-1$
244 public static final String IMG_OBJS_PACKFRAG_ROOT = NAME_PREFIX
245 + "packagefolder_obj.gif"; //$NON-NLS-1$
247 public static final String IMG_OBJS_MISSING_PACKFRAG_ROOT = NAME_PREFIX
248 + "packagefolder_nonexist_obj.gif"; //$NON-NLS-1$
250 public static final String IMG_OBJS_MISSING_JAR = NAME_PREFIX
251 + "jar_nonexist_obj.gif"; //$NON-NLS-1$
253 public static final String IMG_OBJS_JAR = NAME_PREFIX + "jar_obj.gif"; //$NON-NLS-1$
255 public static final String IMG_OBJS_EXTJAR = NAME_PREFIX + "jar_l_obj.gif"; //$NON-NLS-1$
257 public static final String IMG_OBJS_JAR_WSRC = NAME_PREFIX
258 + "jar_src_obj.gif"; //$NON-NLS-1$
260 public static final String IMG_OBJS_EXTJAR_WSRC = NAME_PREFIX
261 + "jar_lsrc_obj.gif"; //$NON-NLS-1$
263 public static final String IMG_OBJS_ENV_VAR = NAME_PREFIX
264 + "envvar_obj.gif"; //$NON-NLS-1$
266 public static final String IMG_OBJS_MISSING_ENV_VAR = NAME_PREFIX
267 + "envvar_nonexist_obj.gif"; //$NON-NLS-1$
269 public static final String IMG_OBJS_JAVA_MODEL = NAME_PREFIX
270 + "java_model_obj.gif"; //$NON-NLS-1$
272 public static final String IMG_OBJS_UNKNOWN = NAME_PREFIX
273 + "unknown_obj.gif"; //$NON-NLS-1$
275 public static final String IMG_OBJS_LIBRARY = NAME_PREFIX
276 + "library_obj.gif"; //$NON-NLS-1$
278 public static final String IMG_OBJS_JAVADOCTAG = NAME_PREFIX
279 + "jdoc_tag_obj.gif"; //$NON-NLS-1$
281 public static final String IMG_OBJS_HTMLTAG = NAME_PREFIX
282 + "html_tag_obj.gif"; //$NON-NLS-1$
284 public static final String IMG_OBJS_TEMPLATE = NAME_PREFIX
285 + "template_obj.gif"; //$NON-NLS-1$
287 public static final String IMG_OBJS_EXCEPTION = NAME_PREFIX
288 + "jexception_obj.gif"; //$NON-NLS-1$
290 public static final String IMG_OBJS_ERROR = NAME_PREFIX
291 + "jrtexception_obj.gif"; //$NON-NLS-1$
293 public static final String IMG_OBJS_BREAKPOINT_INSTALLED = NAME_PREFIX
294 + "brkpi_obj.gif"; //$NON-NLS-1$
296 public static final String IMG_OBJS_FIXABLE_PROBLEM = NAME_PREFIX
297 + "quickfix_warning_obj.gif"; //$NON-NLS-1$
299 public static final String IMG_OBJS_FIXABLE_ERROR = NAME_PREFIX
300 + "quickfix_error_obj.gif"; //$NON-NLS-1$
302 public static final String IMG_OBJS_SNIPPET_EVALUATING = NAME_PREFIX
303 + "jsbook_run_obj.gif"; //$NON-NLS-1$
305 public static final String IMG_OBJS_REFACTORING_FATAL = NAME_PREFIX
306 + "fatalerror_obj.gif"; //$NON-NLS-1$
308 public static final String IMG_OBJS_REFACTORING_ERROR = NAME_PREFIX
309 + "error_obj.gif"; //$NON-NLS-1$
311 public static final String IMG_OBJS_REFACTORING_WARNING = NAME_PREFIX
312 + "warning_obj.gif"; //$NON-NLS-1$
314 public static final String IMG_OBJS_REFACTORING_INFO = NAME_PREFIX
315 + "info_obj.gif"; //$NON-NLS-1$
317 public static final String IMG_OBJS_NLS_TRANSLATE = NAME_PREFIX
318 + "translate.gif"; //$NON-NLS-1$
320 public static final String IMG_OBJS_NLS_NEVER_TRANSLATE = NAME_PREFIX
321 + "never_translate.gif"; //$NON-NLS-1$
323 public static final String IMG_OBJS_NLS_SKIP = NAME_PREFIX + "skip.gif"; //$NON-NLS-1$
325 public static final String IMG_OBJS_SEARCH_READACCESS = NAME_PREFIX
326 + "occ_read.gif"; //$NON-NLS-1$
328 public static final String IMG_OBJS_SEARCH_WRITEACCESS = NAME_PREFIX
329 + "occ_write.gif"; //$NON-NLS-1$
331 public static final String IMG_OBJS_SEARCH_OCCURRENCE = NAME_PREFIX
332 + "occ_match.gif"; //$NON-NLS-1$
334 public static final ImageDescriptor DESC_VIEW_ERRORWARNING_TAB = create(
335 T_CVIEW, "errorwarning_tab.gif"); //$NON-NLS-1$
337 public static final ImageDescriptor DESC_VIEW_CLASSFILEGENERATION_TAB = create(
338 T_CVIEW, "classfilegeneration_tab.gif"); //$NON-NLS-1$
340 public static final ImageDescriptor DESC_VIEW_JDKCOMPLIANCE_TAB = create(
341 T_CVIEW, "jdkcompliance_tab.gif"); //$NON-NLS-1$
343 public static final ImageDescriptor DESC_CLCL_FILTER = create(T_CLCL,
344 "filter_ps.gif"); //$NON-NLS-1$
346 public static final ImageDescriptor DESC_CLCL_CODE_ASSIST = create(T_CLCL,
347 "metharg_obj.gif"); //$NON-NLS-1$
349 public static final ImageDescriptor DESC_DLCL_CODE_ASSIST = create(T_DLCL,
350 "metharg_obj.gif"); //$NON-NLS-1$
352 public static final ImageDescriptor DESC_MISC_PUBLIC = createManaged(T_OBJ,
355 public static final ImageDescriptor DESC_MISC_PROTECTED = createManaged(
356 T_OBJ, IMG_MISC_PROTECTED);
358 public static final ImageDescriptor DESC_MISC_PRIVATE = createManaged(
359 T_OBJ, IMG_MISC_PRIVATE);
361 public static final ImageDescriptor DESC_MISC_DEFAULT = createManaged(
362 T_OBJ, IMG_MISC_DEFAULT);
364 public static final ImageDescriptor DESC_FIELD_PUBLIC = createManaged(
365 T_OBJ, IMG_FIELD_PUBLIC); //$NON-NLS-1$
367 public static final ImageDescriptor DESC_FIELD_PROTECTED = createManaged(
368 T_OBJ, IMG_FIELD_PROTECTED); //$NON-NLS-1$
370 public static final ImageDescriptor DESC_FIELD_PRIVATE = createManaged(
371 T_OBJ, IMG_FIELD_PRIVATE); //$NON-NLS-1$
373 public static final ImageDescriptor DESC_FIELD_DEFAULT = createManaged(
374 T_OBJ, IMG_FIELD_DEFAULT); //$NON-NLS-1$
376 public static final ImageDescriptor DESC_MENU_SHIFT_RIGHT = create(T_CTOOL,
377 "shift_r_edit.gif"); //$NON-NLS-1$
379 public static final ImageDescriptor DESC_MENU_SHIFT_LEFT = create(T_CTOOL,
380 "shift_l_edit.gif"); //$NON-NLS-1$
382 public static final ImageDescriptor DESC_OBJS_GHOST = createManaged(T_OBJ,
385 public static final ImageDescriptor DESC_OBJS_PACKDECL = createManaged(
386 T_OBJ, IMG_OBJS_PACKDECL);
388 public static final ImageDescriptor DESC_OBJS_IMPDECL = createManaged(
389 T_OBJ, IMG_OBJS_IMPDECL);
391 public static final ImageDescriptor DESC_OBJS_IMPCONT = createManaged(
392 T_OBJ, IMG_OBJS_IMPCONT);
394 public static final ImageDescriptor DESC_OBJS_JSEARCH = createManaged(
395 T_OBJ, IMG_OBJS_JSEARCH);
397 public static final ImageDescriptor DESC_OBJS_SEARCH_DECL = createManaged(
398 T_OBJ, IMG_OBJS_SEARCH_DECL);
400 public static final ImageDescriptor DESC_OBJS_SEARCH_REF = createManaged(
401 T_OBJ, IMG_OBJS_SEARCH_REF);
403 public static final ImageDescriptor DESC_OBJS_CUNIT = createManaged(T_OBJ,
406 public static final ImageDescriptor DESC_OBJS_CUNIT_RESOURCE = createManaged(
407 T_OBJ, IMG_OBJS_CUNIT_RESOURCE);
409 public static final ImageDescriptor DESC_OBJS_CFILE = createManaged(T_OBJ,
412 public static final ImageDescriptor DESC_OBJS_CFILECLASS = createManaged(
413 T_OBJ, IMG_OBJS_CFILECLASS);
415 public static final ImageDescriptor DESC_OBJS_CFILEINT = createManaged(
416 T_OBJ, IMG_OBJS_CFILEINT);
418 public static final ImageDescriptor DESC_OBJS_PACKAGE = createManaged(
419 T_OBJ, IMG_OBJS_PACKAGE);
421 public static final ImageDescriptor DESC_OBJS_EMPTY_LOGICAL_PACKAGE = createManaged(
422 T_OBJ, IMG_OJS_EMPTY_LOGICAL_PACKAGE);
424 public static final ImageDescriptor DESC_OBJS_LOGICAL_PACKAGE = createManaged(
425 T_OBJ, IMG_OBJS_LOGICAL_PACKAGE);
427 public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE_RESOURCES = createManaged(
428 T_OBJ, IMG_OBJS_EMPTY_PACK_RESOURCE);
430 public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE = createManaged(
431 T_OBJ, IMG_OBJS_EMPTY_PACKAGE);
433 public static final ImageDescriptor DESC_OBJS_PACKFRAG_ROOT = createManaged(
434 T_OBJ, IMG_OBJS_PACKFRAG_ROOT);
436 public static final ImageDescriptor DESC_OBJS_MISSING_PACKFRAG_ROOT = createManaged(
437 T_OBJ, IMG_OBJS_MISSING_PACKFRAG_ROOT);
439 public static final ImageDescriptor DESC_OBJS_JAVA_MODEL = createManaged(
440 T_OBJ, IMG_OBJS_JAVA_MODEL);
442 public static final ImageDescriptor DESC_OBJS_CLASS = createManaged(T_OBJ,
445 public static final ImageDescriptor DESC_OBJS_CLASS_DEFAULT = createManaged(
446 T_OBJ, IMG_OBJS_CLASS_DEFAULT);
448 public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PUBLIC = create(
449 T_OBJ, "innerclass_public_obj.gif"); //$NON-NLS-1$
451 public static final ImageDescriptor DESC_OBJS_INNER_CLASS_DEFAULT = create(
452 T_OBJ, "innerclass_default_obj.gif"); //$NON-NLS-1$
454 public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PROTECTED = create(
455 T_OBJ, "innerclass_protected_obj.gif"); //$NON-NLS-1$
457 public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PRIVATE = create(
458 T_OBJ, "innerclass_private_obj.gif"); //$NON-NLS-1$
460 public static final ImageDescriptor DESC_OBJS_CLASSALT = createManaged(
461 T_OBJ, IMG_OBJS_CLASSALT);
463 public static final ImageDescriptor DESC_OBJS_INTERFACE = createManaged(
464 T_OBJ, IMG_OBJS_INTERFACE);
466 public static final ImageDescriptor DESC_OBJS_INTERFACE_DEFAULT = createManaged(
467 T_OBJ, IMG_OBJS_INTERFACE_DEFAULT);
469 public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PUBLIC = create(
470 T_OBJ, "innerinterface_public_obj.gif"); //$NON-NLS-1$
472 public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_DEFAULT = create(
473 T_OBJ, "innerinterface_default_obj.gif"); //$NON-NLS-1$
475 public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PROTECTED = create(
476 T_OBJ, "innerinterface_protected_obj.gif"); //$NON-NLS-1$
478 public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PRIVATE = create(
479 T_OBJ, "innerinterface_private_obj.gif"); //$NON-NLS-1$
481 public static final ImageDescriptor DESC_OBJS_INTERFACEALT = createManaged(
482 T_OBJ, IMG_OBJS_INTERFACEALT);
484 public static final ImageDescriptor DESC_OBJS_JAR = createManaged(T_OBJ,
487 public static final ImageDescriptor DESC_OBJS_MISSING_JAR = createManaged(
488 T_OBJ, IMG_OBJS_MISSING_JAR);
490 public static final ImageDescriptor DESC_OBJS_EXTJAR = createManaged(T_OBJ,
493 public static final ImageDescriptor DESC_OBJS_JAR_WSRC = createManaged(
494 T_OBJ, IMG_OBJS_JAR_WSRC);
496 public static final ImageDescriptor DESC_OBJS_EXTJAR_WSRC = createManaged(
497 T_OBJ, IMG_OBJS_EXTJAR_WSRC);
499 public static final ImageDescriptor DESC_OBJS_ENV_VAR = createManaged(
500 T_OBJ, IMG_OBJS_ENV_VAR);
502 public static final ImageDescriptor DESC_OBJS_MISSING_ENV_VAR = createManaged(
503 T_OBJ, IMG_OBJS_MISSING_ENV_VAR);
505 public static final ImageDescriptor DESC_OBJS_LIBRARY = createManaged(
506 T_OBJ, IMG_OBJS_LIBRARY);
508 public static final ImageDescriptor DESC_OBJS_JAVADOCTAG = createManaged(
509 T_OBJ, IMG_OBJS_JAVADOCTAG);
511 public static final ImageDescriptor DESC_OBJS_HTMLTAG = createManaged(
512 T_OBJ, IMG_OBJS_HTMLTAG);
514 public static final ImageDescriptor DESC_OBJS_TEMPLATE = createManaged(
515 T_OBJ, IMG_OBJS_TEMPLATE);
517 public static final ImageDescriptor DESC_OBJS_EXCEPTION = createManaged(
518 T_OBJ, IMG_OBJS_EXCEPTION);
520 public static final ImageDescriptor DESC_OBJS_BREAKPOINT_INSTALLED = createManaged(
521 T_OBJ, IMG_OBJS_BREAKPOINT_INSTALLED);
523 public static final ImageDescriptor DESC_OBJS_ERROR = createManaged(T_OBJ,
526 public static final ImageDescriptor DESC_OBJS_FIXABLE_PROBLEM = createManaged(
527 T_OBJ, IMG_OBJS_FIXABLE_PROBLEM);
529 public static final ImageDescriptor DESC_OBJS_FIXABLE_ERROR = createManaged(
530 T_OBJ, IMG_OBJS_FIXABLE_ERROR);
532 public static final ImageDescriptor DESC_OBJS_SNIPPET_EVALUATING = createManaged(
533 T_OBJ, IMG_OBJS_SNIPPET_EVALUATING);
535 public static final ImageDescriptor DESC_OBJS_DEFAULT_CHANGE = create(
536 T_OBJ, "change.gif"); //$NON-NLS-1$
538 public static final ImageDescriptor DESC_OBJS_COMPOSITE_CHANGE = create(
539 T_OBJ, "composite_change.gif"); //$NON-NLS-1$
541 public static final ImageDescriptor DESC_OBJS_CU_CHANGE = create(T_OBJ,
542 "cu_change.gif"); //$NON-NLS-1$
544 public static final ImageDescriptor DESC_OBJS_FILE_CHANGE = create(T_OBJ,
545 "file_change.gif"); //$NON-NLS-1$
547 public static final ImageDescriptor DESC_OBJS_TEXT_EDIT = create(T_OBJ,
548 "text_edit.gif"); //$NON-NLS-1$
550 public static final ImageDescriptor DESC_OBJS_EXCLUSION_FILTER_ATTRIB = create(
551 T_OBJ, "exclusion_filter_attrib.gif"); //$NON-NLS-1$
553 public static final ImageDescriptor DESC_OBJS_OUTPUT_FOLDER_ATTRIB = create(
554 T_OBJ, "output_folder_attrib.gif"); //$NON-NLS-1$
556 public static final ImageDescriptor DESC_OBJS_SOURCE_ATTACH_ATTRIB = create(
557 T_OBJ, "source_attach_attrib.gif"); //$NON-NLS-1$
559 public static final ImageDescriptor DESC_OBJS_JAVADOC_LOCATION_ATTRIB = create(
560 T_OBJ, "javadoc_location_attrib.gif"); //$NON-NLS-1$
562 public static final ImageDescriptor DESC_OBJS_REFACTORING_FATAL = createManaged(
563 T_OBJ, IMG_OBJS_REFACTORING_FATAL);
565 public static final ImageDescriptor DESC_OBJS_REFACTORING_ERROR = createManaged(
566 T_OBJ, IMG_OBJS_REFACTORING_ERROR);
568 public static final ImageDescriptor DESC_OBJS_REFACTORING_WARNING = createManaged(
569 T_OBJ, IMG_OBJS_REFACTORING_WARNING);
571 public static final ImageDescriptor DESC_OBJS_REFACTORING_INFO = createManaged(
572 T_OBJ, IMG_OBJS_REFACTORING_INFO);
574 public static final ImageDescriptor DESC_OBJS_NLS_TRANSLATE = createManaged(
575 T_OBJ, IMG_OBJS_NLS_TRANSLATE);
577 public static final ImageDescriptor DESC_OBJS_NLS_NEVER_TRANSLATE = createManaged(
578 T_OBJ, IMG_OBJS_NLS_NEVER_TRANSLATE);
580 public static final ImageDescriptor DESC_OBJS_NLS_SKIP = createManaged(
581 T_OBJ, IMG_OBJS_NLS_SKIP);
583 public static final ImageDescriptor DESC_OBJS_UNKNOWN = createManaged(
584 T_OBJ, IMG_OBJS_UNKNOWN);
586 public static final ImageDescriptor DESC_OBJS_SEARCH_READACCESS = createManaged(
587 T_OBJ, IMG_OBJS_SEARCH_READACCESS);
589 public static final ImageDescriptor DESC_OBJS_SEARCH_WRITEACCESS = createManaged(
590 T_OBJ, IMG_OBJS_SEARCH_WRITEACCESS);
592 public static final ImageDescriptor DESC_OBJS_SEARCH_OCCURRENCE = createManaged(
593 T_OBJ, IMG_OBJS_SEARCH_OCCURRENCE);
595 public static final ImageDescriptor DESC_OBJS_LOCAL_VARIABLE = create(
596 T_OBJ, "localvariable_obj.gif"); //$NON-NLS-1$
598 public static final ImageDescriptor DESC_OVR_STATIC = create(T_OVR,
599 "static_co.gif"); //$NON-NLS-1$
601 public static final ImageDescriptor DESC_OVR_FINAL = create(T_OVR,
602 "final_co.gif"); //$NON-NLS-1$
604 public static final ImageDescriptor DESC_OVR_ABSTRACT = create(T_OVR,
605 "abstract_co.gif"); //$NON-NLS-1$
607 public static final ImageDescriptor DESC_OVR_SYNCH = create(T_OVR,
608 "synch_co.gif"); //$NON-NLS-1$
610 public static final ImageDescriptor DESC_OVR_RUN = create(T_OVR,
611 "run_co.gif"); //$NON-NLS-1$
613 public static final ImageDescriptor DESC_OVR_WARNING = create(T_OVR,
614 "warning_co.gif"); //$NON-NLS-1$
616 public static final ImageDescriptor DESC_OVR_ERROR = create(T_OVR,
617 "error_co.gif"); //$NON-NLS-1$
619 public static final ImageDescriptor DESC_OVR_OVERRIDES = create(T_OVR,
620 "over_co.gif"); //$NON-NLS-1$
622 public static final ImageDescriptor DESC_OVR_IMPLEMENTS = create(T_OVR,
623 "implm_co.gif"); //$NON-NLS-1$
625 public static final ImageDescriptor DESC_OVR_CONSTRUCTOR = create(T_OVR,
626 "constr_ovr.gif"); //$NON-NLS-1$
628 public static final ImageDescriptor DESC_OVR_FOCUS = create(T_OVR,
629 "focus_ovr.gif"); //$NON-NLS-1$
631 public static final ImageDescriptor DESC_WIZBAN_NEWFIELD = create(T_WIZBAN,
632 "newfield_wiz.gif"); //$NON-NLS-1$
634 public static final ImageDescriptor DESC_WIZBAN_NEWINT = create(T_WIZBAN,
635 "newint_wiz.gif"); //$NON-NLS-1$
637 public static final ImageDescriptor DESC_WIZBAN_NEWJPRJ = create(T_WIZBAN,
638 "newjprj_wiz.gif"); //$NON-NLS-1$
640 public static final ImageDescriptor DESC_WIZBAN_NEWSRCFOLDR = create(
641 T_WIZBAN, "newsrcfldr_wiz.gif"); //$NON-NLS-1$
643 public static final ImageDescriptor DESC_WIZBAN_NEWMETH = create(T_WIZBAN,
644 "newmeth_wiz.gif"); //$NON-NLS-1$
646 public static final ImageDescriptor DESC_WIZBAN_NEWPACK = create(T_WIZBAN,
647 "newpack_wiz.gif"); //$NON-NLS-1$
649 public static final ImageDescriptor DESC_WIZBAN_NEWSCRAPPAGE = create(
650 T_WIZBAN, "newsbook_wiz.gif"); //$NON-NLS-1$
652 public static final ImageDescriptor DESC_WIZBAN_JAVA_LAUNCH = create(
653 T_WIZBAN, "java_app_wiz.gif"); //$NON-NLS-1$
655 public static final ImageDescriptor DESC_WIZBAN_JAVA_ATTACH = create(
656 T_WIZBAN, "java_attach_wiz.gif"); //$NON-NLS-1$
658 public static final ImageDescriptor DESC_WIZBAN_REFACTOR = create(T_WIZBAN,
659 "refactor_wiz.gif"); //$NON-NLS-1$
661 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_FIELD = create(
662 T_WIZBAN, "fieldrefact_wiz.gif"); //$NON-NLS-1$
664 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_METHOD = create(
665 T_WIZBAN, "methrefact_wiz.gif"); //$NON-NLS-1$
667 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_TYPE = create(
668 T_WIZBAN, "typerefact_wiz.gif"); //$NON-NLS-1$
670 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PACKAGE = create(
671 T_WIZBAN, "packrefact_wiz.gif"); //$NON-NLS-1$
673 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CODE = create(
674 T_WIZBAN, "coderefact_wiz.gif"); //$NON-NLS-1$
676 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CU = create(
677 T_WIZBAN, "compunitrefact_wiz.gif"); //$NON-NLS-1$
679 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PULL_UP = create(
680 T_WIZBAN, "pullup_wiz.gif"); //$NON-NLS-1$
682 public static final ImageDescriptor DESC_WIZBAN_JAR_PACKAGER = create(
683 T_WIZBAN, "jar_pack_wiz.gif"); //$NON-NLS-1$
685 public static final ImageDescriptor DESC_WIZBAN_JAVA_WORKINGSET = create(
686 T_WIZBAN, "java_workingset_wiz.gif");//$NON-NLS-1$
688 public static final ImageDescriptor DESC_WIZBAN_EXPORT_JAVADOC = create(
689 T_WIZBAN, "export_javadoc_wiz.gif");//$NON-NLS-1$
691 public static final ImageDescriptor DESC_WIZBAN_EXTERNALIZE_STRINGS = create(
692 T_WIZBAN, "extstr_wiz.gif");//$NON-NLS-1$
694 public static final ImageDescriptor DESC_WIZBAN_ADD_LIBRARY = create(
695 T_WIZBAN, "addlibrary_wiz.gif");//$NON-NLS-1$
697 public static final ImageDescriptor DESC_TOOL_DISPLAYSNIPPET = create(
698 T_CTOOL, "disp_sbook.gif"); //$NON-NLS-1$
700 public static final ImageDescriptor DESC_TOOL_RUNSNIPPET = create(T_CTOOL,
701 "run_sbook.gif"); //$NON-NLS-1$
703 public static final ImageDescriptor DESC_TOOL_INSPSNIPPET = create(T_CTOOL,
704 "insp_sbook.gif"); //$NON-NLS-1$
706 public static final ImageDescriptor DESC_TOOL_PACKSNIPPET = create(T_CTOOL,
707 "pack_sbook.gif"); //$NON-NLS-1$
709 public static final ImageDescriptor DESC_TOOL_TERMSNIPPET = create(T_CTOOL,
710 "term_sbook.gif"); //$NON-NLS-1$
712 public static final ImageDescriptor DESC_TOOL_SHOW_EMPTY_PKG = create(
713 T_CTOOL, "show_empty_pkg.gif"); //$NON-NLS-1$
715 public static final ImageDescriptor DESC_TOOL_SHOW_SEGMENTS = create(
716 T_CTOOL, "segment_edit.gif"); //$NON-NLS-1$
718 public static final ImageDescriptor DESC_TOOL_GOTO_NEXT_ERROR = create(
719 T_CTOOL, "next_error_nav.gif"); //$NON-NLS-1$
721 public static final ImageDescriptor DESC_TOOL_GOTO_PREV_ERROR = create(
722 T_CTOOL, "prev_error_nav.gif"); //$NON-NLS-1$
724 public static final ImageDescriptor DESC_TOOL_OPENTYPE = create(T_CTOOL,
725 "opentype.gif"); //$NON-NLS-1$
727 public static final ImageDescriptor DESC_TOOL_NEWPROJECT = create(T_CTOOL,
728 "newjprj_wiz.gif"); //$NON-NLS-1$
730 public static final ImageDescriptor DESC_TOOL_NEWPACKAGE = create(T_CTOOL,
731 "newpack_wiz.gif"); //$NON-NLS-1$
733 public static final ImageDescriptor DESC_TOOL_NEWCLASS = create(T_CTOOL,
734 "newclass_wiz.gif"); //$NON-NLS-1$
736 public static final ImageDescriptor DESC_TOOL_NEWINTERFACE = create(
737 T_CTOOL, "newint_wiz.gif"); //$NON-NLS-1$
739 public static final ImageDescriptor DESC_TOOL_NEWSNIPPET = create(T_CTOOL,
740 "newsbook_wiz.gif"); //$NON-NLS-1$
742 public static final ImageDescriptor DESC_TOOL_NEWPACKROOT = create(T_CTOOL,
743 "newpackfolder_wiz.gif"); //$NON-NLS-1$
745 public static final ImageDescriptor DESC_TOOL_CLASSPATH_ORDER = create(
746 T_OBJ, "cp_order_obj.gif"); //$NON-NLS-1$
748 // Keys for correction proposal. We have to put the image into the registry
749 // since "code assist" doesn't
750 // have a life cycle. So no change to dispose icons.
752 public static final String IMG_CORRECTION_CHANGE = NAME_PREFIX
753 + "correction_change.gif"; //$NON-NLS-1$
755 public static final String IMG_CORRECTION_MOVE = NAME_PREFIX
756 + "correction_move.gif"; //$NON-NLS-1$
758 public static final String IMG_CORRECTION_RENAME = NAME_PREFIX
759 + "correction_rename.gif"; //$NON-NLS-1$
761 public static final String IMG_CORRECTION_DELETE_IMPORT = NAME_PREFIX
762 + "correction_delete_import.gif"; //$NON-NLS-1$
764 public static final String IMG_CORRECTION_LOCAL = NAME_PREFIX
765 + "localvariable_obj.gif"; //$NON-NLS-1$
767 public static final String IMG_CORRECTION_REMOVE = NAME_PREFIX
768 + "remove_correction.gif"; //$NON-NLS-1$
770 public static final String IMG_CORRECTION_ADD = NAME_PREFIX
771 + "add_correction.gif"; //$NON-NLS-1$
774 createManaged(T_OBJ, IMG_CORRECTION_CHANGE);
775 createManaged(T_OBJ, IMG_CORRECTION_MOVE);
776 createManaged(T_OBJ, IMG_CORRECTION_RENAME);
777 createManaged(T_OBJ, IMG_CORRECTION_DELETE_IMPORT);
778 createManaged(T_OBJ, IMG_CORRECTION_LOCAL);
779 createManaged(T_OBJ, IMG_CORRECTION_REMOVE);
780 createManaged(T_OBJ, IMG_CORRECTION_ADD);
784 * Returns the image managed under the given key in this registry.
788 * @return the image managed under the given key
790 public static Image get(String key) {
791 return getImageRegistry().get(key);
795 * Returns the image descriptor for the given key in this registry. Might be
796 * called in a non-UI thread.
800 * @return the image descriptor for the given key
802 public static ImageDescriptor getDescriptor(String key) {
803 if (fgImageRegistry == null) {
804 return (ImageDescriptor) fgAvoidSWTErrorMap.get(key);
806 return getImageRegistry().getDescriptor(key);
810 * Sets the three image descriptors for enabled, disabled, and hovered to an
811 * action. The actions are retrieved from the *tool16 folders.
813 public static void setToolImageDescriptors(IAction action, String iconName) {
814 setImageDescriptors(action, "tool16", iconName);
818 * Sets the three image descriptors for enabled, disabled, and hovered to an
819 * action. The actions are retrieved from the *lcl16 folders.
821 public static void setLocalImageDescriptors(IAction action, String iconName) {
822 setImageDescriptors(action, "lcl16", iconName);
826 * Helper method to access the image registry from the JavaPlugin class.
828 /* package */static ImageRegistry getImageRegistry() {
829 if (fgImageRegistry == null) {
830 fgImageRegistry = new ImageRegistry();
831 for (Iterator iter = fgAvoidSWTErrorMap.keySet().iterator(); iter
833 String key = (String) iter.next();
834 fgImageRegistry.put(key, (ImageDescriptor) fgAvoidSWTErrorMap
837 fgAvoidSWTErrorMap = null;
839 return fgImageRegistry;
842 // ---- Helper methods to access icons on the file system
843 // --------------------------------------
845 protected static void setImageDescriptors(IAction action, String type,
849 ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL(
850 "d" + type, relPath));
852 action.setDisabledImageDescriptor(id);
853 } catch (MalformedURLException e) {
857 ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL(
858 "c" + type, relPath));
860 action.setHoverImageDescriptor(id);
861 } catch (MalformedURLException e) {
864 action.setImageDescriptor(create("e" + type, relPath));
867 private static ImageDescriptor createManaged(String prefix, String name) {
869 ImageDescriptor result = ImageDescriptor
870 .createFromURL(makeIconFileURL(prefix, name
871 .substring(NAME_PREFIX_LENGTH)));
872 if (fgAvoidSWTErrorMap == null) {
873 fgAvoidSWTErrorMap = new HashMap();
875 fgAvoidSWTErrorMap.put(name, result);
876 if (fgImageRegistry != null) {
878 .logErrorMessage("Image registry already defined"); //$NON-NLS-1$
881 } catch (MalformedURLException e) {
882 return ImageDescriptor.getMissingImageDescriptor();
886 private static ImageDescriptor createManaged(String prefix, String name,
889 ImageDescriptor result = ImageDescriptor
890 .createFromURL(makeIconFileURL(prefix, name
891 .substring(NAME_PREFIX_LENGTH)));
892 if (fgAvoidSWTErrorMap == null) {
893 fgAvoidSWTErrorMap = new HashMap();
895 fgAvoidSWTErrorMap.put(key, result);
896 if (fgImageRegistry != null) {
898 .logErrorMessage("Image registry already defined"); //$NON-NLS-1$
901 } catch (MalformedURLException e) {
902 return ImageDescriptor.getMissingImageDescriptor();
906 protected static ImageDescriptor create(String prefix, String name) {
908 return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
909 } catch (MalformedURLException e) {
910 return ImageDescriptor.getMissingImageDescriptor();
914 protected static URL makeIconFileURL(String prefix, String name)
915 throws MalformedURLException {
916 if (fgIconBaseURL == null)
917 throw new MalformedURLException();
919 StringBuffer buffer = new StringBuffer(prefix);
922 return new URL(fgIconBaseURL, buffer.toString());