04543bb47f8dd88cb86deec98565aad99e8a85e2
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / JavaPluginImages_DeleteIt.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 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.ui;
12
13 import java.net.MalformedURLException;
14 import java.net.URL;
15 import java.util.HashMap;
16 import java.util.Iterator;
17
18 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
19
20 import org.eclipse.core.runtime.IStatus;
21 import org.eclipse.jface.action.IAction;
22 import org.eclipse.jface.resource.ImageDescriptor;
23 import org.eclipse.jface.resource.ImageRegistry;
24 import org.eclipse.swt.graphics.Image;
25
26
27 /**
28  * Bundle of most images used by the Java plugin.
29  */
30 public class JavaPluginImages_DeleteIt {
31
32         private static final String NAME_PREFIX= "net.sourceforge.phpdt.internal.ui."; //$NON-NLS-1$
33         private static final int    NAME_PREFIX_LENGTH= NAME_PREFIX.length();
34
35         private static URL fgIconBaseURL= null;
36         
37         // Determine display depth. If depth > 4 then we use high color images. Otherwise low color
38         // images are used
39         static {
40 //              String pathSuffix= "icons/full/"; //$NON-NLS-1$
41                 String pathSuffix= "icons/"; //$NON-NLS-1$
42                 try {
43                         fgIconBaseURL= new URL(PHPeclipsePlugin.getDefault().getDescriptor().getInstallURL(), pathSuffix);
44                 } catch (MalformedURLException e) {
45                         // do nothing
46                 }
47         }
48         
49         // The plugin registry
50         private static ImageRegistry fgImageRegistry= null;
51         private static HashMap fgAvoidSWTErrorMap= null;
52
53         /*
54          * Available cached Images in the Java plugin image registry.
55          */
56         public static final String IMG_MISC_PUBLIC= NAME_PREFIX + "methpub_obj.gif";                    //$NON-NLS-1$
57         public static final String IMG_MISC_PROTECTED= NAME_PREFIX + "methpro_obj.gif";                 //$NON-NLS-1$
58         public static final String IMG_MISC_PRIVATE= NAME_PREFIX + "methpri_obj.gif";           //$NON-NLS-1$
59         public static final String IMG_MISC_DEFAULT= NAME_PREFIX + "methdef_obj.gif";           //$NON-NLS-1$
60
61         public static final String IMG_FIELD_PUBLIC= NAME_PREFIX + "field_public_obj.gif";                      //$NON-NLS-1$
62         public static final String IMG_FIELD_PROTECTED= NAME_PREFIX + "field_protected_obj.gif";                //$NON-NLS-1$
63         public static final String IMG_FIELD_PRIVATE= NAME_PREFIX + "field_private_obj.gif";            //$NON-NLS-1$
64         public static final String IMG_FIELD_DEFAULT= NAME_PREFIX + "field_default_obj.gif";            //$NON-NLS-1$
65
66         
67         public static final String IMG_OBJS_GHOST= NAME_PREFIX + "ghost.gif";                           //$NON-NLS-1$
68         public static final String IMG_OBJS_SEARCH_TSK= NAME_PREFIX + "search_tsk.gif";                 //$NON-NLS-1$
69         public static final String IMG_OBJS_PACKDECL= NAME_PREFIX + "packd_obj.gif";                    //$NON-NLS-1$
70         public static final String IMG_OBJS_IMPDECL= NAME_PREFIX + "imp_obj.gif";                       //$NON-NLS-1$
71         public static final String IMG_OBJS_IMPCONT= NAME_PREFIX + "impc_obj.gif";                      //$NON-NLS-1$
72         public static final String IMG_OBJS_JSEARCH= NAME_PREFIX + "jsearch_obj.gif";           //$NON-NLS-1$
73         public static final String IMG_OBJS_SEARCH_DECL= NAME_PREFIX + "search_decl_obj.gif"; //$NON-NLS-1$
74         public static final String IMG_OBJS_SEARCH_REF= NAME_PREFIX + "search_ref_obj.gif";     //$NON-NLS-1$
75         public static final String IMG_OBJS_CLASS= NAME_PREFIX + "class_obj.gif";                       //$NON-NLS-1$
76         public static final String IMG_OBJS_CLASSALT= NAME_PREFIX + "classfo_obj.gif";                  //$NON-NLS-1$   
77         public static final String IMG_OBJS_CLASS_DEFAULT= NAME_PREFIX + "class_default_obj.gif";                       //$NON-NLS-1$
78         public static final String IMG_OBJS_INTERFACE= NAME_PREFIX + "int_obj.gif";                     //$NON-NLS-1$
79         public static final String IMG_OBJS_INTERFACEALT= NAME_PREFIX + "intf_obj.gif";                         //$NON-NLS-1$   
80         public static final String IMG_OBJS_INTERFACE_DEFAULT= NAME_PREFIX + "int_default_obj.gif";             //$NON-NLS-1$
81         public static final String IMG_OBJS_CUNIT= NAME_PREFIX + "jcu_obj.gif";                                 //$NON-NLS-1$
82         public static final String IMG_OBJS_CUNIT_RESOURCE= NAME_PREFIX + "jcu_resource_obj.gif";                               //$NON-NLS-1$
83         public static final String IMG_OBJS_CFILE= NAME_PREFIX + "classf_obj.gif";                      //$NON-NLS-1$
84         public static final String IMG_OBJS_CFILECLASS= NAME_PREFIX + "class_obj.gif";                  //$NON-NLS-1$
85         public static final String IMG_OBJS_CFILEINT= NAME_PREFIX + "int_obj.gif";                      //$NON-NLS-1$
86         public static final String IMG_OBJS_LOGICAL_PACKAGE= NAME_PREFIX + "logical_package_obj.gif";//$NON-NLS-1$
87         public static final String IMG_OJS_EMPTY_LOGICAL_PACKAGE= NAME_PREFIX + "empty_logical_package_obj.gif";//$NON-NLS-1$
88         public static final String IMG_OBJS_PACKAGE= NAME_PREFIX + "package_obj.gif";           //$NON-NLS-1$
89         public static final String IMG_OBJS_EMPTY_PACK_RESOURCE= NAME_PREFIX + "empty_pack_fldr_obj.gif"; //$NON-NLS-1$
90         public static final String IMG_OBJS_EMPTY_PACKAGE= NAME_PREFIX + "empty_pack_obj.gif"; //$NON-NLS-1$
91         public static final String IMG_OBJS_PACKFRAG_ROOT= NAME_PREFIX + "packagefolder_obj.gif"; //$NON-NLS-1$
92         public static final String IMG_OBJS_MISSING_PACKFRAG_ROOT= NAME_PREFIX + "packagefolder_nonexist_obj.gif"; //$NON-NLS-1$
93         public static final String IMG_OBJS_MISSING_JAR= NAME_PREFIX + "jar_nonexist_obj.gif"; //$NON-NLS-1$
94         public static final String IMG_OBJS_JAR= NAME_PREFIX + "jar_obj.gif";                           //$NON-NLS-1$
95         public static final String IMG_OBJS_EXTJAR= NAME_PREFIX + "jar_l_obj.gif";                      //$NON-NLS-1$
96         public static final String IMG_OBJS_JAR_WSRC= NAME_PREFIX + "jar_src_obj.gif";          //$NON-NLS-1$
97         public static final String IMG_OBJS_EXTJAR_WSRC= NAME_PREFIX + "jar_lsrc_obj.gif";      //$NON-NLS-1$
98         public static final String IMG_OBJS_ENV_VAR= NAME_PREFIX + "envvar_obj.gif";                    //$NON-NLS-1$
99         public static final String IMG_OBJS_MISSING_ENV_VAR= NAME_PREFIX + "envvar_nonexist_obj.gif"; //$NON-NLS-1$
100         public static final String IMG_OBJS_JAVA_MODEL= NAME_PREFIX + "java_model_obj.gif"; //$NON-NLS-1$
101         public static final String IMG_OBJS_UNKNOWN= NAME_PREFIX + "unknown_obj.gif"; //$NON-NLS-1$
102         
103         public static final String IMG_OBJS_LIBRARY= NAME_PREFIX + "library_obj.gif";           //$NON-NLS-1$
104         
105         public static final String IMG_OBJS_JAVADOCTAG= NAME_PREFIX + "jdoc_tag_obj.gif";       //$NON-NLS-1$
106         public static final String IMG_OBJS_HTMLTAG= NAME_PREFIX + "html_tag_obj.gif";          //$NON-NLS-1$
107         
108         public static final String IMG_OBJS_TEMPLATE= NAME_PREFIX + "template_obj.gif";                 //$NON-NLS-1$
109
110         public static final String IMG_OBJS_EXCEPTION= NAME_PREFIX + "jexception_obj.gif";      //$NON-NLS-1$
111         public static final String IMG_OBJS_ERROR= NAME_PREFIX + "jrtexception_obj.gif";                //$NON-NLS-1$
112         
113         public static final String IMG_OBJS_BREAKPOINT_INSTALLED= NAME_PREFIX + "brkpi_obj.gif"; //$NON-NLS-1$
114         public static final String IMG_OBJS_FIXABLE_PROBLEM= NAME_PREFIX + "quickfix_warning_obj.gif"; //$NON-NLS-1$
115         public static final String IMG_OBJS_FIXABLE_ERROR= NAME_PREFIX + "quickfix_error_obj.gif"; //$NON-NLS-1$
116
117         public static final String IMG_OBJS_SNIPPET_EVALUATING= NAME_PREFIX + "jsbook_run_obj.gif"; //$NON-NLS-1$
118
119         public static final String IMG_OBJS_REFACTORING_FATAL= NAME_PREFIX + "fatalerror_obj.gif"; //$NON-NLS-1$
120         public static final String IMG_OBJS_REFACTORING_ERROR= NAME_PREFIX + "error_obj.gif"; //$NON-NLS-1$
121         public static final String IMG_OBJS_REFACTORING_WARNING= NAME_PREFIX + "warning_obj.gif"; //$NON-NLS-1$
122         public static final String IMG_OBJS_REFACTORING_INFO= NAME_PREFIX + "info_obj.gif";     //$NON-NLS-1$
123
124         public static final String IMG_OBJS_NLS_TRANSLATE= NAME_PREFIX + "translate.gif"; //$NON-NLS-1$
125         public static final String IMG_OBJS_NLS_NEVER_TRANSLATE= NAME_PREFIX + "never_translate.gif"; //$NON-NLS-1$
126         public static final String IMG_OBJS_NLS_SKIP= NAME_PREFIX + "skip.gif"; //$NON-NLS-1$
127
128         public static final String IMG_OBJS_SEARCH_READACCESS= NAME_PREFIX + "occ_read.gif"; //$NON-NLS-1$
129         public static final String IMG_OBJS_SEARCH_WRITEACCESS= NAME_PREFIX + "occ_write.gif"; //$NON-NLS-1$
130         public static final String IMG_OBJS_SEARCH_OCCURRENCE= NAME_PREFIX + "occ_match.gif"; //$NON-NLS-1$
131         /*
132          * Set of predefined Image Descriptors.
133          */
134         private static final String T_OBJ= "obj16";             //$NON-NLS-1$
135         private static final String T_OVR= "ovr16";             //$NON-NLS-1$
136         private static final String T_WIZBAN= "wizban";         //$NON-NLS-1$
137         private static final String T_CLCL= "clcl16";   //$NON-NLS-1$
138         private static final String T_DLCL= "dlcl16";   //$NON-NLS-1$
139         private static final String T_CTOOL= "ctool16";         //$NON-NLS-1$
140         private static final String T_CVIEW= "cview16"; //$NON-NLS-1$
141
142         public static final ImageDescriptor DESC_VIEW_ERRORWARNING_TAB= create(T_CVIEW, "errorwarning_tab.gif"); //$NON-NLS-1$
143         public static final ImageDescriptor DESC_VIEW_CLASSFILEGENERATION_TAB= create(T_CVIEW, "classfilegeneration_tab.gif"); //$NON-NLS-1$
144         public static final ImageDescriptor DESC_VIEW_JDKCOMPLIANCE_TAB= create(T_CVIEW, "jdkcompliance_tab.gif"); //$NON-NLS-1$
145         
146         public static final ImageDescriptor DESC_CLCL_FILTER= create(T_CLCL, "filter_ps.gif"); //$NON-NLS-1$
147
148         public static final ImageDescriptor DESC_CLCL_CODE_ASSIST= create(T_CLCL, "metharg_obj.gif"); //$NON-NLS-1$
149         public static final ImageDescriptor DESC_DLCL_CODE_ASSIST= create(T_DLCL, "metharg_obj.gif"); //$NON-NLS-1$
150
151         public static final ImageDescriptor DESC_MISC_PUBLIC= createManaged(T_OBJ, IMG_MISC_PUBLIC);
152         public static final ImageDescriptor DESC_MISC_PROTECTED= createManaged(T_OBJ, IMG_MISC_PROTECTED);
153         public static final ImageDescriptor DESC_MISC_PRIVATE= createManaged(T_OBJ, IMG_MISC_PRIVATE);
154         public static final ImageDescriptor DESC_MISC_DEFAULT= createManaged(T_OBJ, IMG_MISC_DEFAULT);
155
156         public static final ImageDescriptor DESC_FIELD_PUBLIC= createManaged(T_OBJ, IMG_FIELD_PUBLIC); //$NON-NLS-1$
157         public static final ImageDescriptor DESC_FIELD_PROTECTED= createManaged(T_OBJ, IMG_FIELD_PROTECTED); //$NON-NLS-1$
158         public static final ImageDescriptor DESC_FIELD_PRIVATE= createManaged(T_OBJ, IMG_FIELD_PRIVATE); //$NON-NLS-1$
159         public static final ImageDescriptor DESC_FIELD_DEFAULT= createManaged(T_OBJ, IMG_FIELD_DEFAULT); //$NON-NLS-1$
160         
161         public static final ImageDescriptor DESC_MENU_SHIFT_RIGHT= create(T_CTOOL, "shift_r_edit.gif");         //$NON-NLS-1$
162         public static final ImageDescriptor DESC_MENU_SHIFT_LEFT= create(T_CTOOL, "shift_l_edit.gif");  //$NON-NLS-1$
163
164         public static final ImageDescriptor DESC_OBJS_GHOST= createManaged(T_OBJ, IMG_OBJS_GHOST);
165         public static final ImageDescriptor DESC_OBJS_PACKDECL= createManaged(T_OBJ, IMG_OBJS_PACKDECL);
166         public static final ImageDescriptor DESC_OBJS_IMPDECL= createManaged(T_OBJ, IMG_OBJS_IMPDECL);
167         public static final ImageDescriptor DESC_OBJS_IMPCONT= createManaged(T_OBJ, IMG_OBJS_IMPCONT);
168         public static final ImageDescriptor DESC_OBJS_JSEARCH= createManaged(T_OBJ, IMG_OBJS_JSEARCH);
169         public static final ImageDescriptor DESC_OBJS_SEARCH_DECL= createManaged(T_OBJ, IMG_OBJS_SEARCH_DECL);
170         public static final ImageDescriptor DESC_OBJS_SEARCH_REF= createManaged(T_OBJ, IMG_OBJS_SEARCH_REF);
171         public static final ImageDescriptor DESC_OBJS_CUNIT= createManaged(T_OBJ, IMG_OBJS_CUNIT);
172         public static final ImageDescriptor DESC_OBJS_CUNIT_RESOURCE= createManaged(T_OBJ, IMG_OBJS_CUNIT_RESOURCE);
173         public static final ImageDescriptor DESC_OBJS_CFILE= createManaged(T_OBJ, IMG_OBJS_CFILE); 
174         public static final ImageDescriptor DESC_OBJS_CFILECLASS= createManaged(T_OBJ, IMG_OBJS_CFILECLASS); 
175         public static final ImageDescriptor DESC_OBJS_CFILEINT= createManaged(T_OBJ, IMG_OBJS_CFILEINT); 
176         public static final ImageDescriptor DESC_OBJS_PACKAGE= createManaged(T_OBJ, IMG_OBJS_PACKAGE);
177         public static final ImageDescriptor DESC_OBJS_EMPTY_LOGICAL_PACKAGE= createManaged(T_OBJ, IMG_OJS_EMPTY_LOGICAL_PACKAGE);
178         public static final ImageDescriptor DESC_OBJS_LOGICAL_PACKAGE= createManaged(T_OBJ, IMG_OBJS_LOGICAL_PACKAGE);
179         public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE_RESOURCES= createManaged(T_OBJ, IMG_OBJS_EMPTY_PACK_RESOURCE);
180         public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE= createManaged(T_OBJ, IMG_OBJS_EMPTY_PACKAGE);      
181         public static final ImageDescriptor DESC_OBJS_PACKFRAG_ROOT= createManaged(T_OBJ, IMG_OBJS_PACKFRAG_ROOT);
182         public static final ImageDescriptor DESC_OBJS_MISSING_PACKFRAG_ROOT= createManaged(T_OBJ, IMG_OBJS_MISSING_PACKFRAG_ROOT);
183         public static final ImageDescriptor DESC_OBJS_JAVA_MODEL= createManaged(T_OBJ, IMG_OBJS_JAVA_MODEL);
184
185         public static final ImageDescriptor DESC_OBJS_CLASS= createManaged(T_OBJ, IMG_OBJS_CLASS);
186         public static final ImageDescriptor DESC_OBJS_CLASS_DEFAULT= createManaged(T_OBJ, IMG_OBJS_CLASS_DEFAULT);
187         
188         public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PUBLIC= create(T_OBJ, "innerclass_public_obj.gif"); //$NON-NLS-1$
189         public static final ImageDescriptor DESC_OBJS_INNER_CLASS_DEFAULT= create(T_OBJ, "innerclass_default_obj.gif"); //$NON-NLS-1$
190         public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PROTECTED= create(T_OBJ, "innerclass_protected_obj.gif"); //$NON-NLS-1$
191         public static final ImageDescriptor DESC_OBJS_INNER_CLASS_PRIVATE= create(T_OBJ, "innerclass_private_obj.gif"); //$NON-NLS-1$
192         
193         public static final ImageDescriptor DESC_OBJS_CLASSALT= createManaged(T_OBJ, IMG_OBJS_CLASSALT);
194
195         public static final ImageDescriptor DESC_OBJS_INTERFACE= createManaged(T_OBJ, IMG_OBJS_INTERFACE);
196         public static final ImageDescriptor DESC_OBJS_INTERFACE_DEFAULT= createManaged(T_OBJ, IMG_OBJS_INTERFACE_DEFAULT);
197         
198         public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PUBLIC= create(T_OBJ, "innerinterface_public_obj.gif"); //$NON-NLS-1$
199         public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_DEFAULT= create(T_OBJ, "innerinterface_default_obj.gif"); //$NON-NLS-1$
200         public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PROTECTED= create(T_OBJ, "innerinterface_protected_obj.gif"); //$NON-NLS-1$
201         public static final ImageDescriptor DESC_OBJS_INNER_INTERFACE_PRIVATE= create(T_OBJ, "innerinterface_private_obj.gif"); //$NON-NLS-1$
202         
203         public static final ImageDescriptor DESC_OBJS_INTERFACEALT= createManaged(T_OBJ, IMG_OBJS_INTERFACEALT);
204         
205         public static final ImageDescriptor DESC_OBJS_JAR= createManaged(T_OBJ, IMG_OBJS_JAR);
206         public static final ImageDescriptor DESC_OBJS_MISSING_JAR= createManaged(T_OBJ, IMG_OBJS_MISSING_JAR);
207         public static final ImageDescriptor DESC_OBJS_EXTJAR= createManaged(T_OBJ, IMG_OBJS_EXTJAR);
208         public static final ImageDescriptor DESC_OBJS_JAR_WSRC= createManaged(T_OBJ, IMG_OBJS_JAR_WSRC);
209         public static final ImageDescriptor DESC_OBJS_EXTJAR_WSRC= createManaged(T_OBJ, IMG_OBJS_EXTJAR_WSRC);
210         public static final ImageDescriptor DESC_OBJS_ENV_VAR= createManaged(T_OBJ, IMG_OBJS_ENV_VAR);
211         public static final ImageDescriptor DESC_OBJS_MISSING_ENV_VAR= createManaged(T_OBJ, IMG_OBJS_MISSING_ENV_VAR);
212         
213         public static final ImageDescriptor DESC_OBJS_LIBRARY= createManaged(T_OBJ, IMG_OBJS_LIBRARY);
214         
215         public static final ImageDescriptor DESC_OBJS_JAVADOCTAG= createManaged(T_OBJ, IMG_OBJS_JAVADOCTAG);
216         public static final ImageDescriptor DESC_OBJS_HTMLTAG= createManaged(T_OBJ, IMG_OBJS_HTMLTAG);
217
218         public static final ImageDescriptor DESC_OBJS_TEMPLATE= createManaged(T_OBJ, IMG_OBJS_TEMPLATE);
219         
220         public static final ImageDescriptor DESC_OBJS_EXCEPTION= createManaged(T_OBJ, IMG_OBJS_EXCEPTION);
221         public static final ImageDescriptor DESC_OBJS_BREAKPOINT_INSTALLED= createManaged(T_OBJ, IMG_OBJS_BREAKPOINT_INSTALLED);
222         public static final ImageDescriptor DESC_OBJS_ERROR= createManaged(T_OBJ, IMG_OBJS_ERROR);
223         public static final ImageDescriptor DESC_OBJS_FIXABLE_PROBLEM= createManaged(T_OBJ, IMG_OBJS_FIXABLE_PROBLEM);
224         public static final ImageDescriptor DESC_OBJS_FIXABLE_ERROR= createManaged(T_OBJ, IMG_OBJS_FIXABLE_ERROR);
225         
226         public static final ImageDescriptor DESC_OBJS_SNIPPET_EVALUATING= createManaged(T_OBJ, IMG_OBJS_SNIPPET_EVALUATING);
227         
228         public static final ImageDescriptor DESC_OBJS_DEFAULT_CHANGE= create(T_OBJ, "change.gif"); //$NON-NLS-1$
229         public static final ImageDescriptor DESC_OBJS_COMPOSITE_CHANGE= create(T_OBJ, "composite_change.gif"); //$NON-NLS-1$
230         public static final ImageDescriptor DESC_OBJS_CU_CHANGE= create(T_OBJ, "cu_change.gif"); //$NON-NLS-1$
231         public static final ImageDescriptor DESC_OBJS_FILE_CHANGE= create(T_OBJ, "file_change.gif"); //$NON-NLS-1$
232         public static final ImageDescriptor DESC_OBJS_TEXT_EDIT= create(T_OBJ, "text_edit.gif"); //$NON-NLS-1$
233
234         public static final ImageDescriptor DESC_OBJS_EXCLUSION_FILTER_ATTRIB= create(T_OBJ, "exclusion_filter_attrib.gif"); //$NON-NLS-1$
235         public static final ImageDescriptor DESC_OBJS_OUTPUT_FOLDER_ATTRIB= create(T_OBJ, "output_folder_attrib.gif"); //$NON-NLS-1$
236         public static final ImageDescriptor DESC_OBJS_SOURCE_ATTACH_ATTRIB= create(T_OBJ, "source_attach_attrib.gif"); //$NON-NLS-1$
237         public static final ImageDescriptor DESC_OBJS_JAVADOC_LOCATION_ATTRIB= create(T_OBJ, "javadoc_location_attrib.gif"); //$NON-NLS-1$
238
239         public static final ImageDescriptor DESC_OBJS_REFACTORING_FATAL= createManaged(T_OBJ, IMG_OBJS_REFACTORING_FATAL);
240         public static final ImageDescriptor DESC_OBJS_REFACTORING_ERROR= createManaged(T_OBJ, IMG_OBJS_REFACTORING_ERROR);
241         public static final ImageDescriptor DESC_OBJS_REFACTORING_WARNING= createManaged(T_OBJ, IMG_OBJS_REFACTORING_WARNING);
242         public static final ImageDescriptor DESC_OBJS_REFACTORING_INFO= createManaged(T_OBJ, IMG_OBJS_REFACTORING_INFO);
243         
244         public static final ImageDescriptor DESC_OBJS_NLS_TRANSLATE= createManaged(T_OBJ, IMG_OBJS_NLS_TRANSLATE);
245         public static final ImageDescriptor DESC_OBJS_NLS_NEVER_TRANSLATE= createManaged(T_OBJ, IMG_OBJS_NLS_NEVER_TRANSLATE);
246         public static final ImageDescriptor DESC_OBJS_NLS_SKIP= createManaged(T_OBJ, IMG_OBJS_NLS_SKIP);
247         
248         public static final ImageDescriptor DESC_OBJS_UNKNOWN= createManaged(T_OBJ, IMG_OBJS_UNKNOWN);
249
250         public static final ImageDescriptor DESC_OBJS_SEARCH_READACCESS= createManaged(T_OBJ, IMG_OBJS_SEARCH_READACCESS);
251         public static final ImageDescriptor DESC_OBJS_SEARCH_WRITEACCESS= createManaged(T_OBJ, IMG_OBJS_SEARCH_WRITEACCESS);
252         public static final ImageDescriptor DESC_OBJS_SEARCH_OCCURRENCE= createManaged(T_OBJ, IMG_OBJS_SEARCH_OCCURRENCE);
253
254         public static final ImageDescriptor DESC_OBJS_LOCAL_VARIABLE= create(T_OBJ, "localvariable_obj.gif"); //$NON-NLS-1$
255         
256         public static final ImageDescriptor DESC_OVR_STATIC= create(T_OVR, "static_co.gif");                                            //$NON-NLS-1$
257         public static final ImageDescriptor DESC_OVR_FINAL= create(T_OVR, "final_co.gif");                                              //$NON-NLS-1$
258         public static final ImageDescriptor DESC_OVR_ABSTRACT= create(T_OVR, "abstract_co.gif");                                        //$NON-NLS-1$
259         public static final ImageDescriptor DESC_OVR_SYNCH= create(T_OVR, "synch_co.gif");                                              //$NON-NLS-1$
260         public static final ImageDescriptor DESC_OVR_RUN= create(T_OVR, "run_co.gif");                                                  //$NON-NLS-1$
261         public static final ImageDescriptor DESC_OVR_WARNING= create(T_OVR, "warning_co.gif");                                  //$NON-NLS-1$
262         public static final ImageDescriptor DESC_OVR_ERROR= create(T_OVR, "error_co.gif");                                              //$NON-NLS-1$
263         public static final ImageDescriptor DESC_OVR_OVERRIDES= create(T_OVR, "over_co.gif");                                   //$NON-NLS-1$
264         public static final ImageDescriptor DESC_OVR_IMPLEMENTS= create(T_OVR, "implm_co.gif");                                 //$NON-NLS-1$
265         public static final ImageDescriptor DESC_OVR_CONSTRUCTOR= create(T_OVR, "constr_ovr.gif");                      //$NON-NLS-1$
266         public static final ImageDescriptor DESC_OVR_FOCUS= create(T_OVR, "focus_ovr.gif"); //$NON-NLS-1$
267                 
268         public static final ImageDescriptor DESC_WIZBAN_NEWCLASS= create(T_WIZBAN, "newclass_wiz.gif");                         //$NON-NLS-1$
269         public static final ImageDescriptor DESC_WIZBAN_NEWFIELD= create(T_WIZBAN, "newfield_wiz.gif");                         //$NON-NLS-1$
270         public static final ImageDescriptor DESC_WIZBAN_NEWINT= create(T_WIZBAN, "newint_wiz.gif");                             //$NON-NLS-1$
271         public static final ImageDescriptor DESC_WIZBAN_NEWJPRJ= create(T_WIZBAN, "newjprj_wiz.gif");                   //$NON-NLS-1$
272         public static final ImageDescriptor DESC_WIZBAN_NEWSRCFOLDR= create(T_WIZBAN, "newsrcfldr_wiz.gif");    //$NON-NLS-1$
273         public static final ImageDescriptor DESC_WIZBAN_NEWMETH= create(T_WIZBAN, "newmeth_wiz.gif");                   //$NON-NLS-1$
274         public static final ImageDescriptor DESC_WIZBAN_NEWPACK= create(T_WIZBAN, "newpack_wiz.gif");                   //$NON-NLS-1$
275         public static final ImageDescriptor DESC_WIZBAN_NEWSCRAPPAGE= create(T_WIZBAN, "newsbook_wiz.gif");             //$NON-NLS-1$
276         public static final ImageDescriptor DESC_WIZBAN_JAVA_LAUNCH= create(T_WIZBAN, "java_app_wiz.gif");              //$NON-NLS-1$
277         public static final ImageDescriptor DESC_WIZBAN_JAVA_ATTACH= create(T_WIZBAN, "java_attach_wiz.gif");   //$NON-NLS-1$
278         public static final ImageDescriptor DESC_WIZBAN_REFACTOR= create(T_WIZBAN, "refactor_wiz.gif");                         //$NON-NLS-1$
279         public static final ImageDescriptor DESC_WIZBAN_REFACTOR_FIELD= create(T_WIZBAN, "fieldrefact_wiz.gif");        //$NON-NLS-1$
280         public static final ImageDescriptor DESC_WIZBAN_REFACTOR_METHOD= create(T_WIZBAN, "methrefact_wiz.gif");        //$NON-NLS-1$
281         public static final ImageDescriptor DESC_WIZBAN_REFACTOR_TYPE= create(T_WIZBAN, "typerefact_wiz.gif");  //$NON-NLS-1$
282         public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PACKAGE= create(T_WIZBAN, "packrefact_wiz.gif"); //$NON-NLS-1$
283         public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CODE= create(T_WIZBAN, "coderefact_wiz.gif");  //$NON-NLS-1$
284         public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CU= create(T_WIZBAN, "compunitrefact_wiz.gif");        //$NON-NLS-1$
285         public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PULL_UP= create(T_WIZBAN, "pullup_wiz.gif");   //$NON-NLS-1$
286         public static final ImageDescriptor DESC_WIZBAN_JAR_PACKAGER= create(T_WIZBAN, "jar_pack_wiz.gif");             //$NON-NLS-1$
287         public static final ImageDescriptor DESC_WIZBAN_JAVA_WORKINGSET= create(T_WIZBAN, "java_workingset_wiz.gif");//$NON-NLS-1$
288         public static final ImageDescriptor DESC_WIZBAN_EXPORT_JAVADOC= create(T_WIZBAN, "export_javadoc_wiz.gif");//$NON-NLS-1$
289         public static final ImageDescriptor DESC_WIZBAN_EXTERNALIZE_STRINGS= create(T_WIZBAN, "extstr_wiz.gif");//$NON-NLS-1$
290         public static final ImageDescriptor DESC_WIZBAN_ADD_LIBRARY= create(T_WIZBAN, "addlibrary_wiz.gif");//$NON-NLS-1$
291
292                 
293         public static final ImageDescriptor DESC_TOOL_DISPLAYSNIPPET= create(T_CTOOL, "disp_sbook.gif");                        //$NON-NLS-1$
294         public static final ImageDescriptor DESC_TOOL_RUNSNIPPET= create(T_CTOOL, "run_sbook.gif");                             //$NON-NLS-1$
295         public static final ImageDescriptor DESC_TOOL_INSPSNIPPET= create(T_CTOOL, "insp_sbook.gif");                   //$NON-NLS-1$
296         public static final ImageDescriptor DESC_TOOL_PACKSNIPPET= create(T_CTOOL, "pack_sbook.gif");                   //$NON-NLS-1$
297         public static final ImageDescriptor DESC_TOOL_TERMSNIPPET= create(T_CTOOL, "term_sbook.gif");                   //$NON-NLS-1$
298         public static final ImageDescriptor DESC_TOOL_SHOW_EMPTY_PKG= create(T_CTOOL, "show_empty_pkg.gif");            //$NON-NLS-1$
299         public static final ImageDescriptor DESC_TOOL_SHOW_SEGMENTS= create(T_CTOOL, "segment_edit.gif");               //$NON-NLS-1$
300         public static final ImageDescriptor DESC_TOOL_GOTO_NEXT_ERROR= create(T_CTOOL, "next_error_nav.gif");   //$NON-NLS-1$
301         public static final ImageDescriptor DESC_TOOL_GOTO_PREV_ERROR= create(T_CTOOL, "prev_error_nav.gif");   //$NON-NLS-1$
302
303         public static final ImageDescriptor DESC_TOOL_OPENTYPE= create(T_CTOOL, "opentype.gif");                                        //$NON-NLS-1$
304         public static final ImageDescriptor DESC_TOOL_NEWPROJECT= create(T_CTOOL, "newjprj_wiz.gif");                   //$NON-NLS-1$
305         public static final ImageDescriptor DESC_TOOL_NEWPACKAGE= create(T_CTOOL, "newpack_wiz.gif");                   //$NON-NLS-1$
306         public static final ImageDescriptor DESC_TOOL_NEWCLASS= create(T_CTOOL, "newclass_wiz.gif");                            //$NON-NLS-1$
307         public static final ImageDescriptor DESC_TOOL_NEWINTERFACE= create(T_CTOOL, "newint_wiz.gif");                  //$NON-NLS-1$
308         public static final ImageDescriptor DESC_TOOL_NEWSNIPPET= create(T_CTOOL, "newsbook_wiz.gif");                  //$NON-NLS-1$
309         public static final ImageDescriptor DESC_TOOL_NEWPACKROOT= create(T_CTOOL, "newpackfolder_wiz.gif");            //$NON-NLS-1$
310
311         public static final ImageDescriptor DESC_TOOL_CLASSPATH_ORDER= create(T_OBJ, "cp_order_obj.gif");               //$NON-NLS-1$
312
313         // Keys for correction proposal. We have to put the image into the registry since "code assist" doesn't
314         // have a life cycle. So no change to dispose icons.
315         
316         public static final String IMG_CORRECTION_CHANGE= NAME_PREFIX + "correction_change.gif"; //$NON-NLS-1$
317         public static final String IMG_CORRECTION_MOVE= NAME_PREFIX + "correction_move.gif"; //$NON-NLS-1$
318         public static final String IMG_CORRECTION_RENAME= NAME_PREFIX + "correction_rename.gif"; //$NON-NLS-1$
319         public static final String IMG_CORRECTION_DELETE_IMPORT= NAME_PREFIX + "correction_delete_import.gif"; //$NON-NLS-1$
320         public static final String IMG_CORRECTION_LOCAL= NAME_PREFIX + "localvariable_obj.gif"; //$NON-NLS-1$
321         static {
322                 createManaged(T_OBJ, IMG_CORRECTION_CHANGE);
323                 createManaged(T_OBJ, IMG_CORRECTION_MOVE);
324                 createManaged(T_OBJ, IMG_CORRECTION_RENAME);
325                 createManaged(T_OBJ, IMG_CORRECTION_DELETE_IMPORT);
326                 createManaged(T_OBJ, IMG_CORRECTION_LOCAL);
327         }
328
329         /**
330          * Returns the image managed under the given key in this registry.
331          * 
332          * @param key the image's key
333          * @return the image managed under the given key
334          */ 
335         public static Image get(String key) {
336                 return getImageRegistry().get(key);
337         }
338         
339         /**
340          * Sets the three image descriptors for enabled, disabled, and hovered to an action. The actions
341          * are retrieved from the *tool16 folders.
342          */
343         public static void setToolImageDescriptors(IAction action, String iconName) {
344                 setImageDescriptors(action, "tool16", iconName); //$NON-NLS-1$
345         }
346         
347         /**
348          * Sets the three image descriptors for enabled, disabled, and hovered to an action. The actions
349          * are retrieved from the *lcl16 folders.
350          */
351         public static void setLocalImageDescriptors(IAction action, String iconName) {
352                 setImageDescriptors(action, "lcl16", iconName); //$NON-NLS-1$
353         }
354         
355         /*
356          * Helper method to access the image registry from the JavaPlugin class.
357          */
358         /* package */ static ImageRegistry getImageRegistry() {
359                 if (fgImageRegistry == null) {
360                         fgImageRegistry= new ImageRegistry();
361                         for (Iterator iter= fgAvoidSWTErrorMap.keySet().iterator(); iter.hasNext();) {
362                                 String key= (String) iter.next();
363                                 fgImageRegistry.put(key, (ImageDescriptor) fgAvoidSWTErrorMap.get(key));
364                         }
365                         fgAvoidSWTErrorMap= null;
366                 }
367                 return fgImageRegistry;
368         }
369
370         //---- Helper methods to access icons on the file system --------------------------------------
371
372         private static void setImageDescriptors(IAction action, String type, String relPath) {
373                 
374                 try {
375                         ImageDescriptor id= ImageDescriptor.createFromURL(makeIconFileURL("d" + type, relPath)); //$NON-NLS-1$
376                         if (id != null)
377                                 action.setDisabledImageDescriptor(id);
378                 } catch (MalformedURLException e) {
379                 }
380         
381                 try {
382                         ImageDescriptor id= ImageDescriptor.createFromURL(makeIconFileURL("c" + type, relPath)); //$NON-NLS-1$
383                         if (id != null)
384                                 action.setHoverImageDescriptor(id);
385                 } catch (MalformedURLException e) {
386                 }
387         
388                 action.setImageDescriptor(create("e" + type, relPath)); //$NON-NLS-1$
389         }
390         
391         private static ImageDescriptor createManaged(String prefix, String name) {
392                 try {
393                         ImageDescriptor result= ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
394                         if (fgAvoidSWTErrorMap == null) {
395                                 fgAvoidSWTErrorMap= new HashMap();
396                         }
397                         fgAvoidSWTErrorMap.put(name, result);
398                         if (fgImageRegistry != null) {
399                                 PHPeclipsePlugin.log(IStatus.ERROR, "Image registry already defined"); //$NON-NLS-1$
400                         }
401                         return result;
402                 } catch (MalformedURLException e) {
403                         return ImageDescriptor.getMissingImageDescriptor();
404                 }
405         }
406         
407         private static ImageDescriptor create(String prefix, String name) {
408                 try {
409                         return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
410                 } catch (MalformedURLException e) {
411                         return ImageDescriptor.getMissingImageDescriptor();
412                 }
413         }
414         
415         private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException {
416                 if (fgIconBaseURL == null)
417                         throw new MalformedURLException();
418                         
419                 StringBuffer buffer= new StringBuffer(prefix);
420                 buffer.append('/');
421                 buffer.append(name);
422                 return new URL(fgIconBaseURL, buffer.toString());
423         }       
424 }