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;
10 import org.eclipse.jface.action.IAction;
11 import org.eclipse.jface.resource.ImageDescriptor;
12 import org.eclipse.jface.resource.ImageRegistry;
13 import org.eclipse.swt.graphics.Image;
15 public class PHPUiImages {
17 protected static final String NAME_PREFIX = "net.sourceforge.phpdt.internal.ui.";
19 protected static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
21 protected static URL fgIconBaseURL = null;
24 // String pathSuffix = "icons/";
33 // } catch (MalformedURLException e) {
34 // PHPeclipsePlugin.log(e);
38 // Determine display depth. If depth > 4 then we use high color images.
39 // Otherwise low color
42 fgIconBaseURL = PHPeclipsePlugin.getDefault().getBundle().getEntry(
43 "/icons/"); //$NON-NLS-1$
46 private static ImageRegistry fgImageRegistry = null;
48 private static HashMap fgAvoidSWTErrorMap = null;
50 protected static final String OBJ_PREFIX = "obj16";
52 protected static final String OVR_PREFIX = "ovr16";
54 protected static final String CTOOL_PREFIX = "ctool16";
56 public static final String IMG_CLASS = NAME_PREFIX
57 + "class_default_obj.gif";
59 public static final String IMG_DEFINE = NAME_PREFIX + "define_obj.gif";
61 public static final String IMG_BUILTIN = NAME_PREFIX + "builtin_obj.gif";
63 public static final String IMG_FUN = NAME_PREFIX + "fun_obj.gif";
65 public static final String IMG_INC = NAME_PREFIX + "impc_obj.gif";
67 public static final String IMG_VAR = NAME_PREFIX + "var_obj.gif";
69 public static final String IMG_TABLE = NAME_PREFIX + "table_obj.gif";
71 public static final String IMG_COLUMN = NAME_PREFIX + "column_obj.gif";
73 public static final String IMG_OBJS_WARNING = NAME_PREFIX
76 public static final String IMG_OBJS_INFO = NAME_PREFIX + "info_obj.gif";
78 public static final String IMG_CTOOLS_PHP_PAGE = NAME_PREFIX
81 public static final String IMG_CTOOLS_PHP = NAME_PREFIX + "php.gif";
83 public static final String IMG_CLEAR = NAME_PREFIX + "clear.gif";
85 public static final ImageDescriptor DESC_CLASS = createManaged(OBJ_PREFIX,
88 public static final ImageDescriptor DESC_DEFINE = createManaged(OBJ_PREFIX,
91 public static final ImageDescriptor DESC_BUILTIN = createManaged(
92 OBJ_PREFIX, IMG_BUILTIN);
94 public static final ImageDescriptor DESC_FUN = createManaged(OBJ_PREFIX,
97 public static final ImageDescriptor DESC_INC = createManaged(OBJ_PREFIX,
100 public static final ImageDescriptor DESC_VAR = createManaged(OBJ_PREFIX,
103 public static final ImageDescriptor DESC_TABLE = createManaged(OBJ_PREFIX,
106 public static final ImageDescriptor DESC_COLUMN = createManaged(OBJ_PREFIX,
109 public static final ImageDescriptor DESC_OBJS_WARNING = createManaged(
110 OBJ_PREFIX, IMG_OBJS_WARNING);
112 public static final ImageDescriptor DESC_OBJS_INFO = createManaged(
113 OBJ_PREFIX, IMG_OBJS_INFO);
115 public static final ImageDescriptor DESC_CTOOL_PHP_PAGE = createManaged(
116 CTOOL_PREFIX, IMG_CTOOLS_PHP_PAGE);
118 public static final ImageDescriptor DESC_CTOOL_PHP = createManaged(
119 CTOOL_PREFIX, IMG_CTOOLS_PHP);
121 public static final ImageDescriptor DESC_CLEAR = createManaged(OBJ_PREFIX,
125 * Set of predefined Image Descriptors.
127 private static final String T_OBJ = "obj16"; //$NON-NLS-1$
129 private static final String T_OVR = "ovr16"; //$NON-NLS-1$
131 private static final String T_WIZBAN = "wizban"; //$NON-NLS-1$
133 private static final String T_CLCL = "clcl16"; //$NON-NLS-1$
135 private static final String T_DLCL = "dlcl16"; //$NON-NLS-1$
137 private static final String T_ELCL = "elcl16"; //$NON-NLS-1$
139 private static final String T_CTOOL = "ctool16"; //$NON-NLS-1$
141 private static final String T_CVIEW = "cview16"; //$NON-NLS-1$
143 public static final ImageDescriptor DESC_WIZBAN_NEWCLASS = create(T_WIZBAN,
144 "newclass_wiz.gif"); //$NON-NLS-1$
146 public static final ImageDescriptor DESC_ELCL_FILTER = create(T_ELCL,
147 "filter_ps.gif"); //$NON-NLS-1$
149 public static final ImageDescriptor DESC_DLCL_FILTER = create(T_DLCL,
150 "filter_ps.gif"); //$NON-NLS-1$
153 * Available cached Images in the Java plugin image registry.
155 public static final String IMG_MISC_PUBLIC = NAME_PREFIX
156 + "methpub_obj.gif"; //$NON-NLS-1$
158 public static final String IMG_MISC_PROTECTED = NAME_PREFIX
159 + "methpro_obj.gif"; //$NON-NLS-1$
161 public static final String IMG_MISC_PRIVATE = NAME_PREFIX
162 + "methpri_obj.gif"; //$NON-NLS-1$
164 public static final String IMG_MISC_DEFAULT = NAME_PREFIX
165 + "methdef_obj.gif"; //$NON-NLS-1$
167 public static final String IMG_FIELD_PUBLIC = NAME_PREFIX
168 + "field_public_obj.gif"; //$NON-NLS-1$
170 public static final String IMG_FIELD_PROTECTED = NAME_PREFIX
171 + "field_protected_obj.gif"; //$NON-NLS-1$
173 public static final String IMG_FIELD_PRIVATE = NAME_PREFIX
174 + "field_private_obj.gif"; //$NON-NLS-1$
176 public static final String IMG_FIELD_DEFAULT = NAME_PREFIX
177 + "field_default_obj.gif"; //$NON-NLS-1$
179 public static final String IMG_OBJS_GHOST = NAME_PREFIX + "ghost.gif"; //$NON-NLS-1$
181 public static final String IMG_OBJS_SEARCH_TSK = NAME_PREFIX
182 + "search_tsk.gif"; //$NON-NLS-1$
184 public static final String IMG_OBJS_PACKDECL = NAME_PREFIX
185 + "packd_obj.gif"; //$NON-NLS-1$
187 public static final String IMG_OBJS_IMPDECL = NAME_PREFIX + "imp_obj.gif"; //$NON-NLS-1$
189 public static final String IMG_OBJS_IMPCONT = NAME_PREFIX + "impc_obj.gif"; //$NON-NLS-1$
191 public static final String IMG_OBJS_JSEARCH = NAME_PREFIX
192 + "jsearch_obj.gif"; //$NON-NLS-1$
194 public static final String IMG_OBJS_SEARCH_DECL = NAME_PREFIX
195 + "search_decl_obj.gif"; //$NON-NLS-1$
197 public static final String IMG_OBJS_SEARCH_REF = NAME_PREFIX
198 + "search_ref_obj.gif"; //$NON-NLS-1$
200 public static final String IMG_OBJS_CLASS = NAME_PREFIX + "class_obj.gif"; //$NON-NLS-1$
202 public static final String IMG_OBJS_CLASSALT = NAME_PREFIX
203 + "classfo_obj.gif"; //$NON-NLS-1$
205 public static final String IMG_OBJS_CLASS_DEFAULT = NAME_PREFIX
206 + "class_default_obj.gif"; //$NON-NLS-1$
208 public static final String IMG_OBJS_INTERFACE = NAME_PREFIX + "int_obj.gif"; //$NON-NLS-1$
210 public static final String IMG_OBJS_INTERFACEALT = NAME_PREFIX
211 + "intf_obj.gif"; //$NON-NLS-1$
213 public static final String IMG_OBJS_INTERFACE_DEFAULT = NAME_PREFIX
214 + "int_default_obj.gif"; //$NON-NLS-1$
216 public static final String IMG_OBJS_CUNIT = NAME_PREFIX + "phpedit.png"; //$NON-NLS-1$
218 public static final String IMG_OBJS_CUNIT_RESOURCE = NAME_PREFIX
219 + "jcu_resource_obj.gif"; //$NON-NLS-1$
221 public static final String IMG_OBJS_CFILE = NAME_PREFIX + "classf_obj.gif"; //$NON-NLS-1$
223 public static final String IMG_OBJS_CFILECLASS = NAME_PREFIX
224 + "class_obj.gif"; //$NON-NLS-1$
226 public static final String IMG_OBJS_CFILEINT = NAME_PREFIX + "int_obj.gif"; //$NON-NLS-1$
228 public static final String IMG_OBJS_LOGICAL_PACKAGE = NAME_PREFIX
229 + "logical_package_obj.gif";//$NON-NLS-1$
231 public static final String IMG_OJS_EMPTY_LOGICAL_PACKAGE = NAME_PREFIX
232 + "empty_logical_package_obj.gif";//$NON-NLS-1$
234 public static final String IMG_OBJS_PACKAGE = NAME_PREFIX
235 + "package_obj.gif"; //$NON-NLS-1$
237 public static final String IMG_OBJS_EMPTY_PACK_RESOURCE = NAME_PREFIX
238 + "empty_pack_fldr_obj.gif"; //$NON-NLS-1$
240 public static final String IMG_OBJS_EMPTY_PACKAGE = NAME_PREFIX
241 + "empty_pack_obj.gif"; //$NON-NLS-1$
243 public static final String IMG_OBJS_PACKFRAG_ROOT = NAME_PREFIX
244 + "packagefolder_obj.gif"; //$NON-NLS-1$
246 public static final String IMG_OBJS_MISSING_PACKFRAG_ROOT = NAME_PREFIX
247 + "packagefolder_nonexist_obj.gif"; //$NON-NLS-1$
249 public static final String IMG_OBJS_MISSING_JAR = NAME_PREFIX
250 + "jar_nonexist_obj.gif"; //$NON-NLS-1$
252 public static final String IMG_OBJS_JAR = NAME_PREFIX + "jar_obj.gif"; //$NON-NLS-1$
254 public static final String IMG_OBJS_EXTJAR = NAME_PREFIX + "jar_l_obj.gif"; //$NON-NLS-1$
256 public static final String IMG_OBJS_JAR_WSRC = NAME_PREFIX
257 + "jar_src_obj.gif"; //$NON-NLS-1$
259 public static final String IMG_OBJS_EXTJAR_WSRC = NAME_PREFIX
260 + "jar_lsrc_obj.gif"; //$NON-NLS-1$
262 public static final String IMG_OBJS_ENV_VAR = NAME_PREFIX
263 + "envvar_obj.gif"; //$NON-NLS-1$
265 public static final String IMG_OBJS_MISSING_ENV_VAR = NAME_PREFIX
266 + "envvar_nonexist_obj.gif"; //$NON-NLS-1$
268 public static final String IMG_OBJS_JAVA_MODEL = NAME_PREFIX
269 + "java_model_obj.gif"; //$NON-NLS-1$
271 public static final String IMG_OBJS_UNKNOWN = NAME_PREFIX
272 + "unknown_obj.gif"; //$NON-NLS-1$
274 public static final String IMG_OBJS_LIBRARY = NAME_PREFIX
275 + "library_obj.gif"; //$NON-NLS-1$
277 public static final String IMG_OBJS_JAVADOCTAG = NAME_PREFIX
278 + "jdoc_tag_obj.gif"; //$NON-NLS-1$
280 public static final String IMG_OBJS_HTMLTAG = NAME_PREFIX
281 + "html_tag_obj.gif"; //$NON-NLS-1$
283 public static final String IMG_OBJS_TEMPLATE = NAME_PREFIX
284 + "template_obj.gif"; //$NON-NLS-1$
286 public static final String IMG_OBJS_EXCEPTION = NAME_PREFIX
287 + "jexception_obj.gif"; //$NON-NLS-1$
289 public static final String IMG_OBJS_ERROR = NAME_PREFIX
290 + "jrtexception_obj.gif"; //$NON-NLS-1$
292 public static final String IMG_OBJS_BREAKPOINT_INSTALLED = NAME_PREFIX
293 + "brkpi_obj.gif"; //$NON-NLS-1$
295 public static final String IMG_OBJS_FIXABLE_PROBLEM = NAME_PREFIX
296 + "quickfix_warning_obj.gif"; //$NON-NLS-1$
298 public static final String IMG_OBJS_FIXABLE_ERROR = NAME_PREFIX
299 + "quickfix_error_obj.gif"; //$NON-NLS-1$
301 public static final String IMG_OBJS_SNIPPET_EVALUATING = NAME_PREFIX
302 + "jsbook_run_obj.gif"; //$NON-NLS-1$
304 public static final String IMG_OBJS_REFACTORING_FATAL = NAME_PREFIX
305 + "fatalerror_obj.gif"; //$NON-NLS-1$
307 public static final String IMG_OBJS_REFACTORING_ERROR = NAME_PREFIX
308 + "error_obj.gif"; //$NON-NLS-1$
310 public static final String IMG_OBJS_REFACTORING_WARNING = NAME_PREFIX
311 + "warning_obj.gif"; //$NON-NLS-1$
313 public static final String IMG_OBJS_REFACTORING_INFO = NAME_PREFIX
314 + "info_obj.gif"; //$NON-NLS-1$
316 public static final String IMG_OBJS_NLS_TRANSLATE = NAME_PREFIX
317 + "translate.gif"; //$NON-NLS-1$
319 public static final String IMG_OBJS_NLS_NEVER_TRANSLATE = NAME_PREFIX
320 + "never_translate.gif"; //$NON-NLS-1$
322 public static final String IMG_OBJS_NLS_SKIP = NAME_PREFIX + "skip.gif"; //$NON-NLS-1$
324 public static final String IMG_OBJS_SEARCH_READACCESS = NAME_PREFIX
325 + "occ_read.gif"; //$NON-NLS-1$
327 public static final String IMG_OBJS_SEARCH_WRITEACCESS = NAME_PREFIX
328 + "occ_write.gif"; //$NON-NLS-1$
330 public static final String IMG_OBJS_SEARCH_OCCURRENCE = NAME_PREFIX
331 + "occ_match.gif"; //$NON-NLS-1$
333 public static final ImageDescriptor DESC_VIEW_ERRORWARNING_TAB = create(
334 T_CVIEW, "errorwarning_tab.gif"); //$NON-NLS-1$
336 public static final ImageDescriptor DESC_VIEW_CLASSFILEGENERATION_TAB = create(
337 T_CVIEW, "classfilegeneration_tab.gif"); //$NON-NLS-1$
339 public static final ImageDescriptor DESC_VIEW_JDKCOMPLIANCE_TAB = create(
340 T_CVIEW, "jdkcompliance_tab.gif"); //$NON-NLS-1$
342 public static final ImageDescriptor DESC_CLCL_FILTER = create(T_CLCL,
343 "filter_ps.gif"); //$NON-NLS-1$
345 public static final ImageDescriptor DESC_CLCL_CODE_ASSIST = create(T_CLCL,
346 "metharg_obj.gif"); //$NON-NLS-1$
348 public static final ImageDescriptor DESC_DLCL_CODE_ASSIST = create(T_DLCL,
349 "metharg_obj.gif"); //$NON-NLS-1$
351 public static final ImageDescriptor DESC_MISC_PUBLIC = createManaged(T_OBJ,
354 public static final ImageDescriptor DESC_MISC_PROTECTED = createManaged(
355 T_OBJ, IMG_MISC_PROTECTED);
357 public static final ImageDescriptor DESC_MISC_PRIVATE = createManaged(
358 T_OBJ, IMG_MISC_PRIVATE);
360 public static final ImageDescriptor DESC_MISC_DEFAULT = createManaged(
361 T_OBJ, IMG_MISC_DEFAULT);
363 public static final ImageDescriptor DESC_FIELD_PUBLIC = createManaged(
364 T_OBJ, IMG_FIELD_PUBLIC); //$NON-NLS-1$
366 public static final ImageDescriptor DESC_FIELD_PROTECTED = createManaged(
367 T_OBJ, IMG_FIELD_PROTECTED); //$NON-NLS-1$
369 public static final ImageDescriptor DESC_FIELD_PRIVATE = createManaged(
370 T_OBJ, IMG_FIELD_PRIVATE); //$NON-NLS-1$
372 public static final ImageDescriptor DESC_FIELD_DEFAULT = createManaged(
373 T_OBJ, IMG_FIELD_DEFAULT); //$NON-NLS-1$
375 public static final ImageDescriptor DESC_MENU_SHIFT_RIGHT = create(T_CTOOL,
376 "shift_r_edit.gif"); //$NON-NLS-1$
378 public static final ImageDescriptor DESC_MENU_SHIFT_LEFT = create(T_CTOOL,
379 "shift_l_edit.gif"); //$NON-NLS-1$
381 public static final ImageDescriptor DESC_OBJS_GHOST = createManaged(T_OBJ,
384 public static final ImageDescriptor DESC_OBJS_PACKDECL = createManaged(
385 T_OBJ, IMG_OBJS_PACKDECL);
387 public static final ImageDescriptor DESC_OBJS_IMPDECL = createManaged(
388 T_OBJ, IMG_OBJS_IMPDECL);
390 public static final ImageDescriptor DESC_OBJS_IMPCONT = createManaged(
391 T_OBJ, IMG_OBJS_IMPCONT);
393 public static final ImageDescriptor DESC_OBJS_JSEARCH = createManaged(
394 T_OBJ, IMG_OBJS_JSEARCH);
396 public static final ImageDescriptor DESC_OBJS_SEARCH_DECL = createManaged(
397 T_OBJ, IMG_OBJS_SEARCH_DECL);
399 public static final ImageDescriptor DESC_OBJS_SEARCH_REF = createManaged(
400 T_OBJ, IMG_OBJS_SEARCH_REF);
402 public static final ImageDescriptor DESC_OBJS_CUNIT = createManaged(T_OBJ,
405 public static final ImageDescriptor DESC_OBJS_CUNIT_RESOURCE = createManaged(
406 T_OBJ, IMG_OBJS_CUNIT_RESOURCE);
408 public static final ImageDescriptor DESC_OBJS_CFILE = createManaged(T_OBJ,
411 public static final ImageDescriptor DESC_OBJS_CFILECLASS = createManaged(
412 T_OBJ, IMG_OBJS_CFILECLASS);
414 public static final ImageDescriptor DESC_OBJS_CFILEINT = createManaged(
415 T_OBJ, IMG_OBJS_CFILEINT);
417 public static final ImageDescriptor DESC_OBJS_PACKAGE = createManaged(
418 T_OBJ, IMG_OBJS_PACKAGE);
420 public static final ImageDescriptor DESC_OBJS_EMPTY_LOGICAL_PACKAGE = createManaged(
421 T_OBJ, IMG_OJS_EMPTY_LOGICAL_PACKAGE);
423 public static final ImageDescriptor DESC_OBJS_LOGICAL_PACKAGE = createManaged(
424 T_OBJ, IMG_OBJS_LOGICAL_PACKAGE);
426 public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE_RESOURCES = createManaged(
427 T_OBJ, IMG_OBJS_EMPTY_PACK_RESOURCE);
429 public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE = createManaged(
430 T_OBJ, IMG_OBJS_EMPTY_PACKAGE);
432 public static final ImageDescriptor DESC_OBJS_PACKFRAG_ROOT = createManaged(
433 T_OBJ, IMG_OBJS_PACKFRAG_ROOT);
435 public static final ImageDescriptor DESC_OBJS_MISSING_PACKFRAG_ROOT = createManaged(
436 T_OBJ, IMG_OBJS_MISSING_PACKFRAG_ROOT);
438 public static final ImageDescriptor DESC_OBJS_JAVA_MODEL = createManaged(
439 T_OBJ, IMG_OBJS_JAVA_MODEL);
441 public static final ImageDescriptor DESC_OBJS_CLASS = createManaged(T_OBJ,
444 public static final ImageDescriptor DESC_OBJS_CLASS_DEFAULT = createManaged(
445 T_OBJ, IMG_OBJS_CLASS_DEFAULT);
447 public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PUBLIC = create(
448 T_OBJ, "innerclass_public_obj.gif"); //$NON-NLS-1$
450 public static final ImageDescriptor DESC_OBJS_INNER_CLASS_DEFAULT = create(
451 T_OBJ, "innerclass_default_obj.gif"); //$NON-NLS-1$
453 public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PROTECTED = create(
454 T_OBJ, "innerclass_protected_obj.gif"); //$NON-NLS-1$
456 public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PRIVATE = create(
457 T_OBJ, "innerclass_private_obj.gif"); //$NON-NLS-1$
459 public static final ImageDescriptor DESC_OBJS_CLASSALT = createManaged(
460 T_OBJ, IMG_OBJS_CLASSALT);
462 public static final ImageDescriptor DESC_OBJS_INTERFACE = createManaged(
463 T_OBJ, IMG_OBJS_INTERFACE);
465 public static final ImageDescriptor DESC_OBJS_INTERFACE_DEFAULT = createManaged(
466 T_OBJ, IMG_OBJS_INTERFACE_DEFAULT);
468 public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PUBLIC = create(
469 T_OBJ, "innerinterface_public_obj.gif"); //$NON-NLS-1$
471 public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_DEFAULT = create(
472 T_OBJ, "innerinterface_default_obj.gif"); //$NON-NLS-1$
474 public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PROTECTED = create(
475 T_OBJ, "innerinterface_protected_obj.gif"); //$NON-NLS-1$
477 public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PRIVATE = create(
478 T_OBJ, "innerinterface_private_obj.gif"); //$NON-NLS-1$
480 public static final ImageDescriptor DESC_OBJS_INTERFACEALT = createManaged(
481 T_OBJ, IMG_OBJS_INTERFACEALT);
483 public static final ImageDescriptor DESC_OBJS_JAR = createManaged(T_OBJ,
486 public static final ImageDescriptor DESC_OBJS_MISSING_JAR = createManaged(
487 T_OBJ, IMG_OBJS_MISSING_JAR);
489 public static final ImageDescriptor DESC_OBJS_EXTJAR = createManaged(T_OBJ,
492 public static final ImageDescriptor DESC_OBJS_JAR_WSRC = createManaged(
493 T_OBJ, IMG_OBJS_JAR_WSRC);
495 public static final ImageDescriptor DESC_OBJS_EXTJAR_WSRC = createManaged(
496 T_OBJ, IMG_OBJS_EXTJAR_WSRC);
498 public static final ImageDescriptor DESC_OBJS_ENV_VAR = createManaged(
499 T_OBJ, IMG_OBJS_ENV_VAR);
501 public static final ImageDescriptor DESC_OBJS_MISSING_ENV_VAR = createManaged(
502 T_OBJ, IMG_OBJS_MISSING_ENV_VAR);
504 public static final ImageDescriptor DESC_OBJS_LIBRARY = createManaged(
505 T_OBJ, IMG_OBJS_LIBRARY);
507 public static final ImageDescriptor DESC_OBJS_JAVADOCTAG = createManaged(
508 T_OBJ, IMG_OBJS_JAVADOCTAG);
510 public static final ImageDescriptor DESC_OBJS_HTMLTAG = createManaged(
511 T_OBJ, IMG_OBJS_HTMLTAG);
513 public static final ImageDescriptor DESC_OBJS_TEMPLATE = createManaged(
514 T_OBJ, IMG_OBJS_TEMPLATE);
516 public static final ImageDescriptor DESC_OBJS_EXCEPTION = createManaged(
517 T_OBJ, IMG_OBJS_EXCEPTION);
519 public static final ImageDescriptor DESC_OBJS_BREAKPOINT_INSTALLED = createManaged(
520 T_OBJ, IMG_OBJS_BREAKPOINT_INSTALLED);
522 public static final ImageDescriptor DESC_OBJS_ERROR = createManaged(T_OBJ,
525 public static final ImageDescriptor DESC_OBJS_FIXABLE_PROBLEM = createManaged(
526 T_OBJ, IMG_OBJS_FIXABLE_PROBLEM);
528 public static final ImageDescriptor DESC_OBJS_FIXABLE_ERROR = createManaged(
529 T_OBJ, IMG_OBJS_FIXABLE_ERROR);
531 public static final ImageDescriptor DESC_OBJS_SNIPPET_EVALUATING = createManaged(
532 T_OBJ, IMG_OBJS_SNIPPET_EVALUATING);
534 public static final ImageDescriptor DESC_OBJS_DEFAULT_CHANGE = create(
535 T_OBJ, "change.gif"); //$NON-NLS-1$
537 public static final ImageDescriptor DESC_OBJS_COMPOSITE_CHANGE = create(
538 T_OBJ, "composite_change.gif"); //$NON-NLS-1$
540 public static final ImageDescriptor DESC_OBJS_CU_CHANGE = create(T_OBJ,
541 "cu_change.gif"); //$NON-NLS-1$
543 public static final ImageDescriptor DESC_OBJS_FILE_CHANGE = create(T_OBJ,
544 "file_change.gif"); //$NON-NLS-1$
546 public static final ImageDescriptor DESC_OBJS_TEXT_EDIT = create(T_OBJ,
547 "text_edit.gif"); //$NON-NLS-1$
549 public static final ImageDescriptor DESC_OBJS_EXCLUSION_FILTER_ATTRIB = create(
550 T_OBJ, "exclusion_filter_attrib.gif"); //$NON-NLS-1$
552 public static final ImageDescriptor DESC_OBJS_OUTPUT_FOLDER_ATTRIB = create(
553 T_OBJ, "output_folder_attrib.gif"); //$NON-NLS-1$
555 public static final ImageDescriptor DESC_OBJS_SOURCE_ATTACH_ATTRIB = create(
556 T_OBJ, "source_attach_attrib.gif"); //$NON-NLS-1$
558 public static final ImageDescriptor DESC_OBJS_JAVADOC_LOCATION_ATTRIB = create(
559 T_OBJ, "javadoc_location_attrib.gif"); //$NON-NLS-1$
561 public static final ImageDescriptor DESC_OBJS_REFACTORING_FATAL = createManaged(
562 T_OBJ, IMG_OBJS_REFACTORING_FATAL);
564 public static final ImageDescriptor DESC_OBJS_REFACTORING_ERROR = createManaged(
565 T_OBJ, IMG_OBJS_REFACTORING_ERROR);
567 public static final ImageDescriptor DESC_OBJS_REFACTORING_WARNING = createManaged(
568 T_OBJ, IMG_OBJS_REFACTORING_WARNING);
570 public static final ImageDescriptor DESC_OBJS_REFACTORING_INFO = createManaged(
571 T_OBJ, IMG_OBJS_REFACTORING_INFO);
573 public static final ImageDescriptor DESC_OBJS_NLS_TRANSLATE = createManaged(
574 T_OBJ, IMG_OBJS_NLS_TRANSLATE);
576 public static final ImageDescriptor DESC_OBJS_NLS_NEVER_TRANSLATE = createManaged(
577 T_OBJ, IMG_OBJS_NLS_NEVER_TRANSLATE);
579 public static final ImageDescriptor DESC_OBJS_NLS_SKIP = createManaged(
580 T_OBJ, IMG_OBJS_NLS_SKIP);
582 public static final ImageDescriptor DESC_OBJS_UNKNOWN = createManaged(
583 T_OBJ, IMG_OBJS_UNKNOWN);
585 public static final ImageDescriptor DESC_OBJS_SEARCH_READACCESS = createManaged(
586 T_OBJ, IMG_OBJS_SEARCH_READACCESS);
588 public static final ImageDescriptor DESC_OBJS_SEARCH_WRITEACCESS = createManaged(
589 T_OBJ, IMG_OBJS_SEARCH_WRITEACCESS);
591 public static final ImageDescriptor DESC_OBJS_SEARCH_OCCURRENCE = createManaged(
592 T_OBJ, IMG_OBJS_SEARCH_OCCURRENCE);
594 public static final ImageDescriptor DESC_OBJS_LOCAL_VARIABLE = create(
595 T_OBJ, "localvariable_obj.gif"); //$NON-NLS-1$
597 public static final ImageDescriptor DESC_OVR_STATIC = create(T_OVR,
598 "static_co.gif"); //$NON-NLS-1$
600 public static final ImageDescriptor DESC_OVR_FINAL = create(T_OVR,
601 "final_co.gif"); //$NON-NLS-1$
603 public static final ImageDescriptor DESC_OVR_ABSTRACT = create(T_OVR,
604 "abstract_co.gif"); //$NON-NLS-1$
606 public static final ImageDescriptor DESC_OVR_SYNCH = create(T_OVR,
607 "synch_co.gif"); //$NON-NLS-1$
609 public static final ImageDescriptor DESC_OVR_RUN = create(T_OVR,
610 "run_co.gif"); //$NON-NLS-1$
612 public static final ImageDescriptor DESC_OVR_WARNING = create(T_OVR,
613 "warning_co.gif"); //$NON-NLS-1$
615 public static final ImageDescriptor DESC_OVR_ERROR = create(T_OVR,
616 "error_co.gif"); //$NON-NLS-1$
618 public static final ImageDescriptor DESC_OVR_OVERRIDES = create(T_OVR,
619 "over_co.gif"); //$NON-NLS-1$
621 public static final ImageDescriptor DESC_OVR_IMPLEMENTS = create(T_OVR,
622 "implm_co.gif"); //$NON-NLS-1$
624 public static final ImageDescriptor DESC_OVR_CONSTRUCTOR = create(T_OVR,
625 "constr_ovr.gif"); //$NON-NLS-1$
627 public static final ImageDescriptor DESC_OVR_FOCUS = create(T_OVR,
628 "focus_ovr.gif"); //$NON-NLS-1$
630 public static final ImageDescriptor DESC_WIZBAN_NEWFIELD = create(T_WIZBAN,
631 "newfield_wiz.gif"); //$NON-NLS-1$
633 public static final ImageDescriptor DESC_WIZBAN_NEWINT = create(T_WIZBAN,
634 "newint_wiz.gif"); //$NON-NLS-1$
636 public static final ImageDescriptor DESC_WIZBAN_NEWJPRJ = create(T_WIZBAN,
637 "newjprj_wiz.gif"); //$NON-NLS-1$
639 public static final ImageDescriptor DESC_WIZBAN_NEWSRCFOLDR = create(
640 T_WIZBAN, "newsrcfldr_wiz.gif"); //$NON-NLS-1$
642 public static final ImageDescriptor DESC_WIZBAN_NEWMETH = create(T_WIZBAN,
643 "newmeth_wiz.gif"); //$NON-NLS-1$
645 public static final ImageDescriptor DESC_WIZBAN_NEWPACK = create(T_WIZBAN,
646 "newpack_wiz.gif"); //$NON-NLS-1$
648 public static final ImageDescriptor DESC_WIZBAN_NEWSCRAPPAGE = create(
649 T_WIZBAN, "newsbook_wiz.gif"); //$NON-NLS-1$
651 public static final ImageDescriptor DESC_WIZBAN_JAVA_LAUNCH = create(
652 T_WIZBAN, "java_app_wiz.gif"); //$NON-NLS-1$
654 public static final ImageDescriptor DESC_WIZBAN_JAVA_ATTACH = create(
655 T_WIZBAN, "java_attach_wiz.gif"); //$NON-NLS-1$
657 public static final ImageDescriptor DESC_WIZBAN_REFACTOR = create(T_WIZBAN,
658 "refactor_wiz.gif"); //$NON-NLS-1$
660 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_FIELD = create(
661 T_WIZBAN, "fieldrefact_wiz.gif"); //$NON-NLS-1$
663 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_METHOD = create(
664 T_WIZBAN, "methrefact_wiz.gif"); //$NON-NLS-1$
666 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_TYPE = create(
667 T_WIZBAN, "typerefact_wiz.gif"); //$NON-NLS-1$
669 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PACKAGE = create(
670 T_WIZBAN, "packrefact_wiz.gif"); //$NON-NLS-1$
672 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CODE = create(
673 T_WIZBAN, "coderefact_wiz.gif"); //$NON-NLS-1$
675 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CU = create(
676 T_WIZBAN, "compunitrefact_wiz.gif"); //$NON-NLS-1$
678 public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PULL_UP = create(
679 T_WIZBAN, "pullup_wiz.gif"); //$NON-NLS-1$
681 public static final ImageDescriptor DESC_WIZBAN_JAR_PACKAGER = create(
682 T_WIZBAN, "jar_pack_wiz.gif"); //$NON-NLS-1$
684 public static final ImageDescriptor DESC_WIZBAN_JAVA_WORKINGSET = create(
685 T_WIZBAN, "java_workingset_wiz.gif");//$NON-NLS-1$
687 public static final ImageDescriptor DESC_WIZBAN_EXPORT_JAVADOC = create(
688 T_WIZBAN, "export_javadoc_wiz.gif");//$NON-NLS-1$
690 public static final ImageDescriptor DESC_WIZBAN_EXTERNALIZE_STRINGS = create(
691 T_WIZBAN, "extstr_wiz.gif");//$NON-NLS-1$
693 public static final ImageDescriptor DESC_WIZBAN_ADD_LIBRARY = create(
694 T_WIZBAN, "addlibrary_wiz.gif");//$NON-NLS-1$
696 public static final ImageDescriptor DESC_TOOL_DISPLAYSNIPPET = create(
697 T_CTOOL, "disp_sbook.gif"); //$NON-NLS-1$
699 public static final ImageDescriptor DESC_TOOL_RUNSNIPPET = create(T_CTOOL,
700 "run_sbook.gif"); //$NON-NLS-1$
702 public static final ImageDescriptor DESC_TOOL_INSPSNIPPET = create(T_CTOOL,
703 "insp_sbook.gif"); //$NON-NLS-1$
705 public static final ImageDescriptor DESC_TOOL_PACKSNIPPET = create(T_CTOOL,
706 "pack_sbook.gif"); //$NON-NLS-1$
708 public static final ImageDescriptor DESC_TOOL_TERMSNIPPET = create(T_CTOOL,
709 "term_sbook.gif"); //$NON-NLS-1$
711 public static final ImageDescriptor DESC_TOOL_SHOW_EMPTY_PKG = create(
712 T_CTOOL, "show_empty_pkg.gif"); //$NON-NLS-1$
714 public static final ImageDescriptor DESC_TOOL_SHOW_SEGMENTS = create(
715 T_CTOOL, "segment_edit.gif"); //$NON-NLS-1$
717 public static final ImageDescriptor DESC_TOOL_GOTO_NEXT_ERROR = create(
718 T_CTOOL, "next_error_nav.gif"); //$NON-NLS-1$
720 public static final ImageDescriptor DESC_TOOL_GOTO_PREV_ERROR = create(
721 T_CTOOL, "prev_error_nav.gif"); //$NON-NLS-1$
723 public static final ImageDescriptor DESC_TOOL_OPENTYPE = create(T_CTOOL,
724 "opentype.gif"); //$NON-NLS-1$
726 public static final ImageDescriptor DESC_TOOL_NEWPROJECT = create(T_CTOOL,
727 "newjprj_wiz.gif"); //$NON-NLS-1$
729 public static final ImageDescriptor DESC_TOOL_NEWPACKAGE = create(T_CTOOL,
730 "newpack_wiz.gif"); //$NON-NLS-1$
732 public static final ImageDescriptor DESC_TOOL_NEWCLASS = create(T_CTOOL,
733 "newclass_wiz.gif"); //$NON-NLS-1$
735 public static final ImageDescriptor DESC_TOOL_NEWINTERFACE = create(
736 T_CTOOL, "newint_wiz.gif"); //$NON-NLS-1$
738 public static final ImageDescriptor DESC_TOOL_NEWSNIPPET = create(T_CTOOL,
739 "newsbook_wiz.gif"); //$NON-NLS-1$
741 public static final ImageDescriptor DESC_TOOL_NEWPACKROOT = create(T_CTOOL,
742 "newpackfolder_wiz.gif"); //$NON-NLS-1$
744 public static final ImageDescriptor DESC_TOOL_CLASSPATH_ORDER = create(
745 T_OBJ, "cp_order_obj.gif"); //$NON-NLS-1$
747 // Keys for correction proposal. We have to put the image into the registry
748 // since "code assist" doesn't
749 // have a life cycle. So no change to dispose icons.
751 public static final String IMG_CORRECTION_CHANGE = NAME_PREFIX
752 + "correction_change.gif"; //$NON-NLS-1$
754 public static final String IMG_CORRECTION_MOVE = NAME_PREFIX
755 + "correction_move.gif"; //$NON-NLS-1$
757 public static final String IMG_CORRECTION_RENAME = NAME_PREFIX
758 + "correction_rename.gif"; //$NON-NLS-1$
760 public static final String IMG_CORRECTION_DELETE_IMPORT = NAME_PREFIX
761 + "correction_delete_import.gif"; //$NON-NLS-1$
763 public static final String IMG_CORRECTION_LOCAL = NAME_PREFIX
764 + "localvariable_obj.gif"; //$NON-NLS-1$
766 public static final String IMG_CORRECTION_REMOVE = NAME_PREFIX
767 + "remove_correction.gif"; //$NON-NLS-1$
769 public static final String IMG_CORRECTION_ADD = NAME_PREFIX
770 + "add_correction.gif"; //$NON-NLS-1$
773 createManaged(T_OBJ, IMG_CORRECTION_CHANGE);
774 createManaged(T_OBJ, IMG_CORRECTION_MOVE);
775 createManaged(T_OBJ, IMG_CORRECTION_RENAME);
776 createManaged(T_OBJ, IMG_CORRECTION_DELETE_IMPORT);
777 createManaged(T_OBJ, IMG_CORRECTION_LOCAL);
778 createManaged(T_OBJ, IMG_CORRECTION_REMOVE);
779 createManaged(T_OBJ, IMG_CORRECTION_ADD);
783 * Returns the image managed under the given key in this registry.
787 * @return the image managed under the given key
789 public static Image get(String key) {
790 return getImageRegistry().get(key);
794 * Returns the image descriptor for the given key in this registry. Might be
795 * called in a non-UI thread.
799 * @return the image descriptor for the given key
801 public static ImageDescriptor getDescriptor(String key) {
802 if (fgImageRegistry == null) {
803 return (ImageDescriptor) fgAvoidSWTErrorMap.get(key);
805 return getImageRegistry().getDescriptor(key);
809 * Sets the three image descriptors for enabled, disabled, and hovered to an
810 * action. The actions are retrieved from the *tool16 folders.
812 public static void setToolImageDescriptors(IAction action, String iconName) {
813 setImageDescriptors(action, "tool16", iconName);
817 * Sets the three image descriptors for enabled, disabled, and hovered to an
818 * action. The actions are retrieved from the *lcl16 folders.
820 public static void setLocalImageDescriptors(IAction action, String iconName) {
821 setImageDescriptors(action, "lcl16", iconName);
825 * Helper method to access the image registry from the JavaPlugin class.
827 /* package */static ImageRegistry getImageRegistry() {
828 if (fgImageRegistry == null) {
829 fgImageRegistry = new ImageRegistry();
830 for (Iterator iter = fgAvoidSWTErrorMap.keySet().iterator(); iter
832 String key = (String) iter.next();
833 fgImageRegistry.put(key, (ImageDescriptor) fgAvoidSWTErrorMap
836 fgAvoidSWTErrorMap = null;
838 return fgImageRegistry;
841 // ---- Helper methods to access icons on the file system
842 // --------------------------------------
844 protected static void setImageDescriptors(IAction action, String type,
848 ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL(
849 "d" + type, relPath));
851 action.setDisabledImageDescriptor(id);
852 } catch (MalformedURLException e) {
856 ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL(
857 "c" + type, relPath));
859 action.setHoverImageDescriptor(id);
860 } catch (MalformedURLException e) {
863 action.setImageDescriptor(create("e" + type, relPath));
866 private static ImageDescriptor createManaged(String prefix, String name) {
868 ImageDescriptor result = ImageDescriptor
869 .createFromURL(makeIconFileURL(prefix, name
870 .substring(NAME_PREFIX_LENGTH)));
871 if (fgAvoidSWTErrorMap == null) {
872 fgAvoidSWTErrorMap = new HashMap();
874 fgAvoidSWTErrorMap.put(name, result);
875 if (fgImageRegistry != null) {
877 .logErrorMessage("Image registry already defined"); //$NON-NLS-1$
880 } catch (MalformedURLException e) {
881 return ImageDescriptor.getMissingImageDescriptor();
885 private static ImageDescriptor createManaged(String prefix, String name,
888 ImageDescriptor result = ImageDescriptor
889 .createFromURL(makeIconFileURL(prefix, name
890 .substring(NAME_PREFIX_LENGTH)));
891 if (fgAvoidSWTErrorMap == null) {
892 fgAvoidSWTErrorMap = new HashMap();
894 fgAvoidSWTErrorMap.put(key, result);
895 if (fgImageRegistry != null) {
897 .logErrorMessage("Image registry already defined"); //$NON-NLS-1$
900 } catch (MalformedURLException e) {
901 return ImageDescriptor.getMissingImageDescriptor();
905 protected static ImageDescriptor create(String prefix, String name) {
907 return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
908 } catch (MalformedURLException e) {
909 return ImageDescriptor.getMissingImageDescriptor();
913 protected static URL makeIconFileURL(String prefix, String name)
914 throws MalformedURLException {
915 if (fgIconBaseURL == null)
916 throw new MalformedURLException();
918 StringBuffer buffer = new StringBuffer(prefix);
921 return new URL(fgIconBaseURL, buffer.toString());