e47f5c467d460658c8934ce27bdf8d0946b1bd3a
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / core / JavaCore.java
1 package net.sourceforge.phpdt.core;
2
3 import java.io.File;
4 import java.util.ArrayList;
5 import java.util.Collection;
6 import java.util.Enumeration;
7 import java.util.HashSet;
8 import java.util.Hashtable;
9 import java.util.List;
10 import java.util.Map;
11
12 import net.sourceforge.phpdt.internal.core.BatchOperation;
13 import net.sourceforge.phpdt.internal.core.BufferManager;
14 import net.sourceforge.phpdt.internal.core.ClasspathEntry;
15 import net.sourceforge.phpdt.internal.core.JavaModel;
16 import net.sourceforge.phpdt.internal.core.JavaModelManager;
17 import net.sourceforge.phpdt.internal.core.Region;
18 import net.sourceforge.phpdt.internal.corext.Assert;
19 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
20
21 import org.eclipse.core.resources.IFile;
22 import org.eclipse.core.resources.IFolder;
23 import org.eclipse.core.resources.IMarker;
24 import org.eclipse.core.resources.IMarkerDelta;
25 import org.eclipse.core.resources.IProject;
26 import org.eclipse.core.resources.IProjectDescription;
27 import org.eclipse.core.resources.IResource;
28 import org.eclipse.core.resources.IResourceChangeEvent;
29 import org.eclipse.core.resources.ISavedState;
30 import org.eclipse.core.resources.IWorkspace;
31 import org.eclipse.core.resources.IWorkspaceRoot;
32 import org.eclipse.core.resources.IWorkspaceRunnable;
33 import org.eclipse.core.resources.ResourcesPlugin;
34 import org.eclipse.core.runtime.CoreException;
35 import org.eclipse.core.runtime.IConfigurationElement;
36 import org.eclipse.core.runtime.IPath;
37 import org.eclipse.core.runtime.IProgressMonitor;
38 import org.eclipse.core.runtime.IStatus;
39 import org.eclipse.core.runtime.Plugin;
40 import org.eclipse.core.runtime.Preferences;
41 import org.eclipse.core.runtime.Status;
42 import org.eclipse.core.runtime.jobs.ISchedulingRule;
43 import org.eclipse.core.runtime.jobs.Job;
44 import net.sourceforge.phpdt.internal.core.util.Util;
45 import org.osgi.framework.BundleContext;
46
47 public class JavaCore {
48
49         //  public static HashSet OptionNames = new HashSet(20);
50         /**
51          * The plug-in identifier of the Java core support (value
52          * <code>"net.sourceforge.phpeclipse"</code>)
53          */
54         //  public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.core";
55         // //$NON-NLS-1$
56         public static final String PLUGIN_ID = PHPeclipsePlugin.PLUGIN_ID;
57
58         /**
59          * Possible configurable option ID.
60          * 
61          * @see #getDefaultOptions
62          * @since 2.0
63          */
64         public static final String CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$
65
66         /**
67          * Possible configurable option ID.
68          * 
69          * @see #getDefaultOptions
70          * @since 2.0
71          */
72         public static final String FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID
73                         + ".formatter.newline.openingBrace"; //$NON-NLS-1$
74
75         /**
76          * Possible configurable option ID.
77          * 
78          * @see #getDefaultOptions
79          * @since 2.0
80          */
81         public static final String FORMATTER_NEWLINE_CONTROL = PLUGIN_ID
82                         + ".formatter.newline.controlStatement"; //$NON-NLS-1$
83
84         /**
85          * Possible configurable option ID.
86          * 
87          * @see #getDefaultOptions
88          * @since 2.0
89          */
90         public static final String FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID
91                         + ".formatter.newline.elseIf"; //$NON-NLS-1$
92
93         /**
94          * Possible configurable option ID.
95          * 
96          * @see #getDefaultOptions
97          * @since 2.0
98          */
99         public static final String FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID
100                         + ".formatter.newline.emptyBlock"; //$NON-NLS-1$
101
102         /**
103          * Possible configurable option ID.
104          * 
105          * @see #getDefaultOptions
106          * @since 2.0
107          */
108         public static final String FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID
109                         + ".formatter.newline.clearAll"; //$NON-NLS-1$
110
111         /**
112          * Possible configurable option ID.
113          * 
114          * @see #getDefaultOptions
115          * @since 2.0
116          */
117         public static final String FORMATTER_LINE_SPLIT = PLUGIN_ID
118                         + ".formatter.lineSplit"; //$NON-NLS-1$
119
120         /**
121          * Possible configurable option ID.
122          * 
123          * @see #getDefaultOptions
124          * @since 2.0
125          */
126         public static final String FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID
127                         + ".formatter.style.assignment"; //$NON-NLS-1$
128
129         /**
130          * Possible configurable option ID.
131          * 
132          * @see #getDefaultOptions
133          * @since 2.0
134          */
135         public static final String FORMATTER_TAB_CHAR = PLUGIN_ID
136                         + ".formatter.tabulation.char"; //$NON-NLS-1$
137
138         /**
139          * Possible configurable option ID.
140          * 
141          * @see #getDefaultOptions
142          * @since 2.0
143          */
144         public static final String FORMATTER_TAB_SIZE = PLUGIN_ID
145                         + ".formatter.tabulation.size"; //$NON-NLS-1$
146
147         /**
148          * Possible configurable option value.
149          * 
150          * @see #getDefaultOptions
151          * @since 2.0
152          */
153         public static final String INSERT = "insert"; //$NON-NLS-1$
154
155         /**
156          * Possible configurable option value.
157          * 
158          * @see #getDefaultOptions
159          * @since 2.0
160          */
161         public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$
162
163         /**
164          * Possible configurable option value.
165          * 
166          * @see #getDefaultOptions
167          * @since 2.0
168          */
169         public static final String PRESERVE_ONE = "preserve one"; //$NON-NLS-1$
170
171         /**
172          * Possible configurable option value.
173          * 
174          * @see #getDefaultOptions
175          * @since 2.0
176          */
177         public static final String CLEAR_ALL = "clear all"; //$NON-NLS-1$
178
179         /**
180          * Possible configurable option value.
181          * 
182          * @see #getDefaultOptions
183          * @since 2.0
184          */
185         public static final String NORMAL = "normal"; //$NON-NLS-1$
186
187         /**
188          * Possible configurable option value.
189          * 
190          * @see #getDefaultOptions
191          * @since 2.0
192          */
193         public static final String COMPACT = "compact"; //$NON-NLS-1$
194
195         /**
196          * Possible configurable option value.
197          * 
198          * @see #getDefaultOptions
199          * @since 2.0
200          */
201         public static final String TAB = "tab"; //$NON-NLS-1$
202
203         /**
204          * Possible configurable option value.
205          * 
206          * @see #getDefaultOptions
207          * @since 2.0
208          */
209         public static final String SPACE = "space"; //$NON-NLS-1$
210
211         /**
212          * Possible configurable option value.
213          * 
214          * @see #getDefaultOptions
215          * @since 2.0
216          */
217         public static final String ENABLED = "enabled"; //$NON-NLS-1$
218
219         /**
220          * Possible configurable option value.
221          * 
222          * @see #getDefaultOptions
223          * @since 2.0
224          */
225         public static final String DISABLED = "disabled"; //$NON-NLS-1$
226
227         /**
228          * Possible configurable option value.
229          * 
230          * @see #getDefaultOptions
231          * @since 2.1
232          */
233         public static final String CLEAN = "clean"; //$NON-NLS-1$
234
235         /**
236          * Possible configurable option ID.
237          * 
238          * @see #getDefaultOptions
239          * @since 2.1
240          */
241         public static final String COMPILER_TASK_TAGS = PLUGIN_ID
242                         + ".compiler.taskTags"; //$NON-NLS-1$
243
244         /**
245          * Name of the handle id attribute in a Java marker.
246          */
247         protected static final String ATT_HANDLE_ID = "net.sourceforge.phpdt.internal.core.JavaModelManager.handleId"; //$NON-NLS-1$
248
249         // *************** Possible IDs for configurable options.
250         // ********************
251
252         /**
253          * Possible configurable option ID.
254          * 
255          * @see #getDefaultOptions()
256          */
257         public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID
258                         + ".compiler.debug.localVariable"; //$NON-NLS-1$
259
260         /**
261          * Possible configurable option ID.
262          * 
263          * @see #getDefaultOptions()
264          */
265         public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID
266                         + ".compiler.debug.lineNumber"; //$NON-NLS-1$
267
268         /**
269          * Possible configurable option ID.
270          * 
271          * @see #getDefaultOptions
272          */
273         public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID
274                         + ".compiler.debug.sourceFile"; //$NON-NLS-1$
275
276         /**
277          * Possible configurable option ID.
278          * 
279          * @see #getDefaultOptions
280          */
281         public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID
282                         + ".compiler.codegen.unusedLocal"; //$NON-NLS-1$
283
284         /**
285          * Possible configurable option ID.
286          * 
287          * @see #getDefaultOptions
288          */
289         public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID
290                         + ".compiler.codegen.targetPlatform"; //$NON-NLS-1$
291
292         /**
293          * Possible configurable option ID.
294          * 
295          * @see #getDefaultOptions
296          */
297         public static final String COMPILER_PB_PHP_VAR_DEPRECATED = PLUGIN_ID
298                         + ".compiler.problem.phpVarDeprecatedWarning"; //$NON-NLS-1$
299
300         /**
301          * Possible configurable option ID.
302          * 
303          * @see #getDefaultOptions
304          */
305         public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID
306                         + ".compiler.problem.unreachableCode"; //$NON-NLS-1$
307
308         /**
309          * Possible configurable option ID.
310          * 
311          * @see #getDefaultOptions
312          */
313         public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID
314                         + ".compiler.problem.invalidImport"; //$NON-NLS-1$
315
316         /**
317          * Possible configurable option ID.
318          * 
319          * @see #getDefaultOptions
320          */
321         public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID
322                         + ".compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$
323
324         /**
325          * Possible configurable option ID.
326          * 
327          * @see #getDefaultOptions
328          */
329         public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID
330                         + ".compiler.problem.methodWithConstructorName"; //$NON-NLS-1$
331
332         /**
333          * Possible configurable option ID.
334          * 
335          * @see #getDefaultOptions
336          */
337         public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID
338                         + ".compiler.problem.deprecation"; //$NON-NLS-1$
339
340         /**
341          * Possible configurable option ID.
342          * 
343          * @see #getDefaultOptions
344          * @since 2.1
345          */
346         public static final String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID
347                         + ".compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$
348
349         /**
350          * Possible configurable option ID.
351          * 
352          * @see #getDefaultOptions
353          */
354         public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID
355                         + ".compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$
356
357         /**
358          * Possible configurable option ID.
359          * 
360          * @see #getDefaultOptions
361          */
362         public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID
363                         + ".compiler.problem.unusedLocal"; //$NON-NLS-1$
364
365         /**
366          * Possible configurable option ID.
367          * 
368          * @see #getDefaultOptions
369          */
370         public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID
371                         + ".compiler.problem.unusedParameter"; //$NON-NLS-1$
372
373         /**
374          * Possible configurable option ID.
375          * 
376          * @see #getDefaultOptions
377          * @since 2.1
378          */
379         public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID
380                         + ".compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$
381
382         /**
383          * Possible configurable option ID.
384          * 
385          * @see #getDefaultOptions
386          * @since 2.1
387          */
388         public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID
389                         + ".compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$
390
391         /**
392          * Possible configurable option ID.
393          * 
394          * @see #getDefaultOptions
395          * @since 2.0
396          */
397         public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID
398                         + ".compiler.problem.unusedImport"; //$NON-NLS-1$
399
400         /**
401          * Possible configurable option ID.
402          * 
403          * @see #getDefaultOptions
404          */
405         public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID
406                         + ".compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$
407
408         /**
409          * Possible configurable option ID.
410          * 
411          * @see #getDefaultOptions
412          * @since 2.0
413          */
414         public static final String COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID
415                         + ".compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$
416
417         /**
418          * Possible configurable option ID.
419          * 
420          * @see #getDefaultOptions
421          * @since 2.0
422          */
423         public static final String COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID
424                         + ".compiler.problem.assertIdentifier"; //$NON-NLS-1$
425
426         /**
427          * Possible configurable option ID.
428          * 
429          * @see #getDefaultOptions
430          * @since 2.1
431          */
432         public static final String COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID
433                         + ".compiler.problem.staticAccessReceiver"; //$NON-NLS-1$
434
435         /**
436          * Possible configurable option ID.
437          * 
438          * @see #getDefaultOptions
439          * @since 2.1
440          */
441         public static final String COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID
442                         + ".compiler.problem.noEffectAssignment"; //$NON-NLS-1$
443
444         /**
445          * Possible configurable option ID.
446          * 
447          * @see #getDefaultOptions
448          * @since 2.1
449          */
450         public static final String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID
451                         + ".compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$
452
453         /**
454          * Possible configurable option ID.
455          * 
456          * @see #getDefaultOptions
457          * @since 2.1
458          */
459         public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID
460                         + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$
461
462         /**
463          * Possible configurable option ID.
464          * 
465          * @see #getDefaultOptions
466          * @since 2.1
467          */
468         public static final String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID
469                         + ".compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$
470
471         /**
472          * Possible configurable option ID.
473          * 
474          * @see #getDefaultOptions
475          * @since 2.0
476          */
477         public static final String COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID
478                         + ".compiler.maxProblemPerUnit"; //$NON-NLS-1$
479
480         /**
481          * Possible configurable option ID.
482          * 
483          * @see #getDefaultOptions
484          * @since 2.0
485          */
486         public static final String COMPILER_SOURCE = PLUGIN_ID + ".compiler.source"; //$NON-NLS-1$
487
488         /**
489          * Possible configurable option ID.
490          * 
491          * @see #getDefaultOptions
492          * @since 2.0
493          */
494         public static final String COMPILER_COMPLIANCE = PLUGIN_ID
495                         + ".compiler.compliance"; //$NON-NLS-1$
496
497         /**
498          * Possible configurable option ID.
499          * 
500          * @see #getDefaultOptions
501          * @since 2.1
502          */
503         public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID
504                         + ".compiler.taskPriorities"; //$NON-NLS-1$
505
506         /**
507          * Possible configurable option value for COMPILER_TASK_PRIORITIES.
508          * 
509          * @see #getDefaultOptions
510          * @since 2.1
511          */
512         public static final String COMPILER_TASK_PRIORITY_HIGH = "HIGH"; //$NON-NLS-1$
513
514         /**
515          * Possible configurable option value for COMPILER_TASK_PRIORITIES.
516          * 
517          * @see #getDefaultOptions
518          * @since 2.1
519          */
520         public static final String COMPILER_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$
521
522         /**
523          * Possible configurable option value for COMPILER_TASK_PRIORITIES.
524          * 
525          * @see #getDefaultOptions
526          * @since 2.1
527          */
528         public static final String COMPILER_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$
529
530         /**
531          * Possible configurable option ID.
532          * 
533          * @see #getDefaultOptions
534          */
535         public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID
536                         + ".computeJavaBuildOrder"; //$NON-NLS-1$
537
538         /**
539          * Possible configurable option ID.
540          * 
541          * @see #getDefaultOptions
542          * @since 2.0
543          */
544         public static final String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID
545                         + ".builder.resourceCopyExclusionFilter"; //$NON-NLS-1$
546
547         /**
548          * Possible configurable option ID.
549          * 
550          * @see #getDefaultOptions
551          * @since 2.1
552          */
553         public static final String CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID
554                         + ".builder.duplicateResourceTask"; //$NON-NLS-1$
555
556         /**
557          * Possible configurable option ID.
558          * 
559          * @see #getDefaultOptions
560          * @since 2.1
561          */
562         public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID
563                         + ".builder.cleanOutputFolder"; //$NON-NLS-1$           
564
565         /**
566          * Possible configurable option ID.
567          * 
568          * @see #getDefaultOptions
569          * @since 2.1
570          */
571         public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID
572                         + ".incompleteClasspath"; //$NON-NLS-1$
573
574         /**
575          * Possible configurable option ID.
576          * 
577          * @see #getDefaultOptions
578          * @since 2.1
579          */
580         public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID
581                         + ".circularClasspath"; //$NON-NLS-1$
582
583         /**
584          * Possible configurable option ID.
585          * 
586          * @see #getDefaultOptions
587          * @since 2.0
588          */
589         public static final String CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID
590                         + ".builder.invalidClasspath"; //$NON-NLS-1$
591
592         /**
593          * Possible configurable option ID.
594          * 
595          * @see #getDefaultOptions
596          * @since 2.1
597          */
598         public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID
599                         + ".classpath.exclusionPatterns"; //$NON-NLS-1$
600
601         /**
602          * Possible configurable option ID.
603          * 
604          * @see #getDefaultOptions
605          * @since 2.1
606          */
607         public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID
608                         + ".classpath.multipleOutputLocations"; //$NON-NLS-1$
609
610         /**
611          * Default task tag
612          * 
613          * @since 2.1
614          */
615         public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$
616
617         /**
618          * Default task priority
619          * 
620          * @since 2.1
621          */
622         public static final String DEFAULT_TASK_PRIORITY = "NORMAL"; //$NON-NLS-1$
623
624         /**
625          * Possible configurable option ID
626          * 
627          * @see #getDefaultOptions
628          * @since 2.1
629          */
630         public static final String FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID
631                         + ".formatter.space.castexpression"; //$NON-NLS-1$
632
633         /**
634          * Possible configurable option ID.
635          * 
636          * @see #getDefaultOptions
637          * @since 2.0
638          */
639         public static final String CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID
640                         + ".codeComplete.visibilityCheck"; //$NON-NLS-1$
641
642         /**
643          * Possible configurable option ID.
644          * 
645          * @see #getDefaultOptions
646          * @since 2.0
647          */
648         public static final String CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID
649                         + ".codeComplete.forceImplicitQualification"; //$NON-NLS-1$
650
651         /**
652          * Possible configurable option ID.
653          * 
654          * @see #getDefaultOptions
655          * @since 2.1
656          */
657         public static final String CODEASSIST_FIELD_PREFIXES = PLUGIN_ID
658                         + ".codeComplete.fieldPrefixes"; //$NON-NLS-1$
659
660         /**
661          * Possible configurable option ID.
662          * 
663          * @see #getDefaultOptions
664          * @since 2.1
665          */
666         public static final String CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID
667                         + ".codeComplete.staticFieldPrefixes"; //$NON-NLS-1$
668
669         /**
670          * Possible configurable option ID.
671          * 
672          * @see #getDefaultOptions
673          * @since 2.1
674          */
675         public static final String CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID
676                         + ".codeComplete.localPrefixes"; //$NON-NLS-1$
677
678         /**
679          * Possible configurable option ID.
680          * 
681          * @see #getDefaultOptions
682          * @since 2.1
683          */
684         public static final String CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID
685                         + ".codeComplete.argumentPrefixes"; //$NON-NLS-1$
686
687         /**
688          * Possible configurable option ID.
689          * 
690          * @see #getDefaultOptions
691          * @since 2.1
692          */
693         public static final String CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID
694                         + ".codeComplete.fieldSuffixes"; //$NON-NLS-1$
695
696         /**
697          * Possible configurable option ID.
698          * 
699          * @see #getDefaultOptions
700          * @since 2.1
701          */
702         public static final String CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID
703                         + ".codeComplete.staticFieldSuffixes"; //$NON-NLS-1$
704
705         /**
706          * Possible configurable option ID.
707          * 
708          * @see #getDefaultOptions
709          * @since 2.1
710          */
711         public static final String CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID
712                         + ".codeComplete.localSuffixes"; //$NON-NLS-1$
713
714         /**
715          * Possible configurable option ID.
716          * 
717          * @see #getDefaultOptions
718          * @since 2.1
719          */
720         public static final String CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID
721                         + ".codeComplete.argumentSuffixes"; //$NON-NLS-1$
722
723         // *************** Possible values for configurable options.
724         // ********************
725
726         /**
727          * Possible configurable option value.
728          * 
729          * @see #getDefaultOptions
730          */
731         public static final String GENERATE = "generate"; //$NON-NLS-1$
732
733         /**
734          * Possible configurable option value.
735          * 
736          * @see #getDefaultOptions
737          */
738         public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$
739
740         /**
741          * Possible configurable option value.
742          * 
743          * @see #getDefaultOptions
744          */
745         public static final String PRESERVE = "preserve"; //$NON-NLS-1$
746
747         /**
748          * Possible configurable option value.
749          * 
750          * @see #getDefaultOptions
751          */
752         public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$
753
754         /**
755          * Possible configurable option value.
756          * 
757          * @see #getDefaultOptions
758          */
759         public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$
760
761         /**
762          * Possible configurable option value.
763          * 
764          * @see #getDefaultOptions
765          */
766         public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$
767
768         /**
769          * Possible configurable option value.
770          * 
771          * @see #getDefaultOptions
772          * @since 2.0
773          */
774         public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$
775
776         /**
777          * Possible configurable option value.
778          * 
779          * @see #getDefaultOptions
780          * @since 2.0
781          */
782         public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$
783
784         /**
785          * Possible configurable option value.
786          * 
787          * @see #getDefaultOptions
788          * @since 2.0
789          */
790         public static final String ABORT = "abort"; //$NON-NLS-1$
791
792         /**
793          * Possible configurable option value.
794          * 
795          * @see #getDefaultOptions
796          */
797         public static final String ERROR = "error"; //$NON-NLS-1$
798
799         /**
800          * Possible configurable option value.
801          * 
802          * @see #getDefaultOptions
803          */
804         public static final String WARNING = "warning"; //$NON-NLS-1$
805
806         /**
807          * Possible configurable option value.
808          * 
809          * @see #getDefaultOptions
810          */
811         public static final String IGNORE = "ignore"; //$NON-NLS-1$
812
813         /**
814          * Possible configurable option value.
815          * 
816          * @see #getDefaultOptions
817          */
818         public static final String COMPUTE = "compute"; //$NON-NLS-1$
819
820         /**
821          * Possible configurable option value.
822          * 
823          * @see #getDefaultOptions
824          * @since 2.0
825          */
826
827         /**
828          * Returns a table of all known configurable options with their default
829          * values. These options allow to configure the behaviour of the underlying
830          * components. The client may safely use the result as a template that they
831          * can modify and then pass to <code>setOptions</code>.
832          * 
833          * Helper constants have been defined on JavaCore for each of the option ID
834          * and their possible constant values.
835          * 
836          * Note: more options might be added in further releases.
837          * 
838          * <pre>
839          * 
840          *  RECOGNIZED OPTIONS:
841          *  COMPILER / Generating Local Variable Debug Attribute
842          *     When generated, this attribute will enable local variable names 
843          *     to be displayed in debugger, only in place where variables are 
844          *     definitely assigned (.class file is then bigger)
845          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.debug.localVariable&quot;
846          *      - possible values:   { &quot;generate&quot;, &quot;do not generate&quot; }
847          *      - default:           &quot;generate&quot;
848          * 
849          *  COMPILER / Generating Line Number Debug Attribute 
850          *     When generated, this attribute will enable source code highlighting in debugger 
851          *     (.class file is then bigger).
852          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.debug.lineNumber&quot;
853          *      - possible values:   { &quot;generate&quot;, &quot;do not generate&quot; }
854          *      - default:           &quot;generate&quot;
855          *     
856          *  COMPILER / Generating Source Debug Attribute 
857          *     When generated, this attribute will enable the debugger to present the 
858          *     corresponding source code.
859          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.debug.sourceFile&quot;
860          *      - possible values:   { &quot;generate&quot;, &quot;do not generate&quot; }
861          *      - default:           &quot;generate&quot;
862          *     
863          *  COMPILER / Preserving Unused Local Variables
864          *     Unless requested to preserve unused local variables (i.e. never read), the 
865          *     compiler will optimize them out, potentially altering debugging
866          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.codegen.unusedLocal&quot;
867          *      - possible values:   { &quot;preserve&quot;, &quot;optimize out&quot; }
868          *      - default:           &quot;preserve&quot;
869          *  
870          *  COMPILER / Defining Target Java Platform
871          *     For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
872          *     Note that &quot;1.4&quot; target require to toggle compliance mode to &quot;1.4&quot; too.
873          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.codegen.targetPlatform&quot;
874          *      - possible values:   { &quot;1.1&quot;, &quot;1.2&quot;, &quot;1.3&quot;, &quot;1.4&quot; }
875          *      - default:           &quot;1.1&quot;
876          * 
877          *  COMPILER / Reporting Unreachable Code
878          *     Unreachable code can optionally be reported as an error, warning or simply 
879          *     ignored. The bytecode generation will always optimized it out.
880          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.unreachableCode&quot;
881          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
882          *      - default:           &quot;error&quot;
883          * 
884          *  COMPILER / Reporting Invalid Import
885          *     An import statement that cannot be resolved might optionally be reported 
886          *     as an error, as a warning or ignored.
887          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.invalidImport&quot;
888          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
889          *      - default:           &quot;error&quot;
890          * 
891          *  COMPILER / Reporting Attempt to Override Package-Default Method
892          *     A package default method is not visible in a different package, and thus 
893          *     cannot be overridden. When enabling this option, the compiler will signal 
894          *     such scenarii either as an error or a warning.
895          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.overridingPackageDefaultMethod&quot;
896          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
897          *      - default:           &quot;warning&quot;
898          * 
899          *  COMPILER / Reporting Method With Constructor Name
900          *     Naming a method with a constructor name is generally considered poor 
901          *     style programming. When enabling this option, the compiler will signal such 
902          *     scenarii either as an error or a warning.
903          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.methodWithConstructorName&quot;
904          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
905          *      - default:           &quot;warning&quot;
906          * 
907          *  COMPILER / Reporting Deprecation
908          *     When enabled, the compiler will signal use of deprecated API either as an 
909          *     error or a warning.
910          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.deprecation&quot;
911          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
912          *      - default:           &quot;warning&quot;
913          * 
914          *  COMPILER / Reporting Deprecation Inside Deprecated Code
915          *     When enabled, the compiler will signal use of deprecated API inside deprecated code.
916          *     The severity of the problem is controlled with option &quot;org.phpeclipse.phpdt.core.compiler.problem.deprecation&quot;.
917          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.deprecationInDeprecatedCode&quot;
918          *      - possible values:   { &quot;enabled&quot;, &quot;disabled&quot; }
919          *      - default:           &quot;disabled&quot;
920          * 
921          *  COMPILER / Reporting Hidden Catch Block
922          *     Locally to a try statement, some catch blocks may hide others , e.g.
923          *       try {  throw new java.io.CharConversionException();
924          *       } catch (java.io.CharConversionException e) {
925          *       } catch (java.io.IOException e) {}. 
926          *     When enabling this option, the compiler will issue an error or a warning for hidden 
927          *     catch blocks corresponding to checked exceptions
928          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.hiddenCatchBlock&quot;
929          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
930          *      - default:           &quot;warning&quot;
931          * 
932          *  COMPILER / Reporting Unused Local
933          *     When enabled, the compiler will issue an error or a warning for unused local 
934          *     variables (i.e. variables never read from)
935          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.unusedLocal&quot;
936          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
937          *      - default:           &quot;ignore&quot;
938          * 
939          *  COMPILER / Reporting Unused Parameter
940          *     When enabled, the compiler will issue an error or a warning for unused method 
941          *     parameters (i.e. parameters never read from)
942          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.unusedParameter&quot;
943          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
944          *      - default:           &quot;ignore&quot;
945          * 
946          *  COMPILER / Reporting Unused Import
947          *     When enabled, the compiler will issue an error or a warning for unused import 
948          *     reference 
949          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.unusedImport&quot;
950          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
951          *      - default:           &quot;warning&quot;
952          * 
953          *  COMPILER / Reporting Synthetic Access Emulation
954          *     When enabled, the compiler will issue an error or a warning whenever it emulates 
955          *     access to a non-accessible member of an enclosing type. Such access can have
956          *     performance implications.
957          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.syntheticAccessEmulation&quot;
958          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
959          *      - default:           &quot;ignore&quot;
960          * 
961          *  COMPILER / Reporting Non-Externalized String Literal
962          *     When enabled, the compiler will issue an error or a warning for non externalized 
963          *     String literal (i.e. non tagged with //$NON-NLS-&lt;n&gt;$). 
964          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.nonExternalizedStringLiteral&quot;
965          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
966          *      - default:           &quot;ignore&quot;
967          *  
968          *  COMPILER / Reporting Usage of 'assert' Identifier
969          *     When enabled, the compiler will issue an error or a warning whenever 'assert' is 
970          *     used as an identifier (reserved keyword in 1.4)
971          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.assertIdentifier&quot;
972          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
973          *      - default:           &quot;ignore&quot;
974          *  
975          *  COMPILER / Reporting Usage of expression receiver on static invocation/field access
976          *     When enabled, the compiler will issue an error or a warning whenever a static field
977          *     or method is accessed with an expression receiver.
978          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.staticAccessReceiver&quot;
979          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
980          *      - default:           &quot;warning&quot;
981          *  
982          *  COMPILER / Reporting Assignment with no effect
983          *     When enabled, the compiler will issue an error or a warning whenever an assignment
984          *     has no effect (e.g 'x = x').
985          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.problem.noEffectAssignment&quot;
986          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
987          *      - default:           &quot;warning&quot;
988          *  
989          *  COMPILER / Setting Source Compatibility Mode
990          *     Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
991          *     reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
992          *    level should be set to &quot;1.4&quot; and the compliance mode should be &quot;1.4&quot;.
993          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.source&quot;
994          *      - possible values:   { &quot;1.3&quot;, &quot;1.4&quot; }
995          *      - default:           &quot;1.3&quot;
996          *  
997          *  COMPILER / Setting Compliance Level
998          *     Select the compliance level for the compiler. In &quot;1.3&quot; mode, source and target settings
999          *     should not go beyond &quot;1.3&quot; level.
1000          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.compliance&quot;
1001          *      - possible values:   { &quot;1.3&quot;, &quot;1.4&quot; }
1002          *      - default:           &quot;1.3&quot;
1003          *  
1004          *  COMPILER / Maximum number of problems reported per compilation unit
1005          *     Specify the maximum number of problems reported on each compilation unit.
1006          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.maxProblemPerUnit&quot;
1007          *      - possible values:      &quot;&lt;n&gt;&quot; where &lt;n&gt; is zero or a positive integer (if zero then all problems are reported).
1008          *      - default:           &quot;100&quot;
1009          *  
1010          *  COMPILER / Define the Automatic Task Tags
1011          *     When the tag is non empty, the compiler will issue a task marker whenever it encounters
1012          *     one of the corresponding tag inside any comment in Java source code.
1013          *     Generated task messages will include the tag, and range until the next line separator or comment ending, and will be trimmed.
1014          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.taskTags&quot;
1015          *      - possible values:   { &quot;&lt;tag&gt;[,&lt;tag&gt;]*&quot; } where &lt;tag&gt; is a String without any wild-card 
1016          *      - default:           &quot;&quot;
1017          *  COMPILER / Define the Automatic Task Priorities
1018          *     In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
1019          *     of the task markers issued by the compiler.
1020          *     If the default is specified, the priority of each task marker is &quot;NORMAL&quot;.
1021          *      - option id:         &quot;org.phpeclipse.phpdt.core.compiler.taskPriorities&quot;
1022          *      - possible values:   { &quot;&lt;priority&gt;[,&lt;priority&gt;]*&quot; } where &lt;priority&gt; is one of &quot;HIGH&quot;, &quot;NORMAL&quot; or &quot;LOW&quot;
1023          *      - default:           &quot;&quot;
1024          *  
1025          *  BUILDER / Specifying Filters for Resource Copying Control
1026          *     Allow to specify some filters to control the resource copy process.
1027          *      - option id:         &quot;org.phpeclipse.phpdt.core.builder.resourceCopyExclusionFilter&quot;
1028          *      - possible values:   { &quot;&lt;name&gt;[,&lt;name&gt;]* } where &lt;name&gt; is a file name pattern (* and ? wild-cards allowed)
1029          *        or the name of a folder which ends with '/'
1030          *      - default:           &quot;&quot;
1031          *  
1032          *  BUILDER / Abort if Invalid Classpath
1033          *     Allow to toggle the builder to abort if the classpath is invalid
1034          *      - option id:         &quot;org.phpeclipse.phpdt.core.builder.invalidClasspath&quot;
1035          *      - possible values:   { &quot;abort&quot;, &quot;ignore&quot; }
1036          *      - default:           &quot;ignore&quot;
1037          *  
1038          *  BUILDER / Cleaning Output Folder(s)
1039          *     Indicate whether the JavaBuilder is allowed to clean the output folders
1040          *     when performing full build operations.
1041          *      - option id:         &quot;org.phpeclipse.phpdt.core.builder.cleanOutputFolder&quot;
1042          *      - possible values:   { &quot;clean&quot;, &quot;ignore&quot; }
1043          *      - default:           &quot;clean&quot;
1044          *  
1045          *  JAVACORE / Computing Project Build Order
1046          *     Indicate whether JavaCore should enforce the project build order to be based on
1047          *     the classpath prerequisite chain. When requesting to compute, this takes over
1048          *     the platform default order (based on project references).
1049          *      - option id:         &quot;org.phpeclipse.phpdt.core.computeJavaBuildOrder&quot;
1050          *      - possible values:   { &quot;compute&quot;, &quot;ignore&quot; }
1051          *      - default:           &quot;ignore&quot;  
1052          *  
1053          *  JAVACORE / Specify Default Source Encoding Format
1054          *     Get the encoding format for compiled sources. This setting is read-only, it is equivalent
1055          *     to 'ResourcesPlugin.getEncoding()'.
1056          *      - option id:         &quot;org.phpeclipse.phpdt.core.encoding&quot;
1057          *      - possible values:   { any of the supported encoding name}.
1058          *      - default:           &lt;platform default&gt;
1059          *  
1060          *  JAVACORE / Reporting Incomplete Classpath
1061          *     An entry on the classpath doesn't exist or is not visible (e.g. a referenced project is closed).
1062          *      - option id:         &quot;org.phpeclipse.phpdt.core.incompleteClasspath&quot;
1063          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;}
1064          *      - default:           &quot;error&quot;
1065          *  
1066          *  JAVACORE / Reporting Classpath Cycle
1067          *     A project is involved in a cycle.
1068          *      - option id:         &quot;org.phpeclipse.phpdt.core.circularClasspath&quot;
1069          *      - possible values:   { &quot;error&quot;, &quot;warning&quot; }
1070          *      - default:           &quot;error&quot;
1071          *  
1072          *      FORMATTER / Inserting New Line Before Opening Brace
1073          *     When Insert, a new line is inserted before an opening brace, otherwise nothing
1074          *     is inserted
1075          *      - option id:         &quot;org.phpeclipse.phpdt.core.formatter.newline.openingBrace&quot;
1076          *      - possible values:   { &quot;insert&quot;, &quot;do not insert&quot; }
1077          *      - default:           &quot;do not insert&quot;
1078          *  
1079          *      FORMATTER / Inserting New Line Inside Control Statement
1080          *     When Insert, a new line is inserted between } and following else, catch, finally
1081          *      - option id:         &quot;org.phpeclipse.phpdt.core.formatter.newline.controlStatement&quot;
1082          *      - possible values:   { &quot;insert&quot;, &quot;do not insert&quot; }
1083          *      - default:           &quot;do not insert&quot;
1084          *  
1085          *      FORMATTER / Clearing Blank Lines
1086          *     When Clear all, all blank lines are removed. When Preserve one, only one is kept
1087          *     and all others removed.
1088          *      - option id:         &quot;org.phpeclipse.phpdt.core.formatter.newline.clearAll&quot;
1089          *      - possible values:   { &quot;clear all&quot;, &quot;preserve one&quot; }
1090          *      - default:           &quot;preserve one&quot;
1091          *  
1092          *      FORMATTER / Inserting New Line Between Else/If 
1093          *     When Insert, a blank line is inserted between an else and an if when they are 
1094          *     contiguous. When choosing to not insert, else-if will be kept on the same
1095          *     line when possible.
1096          *      - option id:         &quot;org.phpeclipse.phpdt.core.formatter.newline.elseIf&quot;
1097          *      - possible values:   { &quot;insert&quot;, &quot;do not insert&quot; }
1098          *      - default:           &quot;do not insert&quot;
1099          *  
1100          *      FORMATTER / Inserting New Line In Empty Block
1101          *     When insert, a line break is inserted between contiguous { and }, if } is not followed
1102          *     by a keyword.
1103          *      - option id:         &quot;org.phpeclipse.phpdt.core.formatter.newline.emptyBlock&quot;
1104          *      - possible values:   { &quot;insert&quot;, &quot;do not insert&quot; }
1105          *      - default:           &quot;insert&quot;
1106          *  
1107          *      FORMATTER / Splitting Lines Exceeding Length
1108          *     Enable splitting of long lines (exceeding the configurable length). Length of 0 will
1109          *     disable line splitting
1110          *      - option id:         &quot;org.phpeclipse.phpdt.core.formatter.lineSplit&quot;
1111          *      - possible values:      &quot;&lt;n&gt;&quot;, where n is zero or a positive integer
1112          *      - default:           &quot;80&quot;
1113          *  
1114          *      FORMATTER / Compacting Assignment
1115          *     Assignments can be formatted asymmetrically, e.g. 'int x= 2;', when Normal, a space
1116          *     is inserted before the assignment operator
1117          *      - option id:         &quot;org.phpeclipse.phpdt.core.formatter.style.assignment&quot;
1118          *      - possible values:   { &quot;compact&quot;, &quot;normal&quot; }
1119          *      - default:           &quot;normal&quot;
1120          *  
1121          *      FORMATTER / Defining Indentation Character
1122          *     Either choose to indent with tab characters or spaces
1123          *      - option id:         &quot;org.phpeclipse.phpdt.core.formatter.tabulation.char&quot;
1124          *      - possible values:   { &quot;tab&quot;, &quot;space&quot; }
1125          *      - default:           &quot;tab&quot;
1126          *  
1127          *      FORMATTER / Defining Space Indentation Length
1128          *     When using spaces, set the amount of space characters to use for each 
1129          *     indentation mark.
1130          *      - option id:         &quot;org.phpeclipse.phpdt.core.formatter.tabulation.size&quot;
1131          *      - possible values:      &quot;&lt;n&gt;&quot;, where n is a positive integer
1132          *      - default:           &quot;4&quot;
1133          *  
1134          *      CODEASSIST / Activate Visibility Sensitive Completion
1135          *     When active, completion doesn't show that you can not see
1136          *     (e.g. you can not see private methods of a super class).
1137          *      - option id:         &quot;org.phpeclipse.phpdt.core.codeComplete.visibilityCheck&quot;
1138          *      - possible values:   { &quot;enabled&quot;, &quot;disabled&quot; }
1139          *      - default:           &quot;disabled&quot;
1140          *  
1141          *      CODEASSIST / Automatic Qualification of Implicit Members
1142          *     When active, completion automatically qualifies completion on implicit
1143          *     field references and message expressions.
1144          *      - option id:         &quot;org.phpeclipse.phpdt.core.codeComplete.forceImplicitQualification&quot;
1145          *      - possible values:   { &quot;enabled&quot;, &quot;disabled&quot; }
1146          *      - default:           &quot;disabled&quot;
1147          *  
1148          *   CODEASSIST / Define the Prefixes for Field Name
1149          *     When the prefixes is non empty, completion for field name will begin with
1150          *     one of the proposed prefixes.
1151          *      - option id:         &quot;org.phpeclipse.phpdt.core.codeComplete.fieldPrefixes&quot;
1152          *      - possible values:   { &quot;&lt;prefix&gt;[,&lt;prefix&gt;]*&quot; } where &lt;prefix&gt; is a String without any wild-card 
1153          *      - default:           &quot;&quot;
1154          *  
1155          *   CODEASSIST / Define the Prefixes for Static Field Name
1156          *     When the prefixes is non empty, completion for static field name will begin with
1157          *     one of the proposed prefixes.
1158          *      - option id:         &quot;org.phpeclipse.phpdt.core.codeComplete.staticFieldPrefixes&quot;
1159          *      - possible values:   { &quot;&lt;prefix&gt;[,&lt;prefix&gt;]*&quot; } where &lt;prefix&gt; is a String without any wild-card 
1160          *      - default:           &quot;&quot;
1161          *  
1162          *   CODEASSIST / Define the Prefixes for Local Variable Name
1163          *     When the prefixes is non empty, completion for local variable name will begin with
1164          *     one of the proposed prefixes.
1165          *      - option id:         &quot;org.phpeclipse.phpdt.core.codeComplete.localPrefixes&quot;
1166          *      - possible values:   { &quot;&lt;prefix&gt;[,&lt;prefix&gt;]*&quot; } where &lt;prefix&gt; is a String without any wild-card 
1167          *      - default:           &quot;&quot;
1168          *  
1169          *   CODEASSIST / Define the Prefixes for Argument Name
1170          *     When the prefixes is non empty, completion for argument name will begin with
1171          *     one of the proposed prefixes.
1172          *      - option id:         &quot;org.phpeclipse.phpdt.core.codeComplete.argumentPrefixes&quot;
1173          *      - possible values:   { &quot;&lt;prefix&gt;[,&lt;prefix&gt;]*&quot; } where &lt;prefix&gt; is a String without any wild-card 
1174          *      - default:           &quot;&quot;
1175          *  
1176          *   CODEASSIST / Define the Suffixes for Field Name
1177          *     When the suffixes is non empty, completion for field name will end with
1178          *     one of the proposed suffixes.
1179          *      - option id:         &quot;org.phpeclipse.phpdt.core.codeComplete.fieldSuffixes&quot;
1180          *      - possible values:   { &quot;&lt;suffix&gt;[,&lt;suffix&gt;]*&quot; } where &lt;suffix&gt; is a String without any wild-card 
1181          *      - default:           &quot;&quot;
1182          *  
1183          *   CODEASSIST / Define the Suffixes for Static Field Name
1184          *     When the suffixes is non empty, completion for static field name will end with
1185          *     one of the proposed suffixes.
1186          *      - option id:         &quot;org.phpeclipse.phpdt.core.codeComplete.staticFieldSuffixes&quot;
1187          *      - possible values:   { &quot;&lt;suffix&gt;[,&lt;suffix&gt;]*&quot; } where &lt;suffix&gt; is a String without any wild-card 
1188          *      - default:           &quot;&quot;
1189          *  
1190          *   CODEASSIST / Define the Suffixes for Local Variable Name
1191          *     When the suffixes is non empty, completion for local variable name will end with
1192          *     one of the proposed suffixes.
1193          *      - option id:         &quot;org.phpeclipse.phpdt.core.codeComplete.localSuffixes&quot;
1194          *      - possible values:   { &quot;&lt;suffix&gt;[,&lt;suffix&gt;]*&quot; } where &lt;suffix&gt; is a String without any wild-card 
1195          *      - default:           &quot;&quot;
1196          *  
1197          *   CODEASSIST / Define the Suffixes for Argument Name
1198          *     When the suffixes is non empty, completion for argument name will end with
1199          *     one of the proposed suffixes.
1200          *      - option id:         &quot;org.phpeclipse.phpdt.core.codeComplete.argumentSuffixes&quot;
1201          *      - possible values:   { &quot;&lt;suffix&gt;[,&lt;suffix&gt;]*&quot; } where &lt;prefix&gt; is a String without any wild-card 
1202          *      - default:           &quot;&quot;
1203          *  &lt;/pre&gt;
1204          *  
1205          *  @return a mutable table containing the default settings of all known options
1206          *    (key type: 
1207          * <code>
1208          * String
1209          * </code>
1210          * ; value type: 
1211          * <code>
1212          * String
1213          * </code>
1214          * )
1215          *  @see #setOptions
1216          * 
1217          */
1218         //  public static Hashtable getDefaultOptions() {
1219         //
1220         //    Hashtable defaultOptions = new Hashtable(10);
1221         //
1222         //    // see #initializeDefaultPluginPreferences() for changing default
1223         // settings
1224         //    Preferences preferences = getPlugin().getPluginPreferences();
1225         //    HashSet optionNames = OptionNames;
1226         //
1227         //    // get preferences set to their default
1228         //    String[] defaultPropertyNames = preferences.defaultPropertyNames();
1229         //    for (int i = 0; i < defaultPropertyNames.length; i++) {
1230         //      String propertyName = defaultPropertyNames[i];
1231         //      if (optionNames.contains(propertyName)) {
1232         //        defaultOptions.put(propertyName,
1233         // preferences.getDefaultString(propertyName));
1234         //      }
1235         //    }
1236         //    // get preferences not set to their default
1237         //    String[] propertyNames = preferences.propertyNames();
1238         //    for (int i = 0; i < propertyNames.length; i++) {
1239         //      String propertyName = propertyNames[i];
1240         //      if (optionNames.contains(propertyName)) {
1241         //        defaultOptions.put(propertyName,
1242         // preferences.getDefaultString(propertyName));
1243         //      }
1244         //    }
1245         //    // get encoding through resource plugin
1246         //    defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
1247         //
1248         //    return defaultOptions;
1249         //  }
1250         /**
1251          * Helper method for returning one option value only. Equivalent to
1252          * <code>(String)JavaCore.getOptions().get(optionName)</code> Note that it
1253          * may answer <code>null</code> if this option does not exist.
1254          * <p>
1255          * For a complete description of the configurable options, see
1256          * <code>getDefaultOptions</code>.
1257          * </p>
1258          * 
1259          * @param optionName
1260          *            the name of an option
1261          * @return the String value of a given option
1262          * @see JavaCore#getDefaultOptions
1263          * @since 2.0
1264          */
1265         //  public static String getOption(String optionName) {
1266         //
1267         //    if (CORE_ENCODING.equals(optionName)) {
1268         //      return ResourcesPlugin.getEncoding();
1269         //    }
1270         //    if (OptionNames.contains(optionName)) {
1271         //      Preferences preferences = getPlugin().getPluginPreferences();
1272         //      return preferences.getString(optionName).trim();
1273         //    }
1274         //    return null;
1275         //  }
1276         /**
1277          * Returns the table of the current options. Initially, all options have
1278          * their default values, and this method returns a table that includes all
1279          * known options.
1280          * <p>
1281          * For a complete description of the configurable options, see
1282          * <code>getDefaultOptions</code>.
1283          * </p>
1284          * 
1285          * @return table of current settings of all options (key type:
1286          *         <code>String</code>; value type: <code>String</code>)
1287          * @see JavaCore#getDefaultOptions
1288          */
1289         //  public static Hashtable getOptions() {
1290         //
1291         //    Hashtable options = new Hashtable(10);
1292         //
1293         //    // see #initializeDefaultPluginPreferences() for changing default
1294         // settings
1295         //    Plugin plugin = getPlugin();
1296         //    if (plugin != null) {
1297         //      Preferences preferences = getPlugin().getPluginPreferences();
1298         //      HashSet optionNames = OptionNames;
1299         //
1300         //      // get preferences set to their default
1301         //      String[] defaultPropertyNames = preferences.defaultPropertyNames();
1302         //      for (int i = 0; i < defaultPropertyNames.length; i++) {
1303         //        String propertyName = defaultPropertyNames[i];
1304         //        if (optionNames.contains(propertyName)) {
1305         //          options.put(propertyName, preferences.getDefaultString(propertyName));
1306         //        }
1307         //      }
1308         //      // get preferences not set to their default
1309         //      String[] propertyNames = preferences.propertyNames();
1310         //      for (int i = 0; i < propertyNames.length; i++) {
1311         //        String propertyName = propertyNames[i];
1312         //        if (optionNames.contains(propertyName)) {
1313         //          options.put(propertyName, preferences.getString(propertyName).trim());
1314         //        }
1315         //      }
1316         //      // get encoding through resource plugin
1317         //      options.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
1318         //    }
1319         //    return options;
1320         //  }
1321         /**
1322          * Sets the current table of options. All and only the options explicitly
1323          * included in the given table are remembered; all previous option settings
1324          * are forgotten, including ones not explicitly mentioned.
1325          * <p>
1326          * For a complete description of the configurable options, see
1327          * <code>getDefaultOptions</code>.
1328          * </p>
1329          * 
1330          * @param newOptions
1331          *            the new options (key type: <code>String</code>; value type:
1332          *            <code>String</code>), or <code>null</code> to reset all
1333          *            options to their default values
1334          * @see JavaCore#getDefaultOptions
1335          */
1336         //  public static void setOptions(Hashtable newOptions) {
1337         //
1338         //    // see #initializeDefaultPluginPreferences() for changing default
1339         // settings
1340         //    Preferences preferences = getPlugin().getPluginPreferences();
1341         //
1342         //    if (newOptions == null) {
1343         //      newOptions = getDefaultOptions();
1344         //    }
1345         //    Enumeration keys = newOptions.keys();
1346         //    while (keys.hasMoreElements()) {
1347         //      String key = (String) keys.nextElement();
1348         //      if (!OptionNames.contains(key))
1349         //        continue; // unrecognized option
1350         //      if (key.equals(CORE_ENCODING))
1351         //        continue; // skipped, contributed by resource prefs
1352         //      String value = (String) newOptions.get(key);
1353         //      preferences.setValue(key, value);
1354         //    }
1355         //
1356         //    // persist options
1357         //    getPlugin().savePluginPreferences();
1358         //  }
1359         public static IProject[] getPHPProjects() {
1360                 List phpProjectsList = new ArrayList();
1361                 IProject[] workspaceProjects = PHPeclipsePlugin.getWorkspace()
1362                                 .getRoot().getProjects();
1363
1364                 for (int i = 0; i < workspaceProjects.length; i++) {
1365                         IProject iProject = workspaceProjects[i];
1366                         if (isPHPProject(iProject))
1367                                 phpProjectsList.add(iProject);
1368                 }
1369
1370                 IProject[] phpProjects = new IProject[phpProjectsList.size()];
1371                 return (IProject[]) phpProjectsList.toArray(phpProjects);
1372         }
1373
1374         //  public static PHPProject getPHPProject(String name) {
1375         //    IProject aProject =
1376         // PHPeclipsePlugin.getWorkspace().getRoot().getProject(name);
1377         //    if (isPHPProject(aProject)) {
1378         //      PHPProject thePHPProject = new PHPProject();
1379         //      thePHPProject.setProject(aProject);
1380         //      return thePHPProject;
1381         //    }
1382         //    return null;
1383         //  }
1384
1385         public static boolean isPHPProject(IProject aProject) {
1386                 try {
1387                         return aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID);
1388                 } catch (CoreException e) {
1389                 }
1390
1391                 return false;
1392         }
1393
1394         //  public static PHPFile create(IFile aFile) {
1395         //    if (PHPFile.EXTENSION.equalsIgnoreCase(aFile.getFileExtension()))
1396         //      return new PHPFile(aFile);
1397         //    if (PHPFile.EXTENSION1.equalsIgnoreCase(aFile.getFileExtension()))
1398         //      return new PHPFile(aFile);
1399         //    if (PHPFile.EXTENSION2.equalsIgnoreCase(aFile.getFileExtension()))
1400         //      return new PHPFile(aFile);
1401         //    if (PHPFile.EXTENSION3.equalsIgnoreCase(aFile.getFileExtension()))
1402         //      return new PHPFile(aFile);
1403         //    if (PHPFile.EXTENSION4.equalsIgnoreCase(aFile.getFileExtension()))
1404         //      return new PHPFile(aFile);
1405         //    if (PHPFile.EXTENSION5.equalsIgnoreCase(aFile.getFileExtension()))
1406         //      return new PHPFile(aFile);
1407         //
1408         //    return null;
1409         //  }
1410
1411         //  public static PHPProject create(IProject aProject) {
1412         //      
1413         //    try {
1414         //      if (aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) {
1415         //        PHPProject project = new PHPProject();
1416         //        project.setProject(aProject);
1417         //        return project;
1418         //      }
1419         //    } catch (CoreException e) {
1420         //      System.err.println("Exception occurred in PHPCore#create(IProject): " +
1421         // e.toString());
1422         //    }
1423         //
1424         //    return null;
1425         //  }
1426
1427         public static void addPHPNature(IProject project, IProgressMonitor monitor)
1428                         throws CoreException {
1429                 if (!project.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) {
1430                         IProjectDescription description = project.getDescription();
1431                         String[] prevNatures = description.getNatureIds();
1432                         String[] newNatures = new String[prevNatures.length + 1];
1433                         System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
1434                         newNatures[prevNatures.length] = PHPeclipsePlugin.PHP_NATURE_ID;
1435                         description.setNatureIds(newNatures);
1436                         project.setDescription(description, monitor);
1437                 }
1438         }
1439
1440         /**
1441          * Returns the single instance of the PHP core plug-in runtime class.
1442          * 
1443          * @return the single instance of the PHP core plug-in runtime class
1444          */
1445         public static Plugin getPlugin() {
1446                 return PHPeclipsePlugin.getDefault();
1447         }
1448
1449         /**
1450          * Runs the given action as an atomic Java model operation.
1451          * <p>
1452          * After running a method that modifies java elements, registered listeners
1453          * receive after-the-fact notification of what just transpired, in the form
1454          * of a element changed event. This method allows clients to call a number
1455          * of methods that modify java elements and only have element changed event
1456          * notifications reported at the end of the entire batch.
1457          * </p>
1458          * <p>
1459          * If this method is called outside the dynamic scope of another such call,
1460          * this method runs the action and then reports a single element changed
1461          * event describing the net effect of all changes done to java elements by
1462          * the action.
1463          * </p>
1464          * <p>
1465          * If this method is called in the dynamic scope of another such call, this
1466          * method simply runs the action.
1467          * </p>
1468          * 
1469          * @param action
1470          *            the action to perform
1471          * @param monitor
1472          *            a progress monitor, or <code>null</code> if progress
1473          *            reporting and cancellation are not desired
1474          * @exception CoreException
1475          *                if the operation failed.
1476          * @since 2.1
1477          */
1478         //      public static void run(IWorkspaceRunnable action, IProgressMonitor
1479         // monitor) throws CoreException {
1480         //              run(action, ResourcesPlugin.getWorkspace().getRoot(), monitor);
1481         //      }
1482         /**
1483          * Runs the given action as an atomic Java model operation.
1484          * <p>
1485          * After running a method that modifies java elements, registered listeners
1486          * receive after-the-fact notification of what just transpired, in the form
1487          * of a element changed event. This method allows clients to call a number
1488          * of methods that modify java elements and only have element changed event
1489          * notifications reported at the end of the entire batch.
1490          * </p>
1491          * <p>
1492          * If this method is called outside the dynamic scope of another such call,
1493          * this method runs the action and then reports a single element changed
1494          * event describing the net effect of all changes done to java elements by
1495          * the action.
1496          * </p>
1497          * <p>
1498          * If this method is called in the dynamic scope of another such call, this
1499          * method simply runs the action.
1500          * </p>
1501          * <p>
1502          * The supplied scheduling rule is used to determine whether this operation
1503          * can be run simultaneously with workspace changes in other threads. See
1504          * <code>IWorkspace.run(...)</code> for more details.
1505          * </p>
1506          * 
1507          * @param action
1508          *            the action to perform
1509          * @param rule
1510          *            the scheduling rule to use when running this operation, or
1511          *            <code>null</code> if there are no scheduling restrictions
1512          *            for this operation.
1513          * @param monitor
1514          *            a progress monitor, or <code>null</code> if progress
1515          *            reporting and cancellation are not desired
1516          * @exception CoreException
1517          *                if the operation failed.
1518          * @since 3.0
1519          */
1520         //      public static void run(IWorkspaceRunnable action, ISchedulingRule rule,
1521         // IProgressMonitor monitor) throws CoreException {
1522         //              IWorkspace workspace = ResourcesPlugin.getWorkspace();
1523         //              if (workspace.isTreeLocked()) {
1524         //                      new BatchOperation(action).run(monitor);
1525         //              } else {
1526         //                      // use IWorkspace.run(...) to ensure that a build will be done in
1527         // autobuild mode
1528         //                      workspace.run(new BatchOperation(action), rule, IWorkspace.AVOID_UPDATE,
1529         // monitor);
1530         //              }
1531         //      }
1532
1533         /**
1534          * Adds the given listener for changes to Java elements. Has no effect if an
1535          * identical listener is already registered.
1536          * 
1537          * This listener will only be notified during the POST_CHANGE resource
1538          * change notification and any reconcile operation (POST_RECONCILE). For
1539          * finer control of the notification, use
1540          * <code>addElementChangedListener(IElementChangedListener,int)</code>,
1541          * which allows to specify a different eventMask.
1542          * 
1543          * @see ElementChangedEvent
1544          * @param listener
1545          *            the listener
1546          */
1547         public static void addElementChangedListener(
1548                         IElementChangedListener listener) {
1549                 addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE
1550                                 | ElementChangedEvent.POST_RECONCILE);
1551         }
1552
1553         /**
1554          * Adds the given listener for changes to Java elements. Has no effect if an
1555          * identical listener is already registered. After completion of this
1556          * method, the given listener will be registered for exactly the specified
1557          * events. If they were previously registered for other events, they will be
1558          * deregistered.
1559          * <p>
1560          * Once registered, a listener starts receiving notification of changes to
1561          * java elements in the model. The listener continues to receive
1562          * notifications until it is replaced or removed.
1563          * </p>
1564          * <p>
1565          * Listeners can listen for several types of event as defined in
1566          * <code>ElementChangeEvent</code>. Clients are free to register for any
1567          * number of event types however if they register for more than one, it is
1568          * their responsibility to ensure they correctly handle the case where the
1569          * same java element change shows up in multiple notifications. Clients are
1570          * guaranteed to receive only the events for which they are registered.
1571          * </p>
1572          * 
1573          * @param listener
1574          *            the listener
1575          * @param eventMask
1576          *            the bit-wise OR of all event types of interest to the listener
1577          * @see IElementChangedListener
1578          * @see ElementChangedEvent
1579          * @see #removeElementChangedListener(IElementChangedListener)
1580          * @since 2.0
1581          */
1582         public static void addElementChangedListener(
1583                         IElementChangedListener listener, int eventMask) {
1584                 JavaModelManager.getJavaModelManager().addElementChangedListener(
1585                                 listener, eventMask);
1586         }
1587
1588         /**
1589          * Configures the given marker attribute map for the given Java element.
1590          * Used for markers, which denote a Java element rather than a resource.
1591          * 
1592          * @param attributes
1593          *            the mutable marker attribute map (key type:
1594          *            <code>String</code>, value type: <code>String</code>)
1595          * @param element
1596          *            the Java element for which the marker needs to be configured
1597          */
1598         public static void addJavaElementMarkerAttributes(Map attributes,
1599                         IJavaElement element) {
1600                 //      if (element instanceof IMember)
1601                 //              element = ((IMember) element).getClassFile();
1602                 if (attributes != null && element != null)
1603                         attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier());
1604         }
1605
1606         /**
1607          * Configures the given marker for the given Java element. Used for markers,
1608          * which denote a Java element rather than a resource.
1609          * 
1610          * @param marker
1611          *            the marker to be configured
1612          * @param element
1613          *            the Java element for which the marker needs to be configured
1614          * @exception CoreException
1615          *                if the <code>IMarker.setAttribute</code> on the marker
1616          *                fails
1617          */
1618         public void configureJavaElementMarker(IMarker marker, IJavaElement element)
1619                         throws CoreException {
1620                 //      if (element instanceof IMember)
1621                 //              element = ((IMember) element).getClassFile();
1622                 if (marker != null && element != null)
1623                         marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier());
1624         }
1625
1626         /**
1627          * Returns the Java model element corresponding to the given handle
1628          * identifier generated by <code>IJavaElement.getHandleIdentifier()</code>,
1629          * or <code>null</code> if unable to create the associated element.
1630          */
1631         public static IJavaElement create(String handleIdentifier) {
1632                 if (handleIdentifier == null) {
1633                         return null;
1634                 }
1635                 try {
1636                         return JavaModelManager.getJavaModelManager().getHandleFromMemento(
1637                                         handleIdentifier);
1638                 } catch (JavaModelException e) {
1639                         return null;
1640                 }
1641         }
1642
1643         /**
1644          * Returns the Java element corresponding to the given file, or
1645          * <code>null</code> if unable to associate the given file with a Java
1646          * element.
1647          * 
1648          * <p>
1649          * The file must be one of:
1650          * <ul>
1651          * <li>a <code>.java</code> file - the element returned is the
1652          * corresponding <code>ICompilationUnit</code></li>
1653          * <li>a <code>.class</code> file - the element returned is the
1654          * corresponding <code>IClassFile</code></li>
1655          * <li>a <code>.jar</code> file - the element returned is the
1656          * corresponding <code>IPackageFragmentRoot</code></li>
1657          * </ul>
1658          * <p>
1659          * Creating a Java element has the side effect of creating and opening all
1660          * of the element's parents if they are not yet open.
1661          * 
1662          * @param the
1663          *            given file
1664          * @return the Java element corresponding to the given file, or
1665          *         <code>null</code> if unable to associate the given file with a
1666          *         Java element
1667          */
1668         public static IJavaElement create(IFile file) {
1669                 return JavaModelManager.create(file, null);
1670         }
1671
1672         /**
1673          * Returns the package fragment or package fragment root corresponding to
1674          * the given folder, or <code>null</code> if unable to associate the given
1675          * folder with a Java element.
1676          * <p>
1677          * Note that a package fragment root is returned rather than a default
1678          * package.
1679          * <p>
1680          * Creating a Java element has the side effect of creating and opening all
1681          * of the element's parents if they are not yet open.
1682          * 
1683          * @param the
1684          *            given folder
1685          * @return the package fragment or package fragment root corresponding to
1686          *         the given folder, or <code>null</code> if unable to associate
1687          *         the given folder with a Java element
1688          */
1689         public static IJavaElement create(IFolder folder) {
1690                 return JavaModelManager.create(folder, null);
1691         }
1692
1693         /**
1694          * Returns the Java project corresponding to the given project.
1695          * <p>
1696          * Creating a Java Project has the side effect of creating and opening all
1697          * of the project's parents if they are not yet open.
1698          * <p>
1699          * Note that no check is done at this time on the existence or the java
1700          * nature of this project.
1701          * 
1702          * @param project
1703          *            the given project
1704          * @return the Java project corresponding to the given project, null if the
1705          *         given project is null
1706          */
1707         public static IJavaProject create(IProject project) {
1708                 if (project == null) {
1709                         return null;
1710                 }
1711                 JavaModel javaModel = JavaModelManager.getJavaModelManager()
1712                                 .getJavaModel();
1713                 return javaModel.getJavaProject(project);
1714         }
1715
1716         /**
1717          * Returns the Java element corresponding to the given resource, or
1718          * <code>null</code> if unable to associate the given resource with a Java
1719          * element.
1720          * <p>
1721          * The resource must be one of:
1722          * <ul>
1723          * <li>a project - the element returned is the corresponding
1724          * <code>IJavaProject</code></li>
1725          * <li>a <code>.java</code> file - the element returned is the
1726          * corresponding <code>ICompilationUnit</code></li>
1727          * <li>a <code>.class</code> file - the element returned is the
1728          * corresponding <code>IClassFile</code></li>
1729          * <li>a <code>.jar</code> file - the element returned is the
1730          * corresponding <code>IPackageFragmentRoot</code></li>
1731          * <li>a folder - the element returned is the corresponding
1732          * <code>IPackageFragmentRoot</code> or <code>IPackageFragment</code>
1733          * </li>
1734          * <li>the workspace root resource - the element returned is the
1735          * <code>IJavaModel</code></li>
1736          * </ul>
1737          * <p>
1738          * Creating a Java element has the side effect of creating and opening all
1739          * of the element's parents if they are not yet open.
1740          * 
1741          * @param resource
1742          *            the given resource
1743          * @return the Java element corresponding to the given resource, or
1744          *         <code>null</code> if unable to associate the given resource
1745          *         with a Java element
1746          */
1747         public static IJavaElement create(IResource resource) {
1748                 return JavaModelManager.create(resource, null);
1749         }
1750
1751         /**
1752          * Returns the Java model.
1753          * 
1754          * @param root
1755          *            the given root
1756          * @return the Java model, or <code>null</code> if the root is null
1757          */
1758         public static IJavaModel create(IWorkspaceRoot root) {
1759                 if (root == null) {
1760                         return null;
1761                 }
1762                 return JavaModelManager.getJavaModelManager().getJavaModel();
1763         }
1764
1765         /**
1766          * Creates and returns a class file element for the given
1767          * <code>.class</code> file. Returns <code>null</code> if unable to
1768          * recognize the class file.
1769          * 
1770          * @param file
1771          *            the given <code>.class</code> file
1772          * @return a class file element for the given <code>.class</code> file, or
1773          *         <code>null</code> if unable to recognize the class file
1774          */
1775         //public static IClassFile createClassFileFrom(IFile file) {
1776         //      return JavaModelManager.createClassFileFrom(file, null);
1777         //}
1778         /**
1779          * Creates and returns a compilation unit element for the given
1780          * <code>.java</code> file. Returns <code>null</code> if unable to
1781          * recognize the compilation unit.
1782          * 
1783          * @param file
1784          *            the given <code>.java</code> file
1785          * @return a compilation unit element for the given <code>.java</code>
1786          *         file, or <code>null</code> if unable to recognize the
1787          *         compilation unit
1788          */
1789         public static ICompilationUnit createCompilationUnitFrom(IFile file) {
1790                 return JavaModelManager.createCompilationUnitFrom(file, null);
1791         }
1792
1793         /**
1794          * Creates and returns a handle for the given JAR file. The Java model
1795          * associated with the JAR's project may be created as a side effect.
1796          * 
1797          * @param file
1798          *            the given JAR file
1799          * @return a handle for the given JAR file, or <code>null</code> if unable
1800          *         to create a JAR package fragment root. (for example, if the JAR
1801          *         file represents a non-Java resource)
1802          */
1803         //public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile
1804         // file) {
1805         //      return JavaModelManager.createJarPackageFragmentRootFrom(file, null);
1806         //}
1807         /**
1808          * Answers the project specific value for a given classpath container. In
1809          * case this container path could not be resolved, then will answer
1810          * <code>null</code>. Both the container path and the project context are
1811          * supposed to be non-null.
1812          * <p>
1813          * The containerPath is a formed by a first ID segment followed with extra
1814          * segments, which can be used as additional hints for resolution. If no
1815          * container was ever recorded for this container path onto this project
1816          * (using <code>setClasspathContainer</code>, then a
1817          * <code>ClasspathContainerInitializer</code> will be activated if any was
1818          * registered for this container ID onto the extension point
1819          * "org.eclipse.jdt.core.classpathContainerInitializer".
1820          * <p>
1821          * There is no assumption that the returned container must answer the exact
1822          * same containerPath when requested
1823          * <code>IClasspathContainer#getPath</code>. Indeed, the containerPath is
1824          * just an indication for resolving it to an actual container object.
1825          * <p>
1826          * Classpath container values are persisted locally to the workspace, but
1827          * are not preserved from a session to another. It is thus highly
1828          * recommended to register a <code>ClasspathContainerInitializer</code>
1829          * for each referenced container (through the extension point
1830          * "org.eclipse.jdt.core.ClasspathContainerInitializer").
1831          * <p>
1832          * 
1833          * @param containerPath
1834          *            the name of the container, which needs to be resolved
1835          * @param project
1836          *            a specific project in which the container is being resolved
1837          * @return the corresponding classpath container or <code>null</code> if
1838          *         unable to find one.
1839          * 
1840          * @exception JavaModelException
1841          *                if an exception occurred while resolving the container, or
1842          *                if the resolved container contains illegal entries
1843          *                (contains CPE_CONTAINER entries or null entries).
1844          * 
1845          * @see ClasspathContainerInitializer
1846          * @see IClasspathContainer
1847          * @see #setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[],
1848          *      IProgressMonitor)
1849          * @since 2.0
1850          */
1851         //public static IClasspathContainer getClasspathContainer(final IPath
1852         // containerPath, final IJavaProject project) throws JavaModelException {
1853         //
1854         //      IClasspathContainer container = JavaModelManager.containerGet(project,
1855         // containerPath);
1856         //      if (container == JavaModelManager.ContainerInitializationInProgress)
1857         // return null; // break cycle
1858         //
1859         //      if (container == null){
1860         //              final ClasspathContainerInitializer initializer =
1861         // JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
1862         //              if (initializer != null){
1863         //                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
1864         //                              System.out.println("CPContainer INIT - triggering initialization of:
1865         // ["+project.getElementName()+"] " + containerPath + " using initializer:
1866         // "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
1867         //                              new Exception("FAKE exception for dumping current CPContainer
1868         // (["+project.getElementName()+"] "+ containerPath+ ")INIT invocation stack
1869         // trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
1870         //                      }
1871         //                      JavaModelManager.containerPut(project, containerPath,
1872         // JavaModelManager.ContainerInitializationInProgress); // avoid
1873         // initialization cycles
1874         //                      boolean ok = false;
1875         //                      try {
1876         //                              // wrap initializer call with Safe runnable in case initializer would be
1877         // causing some grief
1878         //                              Platform.run(new ISafeRunnable() {
1879         //                                      public void handleException(Throwable exception) {
1880         //                                              Util.log(exception, "Exception occurred in classpath container
1881         // initializer: "+initializer); //$NON-NLS-1$
1882         //                                      }
1883         //                                      public void run() throws Exception {
1884         //                                              initializer.initialize(containerPath, project);
1885         //                                      }
1886         //                              });
1887         //                                      
1888         //                              // retrieve value (if initialization was successful)
1889         //                              container = JavaModelManager.containerGet(project, containerPath);
1890         //                              if (container == JavaModelManager.ContainerInitializationInProgress)
1891         // return null; // break cycle
1892         //                              ok = true;
1893         //                      } finally {
1894         //                              if (!ok) JavaModelManager.containerPut(project, containerPath, null); //
1895         // flush cache
1896         //                      }
1897         //                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
1898         //                              System.out.print("CPContainer INIT - after resolution:
1899         // ["+project.getElementName()+"] " + containerPath + " --> ");
1900         // //$NON-NLS-2$//$NON-NLS-1$//$NON-NLS-3$
1901         //                              if (container != null){
1902         //                                      System.out.print("container: "+container.getDescription()+" {");
1903         // //$NON-NLS-2$//$NON-NLS-1$
1904         //                                      IClasspathEntry[] entries = container.getClasspathEntries();
1905         //                                      if (entries != null){
1906         //                                              for (int i = 0; i < entries.length; i++){
1907         //                                                      if (i > 0) System.out.println(", ");//$NON-NLS-1$
1908         //                                                      System.out.println(entries[i]);
1909         //                                              }
1910         //                                      }
1911         //                                      System.out.println("}");//$NON-NLS-1$
1912         //                              } else {
1913         //                                      System.out.println("{unbound}");//$NON-NLS-1$
1914         //                              }
1915         //                      }
1916         //              } else {
1917         //                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
1918         //                              System.out.println("CPContainer INIT - no initializer found for:
1919         // "+project.getElementName()+"] " + containerPath); //$NON-NLS-1$
1920         // //$NON-NLS-2$
1921         //                      }
1922         //              }
1923         //      }
1924         //      return container;
1925         //}
1926         /**
1927          * Helper method finding the classpath container initializer registered for
1928          * a given classpath container ID or <code>null</code> if none was found
1929          * while iterating over the contributions to extension point to the
1930          * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
1931          * <p>
1932          * A containerID is the first segment of any container path, used to
1933          * identify the registered container initializer.
1934          * <p>
1935          * 
1936          * @param String -
1937          *            a containerID identifying a registered initializer
1938          * @return ClasspathContainerInitializer - the registered classpath
1939          *         container initializer or <code>null</code> if none was found.
1940          * @since 2.1
1941          */
1942         //public static ClasspathContainerInitializer
1943         // getClasspathContainerInitializer(String containerID){
1944         //              
1945         //      Plugin jdtCorePlugin = JavaCore.getPlugin();
1946         //      if (jdtCorePlugin == null) return null;
1947         //
1948         //      IExtensionPoint extension =
1949         // jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID);
1950         //      if (extension != null) {
1951         //              IExtension[] extensions = extension.getExtensions();
1952         //              for(int i = 0; i < extensions.length; i++){
1953         //                      IConfigurationElement [] configElements =
1954         // extensions[i].getConfigurationElements();
1955         //                      for(int j = 0; j < configElements.length; j++){
1956         //                              String initializerID = configElements[j].getAttribute("id");
1957         // //$NON-NLS-1$
1958         //                              if (initializerID != null && initializerID.equals(containerID)){
1959         //                                      if (JavaModelManager.CP_RESOLVE_VERBOSE) {
1960         //                                              System.out.println("CPContainer INIT - found initializer: "+containerID
1961         // +" --> " +
1962         // configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
1963         //                                      }
1964         //                                      try {
1965         //                                              Object execExt = configElements[j].createExecutableExtension("class");
1966         // //$NON-NLS-1$
1967         //                                              if (execExt instanceof ClasspathContainerInitializer){
1968         //                                                      return (ClasspathContainerInitializer)execExt;
1969         //                                              }
1970         //                                      } catch(CoreException e) {
1971         //                                      }
1972         //                              }
1973         //                      }
1974         //              }
1975         //      }
1976         //      return null;
1977         //}
1978         /**
1979          * Returns the path held in the given classpath variable. Returns <node>null
1980          * </code> if unable to bind.
1981          * <p>
1982          * Classpath variable values are persisted locally to the workspace, and are
1983          * preserved from session to session.
1984          * <p>
1985          * Note that classpath variables can be contributed registered initializers
1986          * for, using the extension point
1987          * "org.eclipse.jdt.core.classpathVariableInitializer". If an initializer is
1988          * registered for a variable, its persisted value will be ignored: its
1989          * initializer will thus get the opportunity to rebind the variable
1990          * differently on each session.
1991          * 
1992          * @param variableName
1993          *            the name of the classpath variable
1994          * @return the path, or <code>null</code> if none
1995          * @see #setClasspathVariable
1996          */
1997         public static IPath getClasspathVariable(final String variableName) {
1998
1999                 IPath variablePath = JavaModelManager.variableGet(variableName);
2000                 if (variablePath == JavaModelManager.VariableInitializationInProgress)
2001                         return null; // break cycle
2002
2003                 if (variablePath != null) {
2004                         return variablePath;
2005                 }
2006
2007                 // even if persisted value exists, initializer is given priority, only
2008                 // if no initializer is found the persisted value is reused
2009                 //      final ClasspathVariableInitializer initializer =
2010                 // PHPCore.getClasspathVariableInitializer(variableName);
2011                 //      if (initializer != null){
2012                 //              if (JavaModelManager.CP_RESOLVE_VERBOSE){
2013                 //                      System.out.println("CPVariable INIT - triggering initialization of: "
2014                 // + variableName+ " using initializer: "+ initializer); //$NON-NLS-1$
2015                 // //$NON-NLS-2$
2016                 //                      new Exception("FAKE exception for dumping current CPVariable
2017                 // ("+variableName+ ")INIT invocation stack trace").printStackTrace();
2018                 // //$NON-NLS-1$//$NON-NLS-2$
2019                 //              }
2020                 //              JavaModelManager.variablePut(variableName,
2021                 // JavaModelManager.VariableInitializationInProgress); // avoid
2022                 // initialization cycles
2023                 //              boolean ok = false;
2024                 //              try {
2025                 //                      // wrap initializer call with Safe runnable in case initializer would
2026                 // be causing some grief
2027                 //                      Platform.run(new ISafeRunnable() {
2028                 //                              public void handleException(Throwable exception) {
2029                 //                                      Util.log(exception, "Exception occurred in classpath variable
2030                 // initializer: "+initializer+" while initializing variable:
2031                 // "+variableName); //$NON-NLS-1$ //$NON-NLS-2$
2032                 //                              }
2033                 //                              public void run() throws Exception {
2034                 //                                      initializer.initialize(variableName);
2035                 //                              }
2036                 //                      });
2037                 //                      variablePath = (IPath) JavaModelManager.variableGet(variableName); //
2038                 // initializer should have performed side-effect
2039                 //                      if (variablePath ==
2040                 // JavaModelManager.VariableInitializationInProgress) return null; //
2041                 // break cycle (initializer did not init or reentering call)
2042                 //                      if (JavaModelManager.CP_RESOLVE_VERBOSE){
2043                 //                              System.out.println("CPVariable INIT - after initialization: " +
2044                 // variableName + " --> " + variablePath); //$NON-NLS-2$//$NON-NLS-1$
2045                 //                      }
2046                 //                      ok = true;
2047                 //              } finally {
2048                 //                      if (!ok) JavaModelManager.variablePut(variableName, null); // flush
2049                 // cache
2050                 //              }
2051                 //      } else {
2052                 //              if (JavaModelManager.CP_RESOLVE_VERBOSE){
2053                 //                      System.out.println("CPVariable INIT - no initializer found for: " +
2054                 // variableName); //$NON-NLS-1$
2055                 //              }
2056                 //      }
2057                 return variablePath;
2058         }
2059
2060         /**
2061          * Helper method finding the classpath variable initializer registered for a
2062          * given classpath variable name or <code>null</code> if none was found
2063          * while iterating over the contributions to extension point to the
2064          * extension point "org.eclipse.jdt.core.classpathVariableInitializer".
2065          * <p>
2066          * 
2067          * @param the
2068          *            given variable
2069          * @return ClasspathVariableInitializer - the registered classpath variable
2070          *         initializer or <code>null</code> if none was found.
2071          * @since 2.1
2072          */
2073         public static ClasspathVariableInitializer getClasspathVariableInitializer(
2074                         String variable) {
2075
2076                 Plugin jdtCorePlugin = JavaCore.getPlugin();
2077                 if (jdtCorePlugin == null)
2078                         return null;
2079
2080                 //      IExtensionPoint extension =
2081                 // jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID);
2082                 //      if (extension != null) {
2083                 //              IExtension[] extensions = extension.getExtensions();
2084                 //              for(int i = 0; i < extensions.length; i++){
2085                 //                      IConfigurationElement [] configElements =
2086                 // extensions[i].getConfigurationElements();
2087                 //                      for(int j = 0; j < configElements.length; j++){
2088                 //                              try {
2089                 //                                      String varAttribute = configElements[j].getAttribute("variable");
2090                 // //$NON-NLS-1$
2091                 //                                      if (variable.equals(varAttribute)) {
2092                 //                                              if (JavaModelManager.CP_RESOLVE_VERBOSE) {
2093                 //                                                      System.out.println("CPVariable INIT - found initializer: "+variable+"
2094                 // --> " +
2095                 // configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
2096                 //                                              }
2097                 //                                              Object execExt =
2098                 // configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
2099                 //                                              if (execExt instanceof ClasspathVariableInitializer){
2100                 //                                                      return (ClasspathVariableInitializer)execExt;
2101                 //                                              }
2102                 //                                      }
2103                 //                              } catch(CoreException e){
2104                 //                              }
2105                 //                              }
2106                 //              }
2107                 //      }
2108                 return null;
2109         }
2110
2111         /**
2112          * Returns the names of all known classpath variables.
2113          * <p>
2114          * Classpath variable values are persisted locally to the workspace, and are
2115          * preserved from session to session.
2116          * <p>
2117          * 
2118          * @return the list of classpath variable names
2119          * @see #setClasspathVariable
2120          */
2121         //public static String[] getClasspathVariableNames() {
2122         //      return JavaModelManager.variableNames();
2123         //}
2124         /**
2125          * Returns a table of all known configurable options with their default
2126          * values. These options allow to configure the behaviour of the underlying
2127          * components. The client may safely use the result as a template that they
2128          * can modify and then pass to <code>setOptions</code>.
2129          * 
2130          * Helper constants have been defined on JavaCore for each of the option ID
2131          * and their possible constant values.
2132          * 
2133          * Note: more options might be added in further releases.
2134          * 
2135          * <pre>
2136          * 
2137          *  RECOGNIZED OPTIONS:
2138          *  COMPILER / Generating Local Variable Debug Attribute
2139          *     When generated, this attribute will enable local variable names 
2140          *     to be displayed in debugger, only in place where variables are 
2141          *     definitely assigned (.class file is then bigger)
2142          *      - option id:         &quot;org.eclipse.jdt.core.compiler.debug.localVariable&quot;
2143          *      - possible values:   { &quot;generate&quot;, &quot;do not generate&quot; }
2144          *      - default:           &quot;generate&quot;
2145          * 
2146          *  COMPILER / Generating Line Number Debug Attribute 
2147          *     When generated, this attribute will enable source code highlighting in debugger 
2148          *     (.class file is then bigger).
2149          *      - option id:         &quot;org.eclipse.jdt.core.compiler.debug.lineNumber&quot;
2150          *      - possible values:   { &quot;generate&quot;, &quot;do not generate&quot; }
2151          *      - default:           &quot;generate&quot;
2152          *     
2153          *  COMPILER / Generating Source Debug Attribute 
2154          *     When generated, this attribute will enable the debugger to present the 
2155          *     corresponding source code.
2156          *      - option id:         &quot;org.eclipse.jdt.core.compiler.debug.sourceFile&quot;
2157          *      - possible values:   { &quot;generate&quot;, &quot;do not generate&quot; }
2158          *      - default:           &quot;generate&quot;
2159          *     
2160          *  COMPILER / Preserving Unused Local Variables
2161          *     Unless requested to preserve unused local variables (that is, never read), the 
2162          *     compiler will optimize them out, potentially altering debugging
2163          *      - option id:         &quot;org.eclipse.jdt.core.compiler.codegen.unusedLocal&quot;
2164          *      - possible values:   { &quot;preserve&quot;, &quot;optimize out&quot; }
2165          *      - default:           &quot;preserve&quot;
2166          *  
2167          *  COMPILER / Defining Target Java Platform
2168          *     For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
2169          *     Note that &quot;1.4&quot; target require to toggle compliance mode to &quot;1.4&quot; too.
2170          *      - option id:         &quot;org.eclipse.jdt.core.compiler.codegen.targetPlatform&quot;
2171          *      - possible values:   { &quot;1.1&quot;, &quot;1.2&quot;, &quot;1.3&quot;, &quot;1.4&quot; }
2172          *      - default:           &quot;1.1&quot;
2173          * 
2174          *  COMPILER / Reporting Unreachable Code
2175          *     Unreachable code can optionally be reported as an error, warning or simply 
2176          *     ignored. The bytecode generation will always optimized it out.
2177          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.unreachableCode&quot;
2178          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2179          *      - default:           &quot;error&quot;
2180          * 
2181          *  COMPILER / Reporting Invalid Import
2182          *     An import statement that cannot be resolved might optionally be reported 
2183          *     as an error, as a warning or ignored.
2184          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.invalidImport&quot;
2185          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2186          *      - default:           &quot;error&quot;
2187          * 
2188          *  COMPILER / Reporting Attempt to Override Package-Default Method
2189          *     A package default method is not visible in a different package, and thus 
2190          *     cannot be overridden. When enabling this option, the compiler will signal 
2191          *     such scenarii either as an error or a warning.
2192          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod&quot;
2193          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2194          *      - default:           &quot;warning&quot;
2195          * 
2196          *  COMPILER / Reporting Method With Constructor Name
2197          *     Naming a method with a constructor name is generally considered poor 
2198          *     style programming. When enabling this option, the compiler will signal such 
2199          *     scenarii either as an error or a warning.
2200          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.methodWithConstructorName&quot;
2201          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2202          *      - default:           &quot;warning&quot;
2203          * 
2204          *  COMPILER / Reporting Deprecation
2205          *     When enabled, the compiler will signal use of deprecated API either as an 
2206          *     error or a warning.
2207          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.deprecation&quot;
2208          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2209          *      - default:           &quot;warning&quot;
2210          * 
2211          *  COMPILER / Reporting Deprecation Inside Deprecated Code
2212          *     When enabled, the compiler will signal use of deprecated API inside deprecated code.
2213          *     The severity of the problem is controlled with option &quot;org.eclipse.jdt.core.compiler.problem.deprecation&quot;.
2214          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode&quot;
2215          *      - possible values:   { &quot;enabled&quot;, &quot;disabled&quot; }
2216          *      - default:           &quot;disabled&quot;
2217          * 
2218          *  COMPILER / Reporting Hidden Catch Block
2219          *     Locally to a try statement, some catch blocks may hide others . For example,
2220          *       try {  throw new java.io.CharConversionException();
2221          *       } catch (java.io.CharConversionException e) {
2222          *       } catch (java.io.IOException e) {}. 
2223          *     When enabling this option, the compiler will issue an error or a warning for hidden 
2224          *     catch blocks corresponding to checked exceptions
2225          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock&quot;
2226          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2227          *      - default:           &quot;warning&quot;
2228          * 
2229          *  COMPILER / Reporting Unused Local
2230          *     When enabled, the compiler will issue an error or a warning for unused local 
2231          *     variables (that is, variables never read from)
2232          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.unusedLocal&quot;
2233          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2234          *      - default:           &quot;ignore&quot;
2235          * 
2236          *  COMPILER / Reporting Unused Parameter
2237          *     When enabled, the compiler will issue an error or a warning for unused method 
2238          *     parameters (that is, parameters never read from)
2239          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.unusedParameter&quot;
2240          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2241          *      - default:           &quot;ignore&quot;
2242          * 
2243          *  COMPILER / Reporting Unused Parameter if Implementing Abstract Method
2244          *     When enabled, the compiler will signal unused parameters in abstract method implementations.
2245          *     The severity of the problem is controlled with option &quot;org.eclipse.jdt.core.compiler.problem.unusedParameter&quot;.
2246          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract&quot;
2247          *      - possible values:   { &quot;enabled&quot;, &quot;disabled&quot; }
2248          *      - default:           &quot;disabled&quot;
2249          * 
2250          *  COMPILER / Reporting Unused Parameter if Overriding Concrete Method
2251          *     When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
2252          *     The severity of the problem is controlled with option &quot;org.eclipse.jdt.core.compiler.problem.unusedParameter&quot;.
2253          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete&quot;
2254          *      - possible values:   { &quot;enabled&quot;, &quot;disabled&quot; }
2255          *      - default:           &quot;disabled&quot;
2256          * 
2257          *  COMPILER / Reporting Unused Import
2258          *     When enabled, the compiler will issue an error or a warning for unused import 
2259          *     reference 
2260          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.unusedImport&quot;
2261          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2262          *      - default:           &quot;warning&quot;
2263          * 
2264          *  COMPILER / Reporting Unused Private Members
2265          *     When enabled, the compiler will issue an error or a warning whenever a private 
2266          *     method or field is declared but never used within the same unit.
2267          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.unusedPrivateMember&quot;
2268          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2269          *      - default:           &quot;ignore&quot;
2270          * 
2271          *  COMPILER / Reporting Synthetic Access Emulation
2272          *     When enabled, the compiler will issue an error or a warning whenever it emulates 
2273          *     access to a non-accessible member of an enclosing type. Such access can have
2274          *     performance implications.
2275          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation&quot;
2276          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2277          *      - default:           &quot;ignore&quot;
2278          * 
2279          *  COMPILER / Reporting Non-Externalized String Literal
2280          *     When enabled, the compiler will issue an error or a warning for non externalized 
2281          *     String literal (that is, not tagged with //$NON-NLS-&lt;n&gt;$). 
2282          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral&quot;
2283          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2284          *      - default:           &quot;ignore&quot;
2285          *  
2286          *  COMPILER / Reporting Usage of 'assert' Identifier
2287          *     When enabled, the compiler will issue an error or a warning whenever 'assert' is 
2288          *     used as an identifier (reserved keyword in 1.4)
2289          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.assertIdentifier&quot;
2290          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2291          *      - default:           &quot;ignore&quot;
2292          *  
2293          *  COMPILER / Reporting Non-Static Reference to a Static Member
2294          *     When enabled, the compiler will issue an error or a warning whenever a static field
2295          *     or method is accessed with an expression receiver. A reference to a static member should
2296          *     be qualified with a type name.
2297          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.staticAccessReceiver&quot;
2298          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2299          *      - default:           &quot;warning&quot;
2300          *  
2301          *  COMPILER / Reporting Assignment with no Effect
2302          *     When enabled, the compiler will issue an error or a warning whenever an assignment
2303          *     has no effect (e.g 'x = x').
2304          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.noEffectAssignment&quot;
2305          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2306          *      - default:           &quot;warning&quot;
2307          *  
2308          *  COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
2309          *     When enabled, the compiler will issue an error or a warning whenever an interface
2310          *     defines a method incompatible with a non-inherited Object method. Until this conflict
2311          *     is resolved, such an interface cannot be implemented, For example, 
2312          *       interface I { 
2313          *          int clone();
2314          *       } 
2315          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod&quot;
2316          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2317          *      - default:           &quot;warning&quot;
2318          *  
2319          *  COMPILER / Reporting Usage of char[] Expressions in String Concatenations
2320          *     When enabled, the compiler will issue an error or a warning whenever a char[] expression
2321          *     is used in String concatenations (for example, &quot;hello&quot; + new char[]{'w','o','r','l','d'}).
2322          *      - option id:         &quot;org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion&quot;
2323          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;, &quot;ignore&quot; }
2324          *      - default:           &quot;warning&quot;
2325          * 
2326          *  COMPILER / Setting Source Compatibility Mode
2327          *     Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
2328          *     reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
2329          *    level should be set to &quot;1.4&quot; and the compliance mode should be &quot;1.4&quot;.
2330          *      - option id:         &quot;org.eclipse.jdt.core.compiler.source&quot;
2331          *      - possible values:   { &quot;1.3&quot;, &quot;1.4&quot; }
2332          *      - default:           &quot;1.3&quot;
2333          *  
2334          *  COMPILER / Setting Compliance Level
2335          *     Select the compliance level for the compiler. In &quot;1.3&quot; mode, source and target settings
2336          *     should not go beyond &quot;1.3&quot; level.
2337          *      - option id:         &quot;org.eclipse.jdt.core.compiler.compliance&quot;
2338          *      - possible values:   { &quot;1.3&quot;, &quot;1.4&quot; }
2339          *      - default:           &quot;1.3&quot;
2340          *  
2341          *  COMPILER / Maximum number of problems reported per compilation unit
2342          *     Specify the maximum number of problems reported on each compilation unit.
2343          *      - option id:         &quot;org.eclipse.jdt.core.compiler.maxProblemPerUnit&quot;
2344          *      - possible values:      &quot;&lt;n&gt;&quot; where &lt;n&gt; is zero or a positive integer (if zero then all problems are reported).
2345          *      - default:           &quot;100&quot;
2346          *  
2347          *  COMPILER / Define the Automatic Task Tags
2348          *     When the tag list is not empty, the compiler will issue a task marker whenever it encounters
2349          *     one of the corresponding tag inside any comment in Java source code.
2350          *     Generated task messages will include the tag, and range until the next line separator or comment ending.
2351          *     Note that tasks messages are trimmed.
2352          *      - option id:         &quot;org.eclipse.jdt.core.compiler.taskTags&quot;
2353          *      - possible values:   { &quot;&lt;tag&gt;[,&lt;tag&gt;]*&quot; } where &lt;tag&gt; is a String without any wild-card or leading/trailing spaces 
2354          *      - default:           &quot;&quot;
2355          *  
2356          *  COMPILER / Define the Automatic Task Priorities
2357          *     In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
2358          *     of the task markers issued by the compiler.
2359          *     If the default is specified, the priority of each task marker is &quot;NORMAL&quot;.
2360          *      - option id:         &quot;org.eclipse.jdt.core.compiler.taskPriorities&quot;
2361          *      - possible values:   { &quot;&lt;priority&gt;[,&lt;priority&gt;]*&quot; } where &lt;priority&gt; is one of &quot;HIGH&quot;, &quot;NORMAL&quot; or &quot;LOW&quot;
2362          *      - default:           &quot;&quot;
2363          * 
2364          *  BUILDER / Specifying Filters for Resource Copying Control
2365          *     Allow to specify some filters to control the resource copy process.
2366          *      - option id:         &quot;org.eclipse.jdt.core.builder.resourceCopyExclusionFilter&quot;
2367          *      - possible values:   { &quot;&lt;name&gt;[,&lt;name&gt;]* } where &lt;name&gt; is a file name pattern (* and ? wild-cards allowed)
2368          *        or the name of a folder which ends with '/'
2369          *      - default:           &quot;&quot;
2370          *  
2371          *  BUILDER / Abort if Invalid Classpath
2372          *     Allow to toggle the builder to abort if the classpath is invalid
2373          *      - option id:         &quot;org.eclipse.jdt.core.builder.invalidClasspath&quot;
2374          *      - possible values:   { &quot;abort&quot;, &quot;ignore&quot; }
2375          *      - default:           &quot;abort&quot;
2376          *  
2377          *  BUILDER / Cleaning Output Folder(s)
2378          *     Indicate whether the JavaBuilder is allowed to clean the output folders
2379          *     when performing full build operations.
2380          *      - option id:         &quot;org.eclipse.jdt.core.builder.cleanOutputFolder&quot;
2381          *      - possible values:   { &quot;clean&quot;, &quot;ignore&quot; }
2382          *      - default:           &quot;clean&quot;
2383          *  
2384          *  BUILDER / Reporting Duplicate Resources
2385          *     Indicate the severity of the problem reported when more than one occurrence
2386          *     of a resource is to be copied into the output location.
2387          *      - option id:         &quot;org.eclipse.jdt.core.builder.duplicateResourceTask&quot;
2388          *      - possible values:   { &quot;error&quot;, &quot;warning&quot; }
2389          *      - default:           &quot;warning&quot;
2390          *  
2391          *  JAVACORE / Computing Project Build Order
2392          *     Indicate whether JavaCore should enforce the project build order to be based on
2393          *     the classpath prerequisite chain. When requesting to compute, this takes over
2394          *     the platform default order (based on project references).
2395          *      - option id:         &quot;org.eclipse.jdt.core.computeJavaBuildOrder&quot;
2396          *      - possible values:   { &quot;compute&quot;, &quot;ignore&quot; }
2397          *      - default:           &quot;ignore&quot;  
2398          *  
2399          *  JAVACORE / Specify Default Source Encoding Format
2400          *     Get the encoding format for compiled sources. This setting is read-only, it is equivalent
2401          *     to 'ResourcesPlugin.getEncoding()'.
2402          *      - option id:         &quot;org.eclipse.jdt.core.encoding&quot;
2403          *      - possible values:   { any of the supported encoding name}.
2404          *      - default:           &lt;platform default&gt;
2405          *  
2406          *  JAVACORE / Reporting Incomplete Classpath
2407          *     Indicate the severity of the problem reported when an entry on the classpath does not exist, 
2408          *     is not legite or is not visible (for example, a referenced project is closed).
2409          *      - option id:         &quot;org.eclipse.jdt.core.incompleteClasspath&quot;
2410          *      - possible values:   { &quot;error&quot;, &quot;warning&quot;}
2411          *      - default:           &quot;error&quot;
2412          *  
2413          *  JAVACORE / Reporting Classpath Cycle
2414          *     Indicate the severity of the problem reported when a project is involved in a cycle.
2415          *      - option id:         &quot;org.eclipse.jdt.core.circularClasspath&quot;
2416          *      - possible values:   { &quot;error&quot;, &quot;warning&quot; }
2417          *      - default:           &quot;error&quot;
2418          *  
2419          *  JAVACORE / Enabling Usage of Classpath Exclusion Patterns
2420          *     When disabled, no entry on a project classpath can be associated with
2421          *     an exclusion pattern.
2422          *      - option id:         &quot;org.eclipse.jdt.core.classpath.exclusionPatterns&quot;
2423          *      - possible values:   { &quot;enabled&quot;, &quot;disabled&quot; }
2424          *      - default:           &quot;enabled&quot;
2425          *  
2426          *  JAVACORE / Enabling Usage of Classpath Multiple Output Locations
2427          *     When disabled, no entry on a project classpath can be associated with
2428          *     a specific output location, preventing thus usage of multiple output locations.
2429          *      - option id:         &quot;org.eclipse.jdt.core.classpath.multipleOutputLocations&quot;
2430          *      - possible values:   { &quot;enabled&quot;, &quot;disabled&quot; }
2431          *      - default:           &quot;enabled&quot;
2432          *  
2433          *      FORMATTER / Inserting New Line Before Opening Brace
2434          *     When Insert, a new line is inserted before an opening brace, otherwise nothing
2435          *     is inserted
2436          *      - option id:         &quot;org.eclipse.jdt.core.formatter.newline.openingBrace&quot;
2437          *      - possible values:   { &quot;insert&quot;, &quot;do not insert&quot; }
2438          *      - default:           &quot;do not insert&quot;
2439          *  
2440          *      FORMATTER / Inserting New Line Inside Control Statement
2441          *     When Insert, a new line is inserted between } and following else, catch, finally
2442          *      - option id:         &quot;org.eclipse.jdt.core.formatter.newline.controlStatement&quot;
2443          *      - possible values:   { &quot;insert&quot;, &quot;do not insert&quot; }
2444          *      - default:           &quot;do not insert&quot;
2445          *  
2446          *      FORMATTER / Clearing Blank Lines
2447          *     When Clear all, all blank lines are removed. When Preserve one, only one is kept
2448          *     and all others removed.
2449          *      - option id:         &quot;org.eclipse.jdt.core.formatter.newline.clearAll&quot;
2450          *      - possible values:   { &quot;clear all&quot;, &quot;preserve one&quot; }
2451          *      - default:           &quot;preserve one&quot;
2452          *  
2453          *      FORMATTER / Inserting New Line Between Else/If 
2454          *     When Insert, a blank line is inserted between an else and an if when they are 
2455          *     contiguous. When choosing to not insert, else-if will be kept on the same
2456          *     line when possible.
2457          *      - option id:         &quot;org.eclipse.jdt.core.formatter.newline.elseIf&quot;
2458          *      - possible values:   { &quot;insert&quot;, &quot;do not insert&quot; }
2459          *      - default:           &quot;do not insert&quot;
2460          *  
2461          *      FORMATTER / Inserting New Line In Empty Block
2462          *     When insert, a line break is inserted between contiguous { and }, if } is not followed
2463          *     by a keyword.
2464          *      - option id:         &quot;org.eclipse.jdt.core.formatter.newline.emptyBlock&quot;
2465          *      - possible values:   { &quot;insert&quot;, &quot;do not insert&quot; }
2466          *      - default:           &quot;insert&quot;
2467          *  
2468          *      FORMATTER / Splitting Lines Exceeding Length
2469          *     Enable splitting of long lines (exceeding the configurable length). Length of 0 will
2470          *     disable line splitting
2471          *      - option id:         &quot;org.eclipse.jdt.core.formatter.lineSplit&quot;
2472          *      - possible values:      &quot;&lt;n&gt;&quot;, where n is zero or a positive integer
2473          *      - default:           &quot;80&quot;
2474          *  
2475          *      FORMATTER / Compacting Assignment
2476          *     Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
2477          *     is inserted before the assignment operator
2478          *      - option id:         &quot;org.eclipse.jdt.core.formatter.style.assignment&quot;
2479          *      - possible values:   { &quot;compact&quot;, &quot;normal&quot; }
2480          *      - default:           &quot;normal&quot;
2481          *  
2482          *      FORMATTER / Defining Indentation Character
2483          *     Either choose to indent with tab characters or spaces
2484          *      - option id:         &quot;org.eclipse.jdt.core.formatter.tabulation.char&quot;
2485          *      - possible values:   { &quot;tab&quot;, &quot;space&quot; }
2486          *      - default:           &quot;tab&quot;
2487          *  
2488          *      FORMATTER / Defining Space Indentation Length
2489          *     When using spaces, set the amount of space characters to use for each 
2490          *     indentation mark.
2491          *      - option id:         &quot;org.eclipse.jdt.core.formatter.tabulation.size&quot;
2492          *      - possible values:      &quot;&lt;n&gt;&quot;, where n is a positive integer
2493          *      - default:           &quot;4&quot;
2494          *  
2495          *      FORMATTER / Inserting space in cast expression
2496          *     When Insert, a space is added between the type and the expression in a cast expression.
2497          *      - option id:         &quot;org.eclipse.jdt.core.formatter.space.castexpression&quot;
2498          *      - possible values:   { &quot;insert&quot;, &quot;do not insert&quot; }
2499          *      - default:           &quot;insert&quot;
2500          *  
2501          *      CODEASSIST / Activate Visibility Sensitive Completion
2502          *     When active, completion doesn't show that you can not see
2503          *     (for example, you can not see private methods of a super class).
2504          *      - option id:         &quot;org.eclipse.jdt.core.codeComplete.visibilityCheck&quot;
2505          *      - possible values:   { &quot;enabled&quot;, &quot;disabled&quot; }
2506          *      - default:           &quot;disabled&quot;
2507          *  
2508          *      CODEASSIST / Automatic Qualification of Implicit Members
2509          *     When active, completion automatically qualifies completion on implicit
2510          *     field references and message expressions.
2511          *      - option id:         &quot;org.eclipse.jdt.core.codeComplete.forceImplicitQualification&quot;
2512          *      - possible values:   { &quot;enabled&quot;, &quot;disabled&quot; }
2513          *      - default:           &quot;disabled&quot;
2514          *  
2515          *   CODEASSIST / Define the Prefixes for Field Name
2516          *     When the prefixes is non empty, completion for field name will begin with
2517          *     one of the proposed prefixes.
2518          *      - option id:         &quot;org.eclipse.jdt.core.codeComplete.fieldPrefixes&quot;
2519          *      - possible values:   { &quot;&lt;prefix&gt;[,&lt;prefix&gt;]*&quot; } where &lt;prefix&gt; is a String without any wild-card 
2520          *      - default:           &quot;&quot;
2521          *  
2522          *   CODEASSIST / Define the Prefixes for Static Field Name
2523          *     When the prefixes is non empty, completion for static field name will begin with
2524          *     one of the proposed prefixes.
2525          *      - option id:         &quot;org.eclipse.jdt.core.codeComplete.staticFieldPrefixes&quot;
2526          *      - possible values:   { &quot;&lt;prefix&gt;[,&lt;prefix&gt;]*&quot; } where &lt;prefix&gt; is a String without any wild-card 
2527          *      - default:           &quot;&quot;
2528          *  
2529          *   CODEASSIST / Define the Prefixes for Local Variable Name
2530          *     When the prefixes is non empty, completion for local variable name will begin with
2531          *     one of the proposed prefixes.
2532          *      - option id:         &quot;org.eclipse.jdt.core.codeComplete.localPrefixes&quot;
2533          *      - possible values:   { &quot;&lt;prefix&gt;[,&lt;prefix&gt;]*&quot; } where &lt;prefix&gt; is a String without any wild-card 
2534          *      - default:           &quot;&quot;
2535          *  
2536          *   CODEASSIST / Define the Prefixes for Argument Name
2537          *     When the prefixes is non empty, completion for argument name will begin with
2538          *     one of the proposed prefixes.
2539          *      - option id:         &quot;org.eclipse.jdt.core.codeComplete.argumentPrefixes&quot;
2540          *      - possible values:   { &quot;&lt;prefix&gt;[,&lt;prefix&gt;]*&quot; } where &lt;prefix&gt; is a String without any wild-card 
2541          *      - default:           &quot;&quot;
2542          *  
2543          *   CODEASSIST / Define the Suffixes for Field Name
2544          *     When the suffixes is non empty, completion for field name will end with
2545          *     one of the proposed suffixes.
2546          *      - option id:         &quot;org.eclipse.jdt.core.codeComplete.fieldSuffixes&quot;
2547          *      - possible values:   { &quot;&lt;suffix&gt;[,&lt;suffix&gt;]*&quot; } where &lt;suffix&gt; is a String without any wild-card 
2548          *      - default:           &quot;&quot;
2549          *  
2550          *   CODEASSIST / Define the Suffixes for Static Field Name
2551          *     When the suffixes is non empty, completion for static field name will end with
2552          *     one of the proposed suffixes.
2553          *      - option id:         &quot;org.eclipse.jdt.core.codeComplete.staticFieldSuffixes&quot;
2554          *      - possible values:   { &quot;&lt;suffix&gt;[,&lt;suffix&gt;]*&quot; } where &lt;suffix&gt; is a String without any wild-card 
2555          *      - default:           &quot;&quot;
2556          *  
2557          *   CODEASSIST / Define the Suffixes for Local Variable Name
2558          *     When the suffixes is non empty, completion for local variable name will end with
2559          *     one of the proposed suffixes.
2560          *      - option id:         &quot;org.eclipse.jdt.core.codeComplete.localSuffixes&quot;
2561          *      - possible values:   { &quot;&lt;suffix&gt;[,&lt;suffix&gt;]*&quot; } where &lt;suffix&gt; is a String without any wild-card 
2562          *      - default:           &quot;&quot;
2563          *  
2564          *   CODEASSIST / Define the Suffixes for Argument Name
2565          *     When the suffixes is non empty, completion for argument name will end with
2566          *     one of the proposed suffixes.
2567          *      - option id:         &quot;org.eclipse.jdt.core.codeComplete.argumentSuffixes&quot;
2568          *      - possible values:   { &quot;&lt;suffix&gt;[,&lt;suffix&gt;]*&quot; } where &lt;prefix&gt; is a String without any wild-card 
2569          *      - default:           &quot;&quot;
2570          *  &lt;/pre&gt;
2571          *  
2572          *  @return a mutable table containing the default settings of all known options
2573          *    (key type: 
2574          * <code>
2575          * String
2576          * </code>
2577          * ; value type: 
2578          * <code>
2579          * String
2580          * </code>
2581          * )
2582          *  @see #setOptions
2583          * 
2584          */
2585         public static Hashtable getDefaultOptions() {
2586
2587                 Hashtable defaultOptions = new Hashtable(10);
2588
2589                 // see #initializeDefaultPluginPreferences() for changing default
2590                 // settings
2591                 Preferences preferences = getPlugin().getPluginPreferences();
2592                 HashSet optionNames = JavaModelManager.OptionNames;
2593
2594                 // get preferences set to their default
2595                 String[] defaultPropertyNames = preferences.defaultPropertyNames();
2596                 for (int i = 0; i < defaultPropertyNames.length; i++) {
2597                         String propertyName = defaultPropertyNames[i];
2598                         if (optionNames.contains(propertyName)) {
2599                                 defaultOptions.put(propertyName, preferences
2600                                                 .getDefaultString(propertyName));
2601                         }
2602                 }
2603                 // get preferences not set to their default
2604                 String[] propertyNames = preferences.propertyNames();
2605                 for (int i = 0; i < propertyNames.length; i++) {
2606                         String propertyName = propertyNames[i];
2607                         if (optionNames.contains(propertyName)) {
2608                                 defaultOptions.put(propertyName, preferences
2609                                                 .getDefaultString(propertyName));
2610                         }
2611                 }
2612                 // get encoding through resource plugin
2613                 defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
2614
2615                 return defaultOptions;
2616         }
2617
2618         /**
2619          * Returns the single instance of the Java core plug-in runtime class.
2620          * Equivalent to <code>(JavaCore) getPlugin()</code>.
2621          * 
2622          * @return the single instance of the Java core plug-in runtime class
2623          */
2624         public static PHPeclipsePlugin getJavaCore() {
2625                 return (PHPeclipsePlugin) getPlugin();
2626         }
2627
2628         /**
2629          * Helper method for returning one option value only. Equivalent to
2630          * <code>(String)JavaCore.getOptions().get(optionName)</code> Note that it
2631          * may answer <code>null</code> if this option does not exist.
2632          * <p>
2633          * For a complete description of the configurable options, see
2634          * <code>getDefaultOptions</code>.
2635          * </p>
2636          * 
2637          * @param optionName
2638          *            the name of an option
2639          * @return the String value of a given option
2640          * @see JavaCore#getDefaultOptions
2641          * @since 2.0
2642          */
2643         public static String getOption(String optionName) {
2644
2645                 if (CORE_ENCODING.equals(optionName)) {
2646                         return ResourcesPlugin.getEncoding();
2647                 }
2648                 if (JavaModelManager.OptionNames.contains(optionName)) {
2649                         Preferences preferences = getPlugin().getPluginPreferences();
2650                         return preferences.getString(optionName).trim();
2651                 }
2652                 return null;
2653         }
2654
2655         /**
2656          * Returns the table of the current options. Initially, all options have
2657          * their default values, and this method returns a table that includes all
2658          * known options.
2659          * <p>
2660          * For a complete description of the configurable options, see
2661          * <code>getDefaultOptions</code>.
2662          * </p>
2663          * 
2664          * @return table of current settings of all options (key type:
2665          *         <code>String</code>; value type: <code>String</code>)
2666          * @see JavaCore#getDefaultOptions
2667          */
2668         public static Hashtable getOptions() {
2669
2670                 Hashtable options = new Hashtable(10);
2671
2672                 // see #initializeDefaultPluginPreferences() for changing default
2673                 // settings
2674                 Plugin plugin = getPlugin();
2675                 if (plugin != null) {
2676                         Preferences preferences = getPlugin().getPluginPreferences();
2677                         HashSet optionNames = JavaModelManager.OptionNames;
2678
2679                         // get preferences set to their default
2680                         String[] defaultPropertyNames = preferences.defaultPropertyNames();
2681                         for (int i = 0; i < defaultPropertyNames.length; i++) {
2682                                 String propertyName = defaultPropertyNames[i];
2683                                 if (optionNames.contains(propertyName)) {
2684                                         options.put(propertyName, preferences
2685                                                         .getDefaultString(propertyName));
2686                                 }
2687                         }
2688                         // get preferences not set to their default
2689                         String[] propertyNames = preferences.propertyNames();
2690                         for (int i = 0; i < propertyNames.length; i++) {
2691                                 String propertyName = propertyNames[i];
2692                                 if (optionNames.contains(propertyName)) {
2693                                         options.put(propertyName, preferences.getString(
2694                                                         propertyName).trim());
2695                                 }
2696                         }
2697                         // get encoding through resource plugin
2698                         options.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
2699                 }
2700                 return options;
2701         }
2702
2703         /**
2704          * This is a helper method, which returns the resolved classpath entry
2705          * denoted by a given entry (if it is a variable entry). It is obtained by
2706          * resolving the variable reference in the first segment. Returns <node>null
2707          * </code> if unable to resolve using the following algorithm:
2708          * <ul>
2709          * <li>if variable segment cannot be resolved, returns <code>null</code>
2710          * </li>
2711          * <li>finds a project, JAR or binary folder in the workspace at the
2712          * resolved path location</li>
2713          * <li>if none finds an external JAR file or folder outside the workspace
2714          * at the resolved path location</li>
2715          * <li>if none returns <code>null</code></li>
2716          * </ul>
2717          * <p>
2718          * Variable source attachment path and root path are also resolved and
2719          * recorded in the resulting classpath entry.
2720          * <p>
2721          * NOTE: This helper method does not handle classpath containers, for which
2722          * should rather be used <code>JavaCore#getClasspathContainer(IPath,
2723          * IJavaProject)</code>.
2724          * <p>
2725          * 
2726          * @param entry
2727          *            the given variable entry
2728          * @return the resolved library or project classpath entry, or <code>null
2729          *         </code> if the given variable entry could not be resolved to a
2730          *         valid classpath entry
2731          */
2732         public static IClasspathEntry getResolvedClasspathEntry(
2733                         IClasspathEntry entry) {
2734
2735                 if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE)
2736                         return entry;
2737
2738                 IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
2739                 IPath resolvedPath = JavaCore.getResolvedVariablePath(entry.getPath());
2740                 if (resolvedPath == null)
2741                         return null;
2742
2743                 Object target = JavaModel.getTarget(workspaceRoot, resolvedPath, false);
2744                 if (target == null)
2745                         return null;
2746
2747                 // inside the workspace
2748                 if (target instanceof IResource) {
2749                         IResource resolvedResource = (IResource) target;
2750                         if (resolvedResource != null) {
2751                                 switch (resolvedResource.getType()) {
2752
2753                                 case IResource.PROJECT:
2754                                         // internal project
2755                                         return JavaCore.newProjectEntry(resolvedPath, entry
2756                                                         .isExported());
2757
2758                                 case IResource.FILE:
2759                                         //                                      if (Util.isArchiveFileName(resolvedResource.getName())) {
2760                                         //                                              // internal binary archive
2761                                         //                                              return JavaCore.newLibraryEntry(
2762                                         //                                                              resolvedPath,
2763                                         //                                                              getResolvedVariablePath(entry.getSourceAttachmentPath()),
2764                                         //                                                              getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
2765                                         //                                                              entry.isExported());
2766                                         //                                      }
2767                                         break;
2768
2769                                 case IResource.FOLDER:
2770                                         // internal binary folder
2771                                         //                                      return JavaCore.newLibraryEntry(
2772                                         //                                                      resolvedPath,
2773                                         //                                                      getResolvedVariablePath(entry.getSourceAttachmentPath()),
2774                                         //                                                      getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
2775                                         //                                                      entry.isExported());
2776                                         break;
2777                                 }
2778                         }
2779                 }
2780                 // outside the workspace
2781                 if (target instanceof File) {
2782                         File externalFile = (File) target;
2783                         if (externalFile.isFile()) {
2784                                 String fileName = externalFile.getName().toLowerCase();
2785                                 //                      if (fileName.endsWith(".jar" //$NON-NLS-1$
2786                                 //                              ) || fileName.endsWith(".zip" //$NON-NLS-1$
2787                                 //                              )) { // external binary archive
2788                                 //                              return JavaCore.newLibraryEntry(
2789                                 //                                              resolvedPath,
2790                                 //                                              getResolvedVariablePath(entry.getSourceAttachmentPath()),
2791                                 //                                              getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
2792                                 //                                              entry.isExported());
2793                                 //                      }
2794                         } else { // external binary folder
2795                                 if (resolvedPath.isAbsolute()) {
2796                                         //                              return JavaCore.newLibraryEntry(
2797                                         //                                              resolvedPath,
2798                                         //                                              getResolvedVariablePath(entry.getSourceAttachmentPath()),
2799                                         //                                              getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
2800                                         //                                              entry.isExported());
2801                                 }
2802                         }
2803                 }
2804                 return null;
2805         }
2806
2807         /**
2808          * Resolve a variable path (helper method).
2809          * 
2810          * @param variablePath
2811          *            the given variable path
2812          * @return the resolved variable path or <code>null</code> if none
2813          */
2814         public static IPath getResolvedVariablePath(IPath variablePath) {
2815
2816                 if (variablePath == null)
2817                         return null;
2818                 int count = variablePath.segmentCount();
2819                 if (count == 0)
2820                         return null;
2821
2822                 // lookup variable
2823                 String variableName = variablePath.segment(0);
2824                 IPath resolvedPath = JavaCore.getClasspathVariable(variableName);
2825                 if (resolvedPath == null)
2826                         return null;
2827
2828                 // append path suffix
2829                 if (count > 1) {
2830                         resolvedPath = resolvedPath.append(variablePath
2831                                         .removeFirstSegments(1));
2832                 }
2833                 return resolvedPath;
2834         }
2835
2836         /**
2837          * Answers the shared working copies currently registered for this buffer
2838          * factory. Working copies can be shared by several clients using the same
2839          * buffer factory,see <code>IWorkingCopy.getSharedWorkingCopy</code>.
2840          * 
2841          * @param factory
2842          *            the given buffer factory
2843          * @return the list of shared working copies for a given buffer factory
2844          * @see IWorkingCopy
2845          * @since 2.0
2846          */
2847         public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory) {
2848
2849                 // if factory is null, default factory must be used
2850                 if (factory == null)
2851                         factory = BufferManager.getDefaultBufferManager()
2852                                         .getDefaultBufferFactory();
2853                 Map sharedWorkingCopies = JavaModelManager.getJavaModelManager().sharedWorkingCopies;
2854
2855                 Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory);
2856                 if (perFactoryWorkingCopies == null)
2857                         return JavaModelManager.NoWorkingCopy;
2858                 Collection copies = perFactoryWorkingCopies.values();
2859                 IWorkingCopy[] result = new IWorkingCopy[copies.size()];
2860                 copies.toArray(result);
2861                 return result;
2862         }
2863
2864         /**
2865          * Initializes the default preferences settings for this plug-in.
2866          */
2867         public static void initializeDefaultPluginPreferences() {
2868
2869                 Preferences preferences = PHPeclipsePlugin.getDefault()
2870                                 .getPluginPreferences();
2871                 HashSet optionNames = JavaModelManager.OptionNames;
2872
2873                 // Compiler settings
2874                 preferences.setDefault(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE);
2875                 optionNames.add(COMPILER_LOCAL_VARIABLE_ATTR);
2876
2877                 preferences.setDefault(COMPILER_LINE_NUMBER_ATTR, GENERATE);
2878                 optionNames.add(COMPILER_LINE_NUMBER_ATTR);
2879
2880                 preferences.setDefault(COMPILER_SOURCE_FILE_ATTR, GENERATE);
2881                 optionNames.add(COMPILER_SOURCE_FILE_ATTR);
2882
2883                 preferences.setDefault(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE);
2884                 optionNames.add(COMPILER_CODEGEN_UNUSED_LOCAL);
2885
2886                 preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1);
2887                 optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM);
2888
2889                 preferences.setDefault(COMPILER_PB_PHP_VAR_DEPRECATED, WARNING);
2890                 optionNames.add(COMPILER_PB_PHP_VAR_DEPRECATED);
2891
2892                 preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR);
2893                 optionNames.add(COMPILER_PB_UNREACHABLE_CODE);
2894
2895                 preferences.setDefault(COMPILER_PB_INVALID_IMPORT, ERROR);
2896                 optionNames.add(COMPILER_PB_INVALID_IMPORT);
2897
2898                 preferences.setDefault(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD,
2899                                 WARNING);
2900                 optionNames.add(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD);
2901
2902                 preferences.setDefault(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME,
2903                                 WARNING);
2904                 optionNames.add(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME);
2905
2906                 preferences.setDefault(COMPILER_PB_DEPRECATION, WARNING);
2907                 optionNames.add(COMPILER_PB_DEPRECATION);
2908
2909                 preferences.setDefault(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE,
2910                                 DISABLED);
2911                 optionNames.add(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE);
2912
2913                 preferences.setDefault(COMPILER_PB_HIDDEN_CATCH_BLOCK, WARNING);
2914                 optionNames.add(COMPILER_PB_HIDDEN_CATCH_BLOCK);
2915
2916                 preferences.setDefault(COMPILER_PB_UNUSED_LOCAL, IGNORE);
2917                 optionNames.add(COMPILER_PB_UNUSED_LOCAL);
2918
2919                 preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER, IGNORE);
2920                 optionNames.add(COMPILER_PB_UNUSED_PARAMETER);
2921
2922                 preferences.setDefault(
2923                                 COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT,
2924                                 DISABLED);
2925                 optionNames
2926                                 .add(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT);
2927
2928                 preferences
2929                                 .setDefault(
2930                                                 COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE,
2931                                                 DISABLED);
2932                 optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE);
2933
2934                 preferences.setDefault(COMPILER_PB_UNUSED_IMPORT, WARNING);
2935                 optionNames.add(COMPILER_PB_UNUSED_IMPORT);
2936
2937                 preferences.setDefault(COMPILER_PB_UNUSED_PRIVATE_MEMBER, IGNORE);
2938                 optionNames.add(COMPILER_PB_UNUSED_PRIVATE_MEMBER);
2939
2940                 preferences.setDefault(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION, IGNORE);
2941                 optionNames.add(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION);
2942
2943                 preferences.setDefault(COMPILER_PB_NON_NLS_STRING_LITERAL, IGNORE);
2944                 optionNames.add(COMPILER_PB_NON_NLS_STRING_LITERAL);
2945
2946                 preferences.setDefault(COMPILER_PB_ASSERT_IDENTIFIER, IGNORE);
2947                 optionNames.add(COMPILER_PB_ASSERT_IDENTIFIER);
2948
2949                 preferences.setDefault(COMPILER_PB_STATIC_ACCESS_RECEIVER, WARNING);
2950                 optionNames.add(COMPILER_PB_STATIC_ACCESS_RECEIVER);
2951
2952                 preferences.setDefault(COMPILER_PB_NO_EFFECT_ASSIGNMENT, WARNING);
2953                 optionNames.add(COMPILER_PB_NO_EFFECT_ASSIGNMENT);
2954
2955                 preferences.setDefault(
2956                                 COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD,
2957                                 WARNING);
2958                 optionNames
2959                                 .add(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD);
2960
2961                 preferences.setDefault(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION,
2962                                 WARNING);
2963                 optionNames.add(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION);
2964
2965                 preferences.setDefault(COMPILER_TASK_TAGS, DEFAULT_TASK_TAG); //$NON-NLS-1$
2966                 optionNames.add(COMPILER_TASK_TAGS);
2967
2968                 preferences.setDefault(COMPILER_TASK_PRIORITIES, DEFAULT_TASK_PRIORITY); //$NON-NLS-1$
2969                 optionNames.add(COMPILER_TASK_PRIORITIES);
2970
2971                 preferences.setDefault(COMPILER_SOURCE, VERSION_1_3);
2972                 optionNames.add(COMPILER_SOURCE);
2973
2974                 preferences.setDefault(COMPILER_COMPLIANCE, VERSION_1_3);
2975                 optionNames.add(COMPILER_COMPLIANCE);
2976
2977                 preferences.setDefault(COMPILER_PB_MAX_PER_UNIT, "100"); //$NON-NLS-1$
2978                 optionNames.add(COMPILER_PB_MAX_PER_UNIT);
2979
2980                 // Builder settings
2981                 preferences.setDefault(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$
2982                 optionNames.add(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER);
2983
2984                 preferences.setDefault(CORE_JAVA_BUILD_INVALID_CLASSPATH, ABORT);
2985                 optionNames.add(CORE_JAVA_BUILD_INVALID_CLASSPATH);
2986
2987                 preferences.setDefault(CORE_JAVA_BUILD_DUPLICATE_RESOURCE, WARNING);
2988                 optionNames.add(CORE_JAVA_BUILD_DUPLICATE_RESOURCE);
2989
2990                 preferences.setDefault(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, CLEAN);
2991                 optionNames.add(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER);
2992
2993                 // JavaCore settings
2994                 preferences.setDefault(CORE_JAVA_BUILD_ORDER, IGNORE);
2995                 optionNames.add(CORE_JAVA_BUILD_ORDER);
2996
2997                 preferences.setDefault(CORE_CIRCULAR_CLASSPATH, ERROR);
2998                 optionNames.add(CORE_CIRCULAR_CLASSPATH);
2999
3000                 preferences.setDefault(CORE_INCOMPLETE_CLASSPATH, ERROR);
3001                 optionNames.add(CORE_INCOMPLETE_CLASSPATH);
3002
3003                 preferences.setDefault(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS,
3004                                 ENABLED);
3005                 optionNames.add(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS);
3006
3007                 preferences.setDefault(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS,
3008                                 ENABLED);
3009                 optionNames.add(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS);
3010
3011                 // encoding setting comes from resource plug-in
3012                 optionNames.add(CORE_ENCODING);
3013
3014                 // Formatter settings
3015                 preferences.setDefault(FORMATTER_NEWLINE_OPENING_BRACE, DO_NOT_INSERT);
3016                 optionNames.add(FORMATTER_NEWLINE_OPENING_BRACE);
3017
3018                 preferences.setDefault(FORMATTER_NEWLINE_CONTROL, DO_NOT_INSERT);
3019                 optionNames.add(FORMATTER_NEWLINE_CONTROL);
3020
3021                 preferences.setDefault(FORMATTER_CLEAR_BLANK_LINES, PRESERVE_ONE);
3022                 optionNames.add(FORMATTER_CLEAR_BLANK_LINES);
3023
3024                 preferences.setDefault(FORMATTER_NEWLINE_ELSE_IF, DO_NOT_INSERT);
3025                 optionNames.add(FORMATTER_NEWLINE_ELSE_IF);
3026
3027                 preferences.setDefault(FORMATTER_NEWLINE_EMPTY_BLOCK, INSERT);
3028                 optionNames.add(FORMATTER_NEWLINE_EMPTY_BLOCK);
3029
3030                 preferences.setDefault(FORMATTER_LINE_SPLIT, "80"); //$NON-NLS-1$
3031                 optionNames.add(FORMATTER_LINE_SPLIT);
3032
3033                 preferences.setDefault(FORMATTER_COMPACT_ASSIGNMENT, NORMAL);
3034                 optionNames.add(FORMATTER_COMPACT_ASSIGNMENT);
3035
3036                 preferences.setDefault(FORMATTER_TAB_CHAR, TAB);
3037                 optionNames.add(FORMATTER_TAB_CHAR);
3038
3039                 preferences.setDefault(FORMATTER_TAB_SIZE, "4"); //$NON-NLS-1$ 
3040                 optionNames.add(FORMATTER_TAB_SIZE);
3041
3042                 preferences.setDefault(FORMATTER_SPACE_CASTEXPRESSION, INSERT); //$NON-NLS-1$ 
3043                 optionNames.add(FORMATTER_SPACE_CASTEXPRESSION);
3044
3045                 // CodeAssist settings
3046                 preferences.setDefault(CODEASSIST_VISIBILITY_CHECK, DISABLED); //$NON-NLS-1$
3047                 optionNames.add(CODEASSIST_VISIBILITY_CHECK);
3048
3049                 preferences.setDefault(CODEASSIST_IMPLICIT_QUALIFICATION, DISABLED); //$NON-NLS-1$
3050                 optionNames.add(CODEASSIST_IMPLICIT_QUALIFICATION);
3051
3052                 preferences.setDefault(CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$
3053                 optionNames.add(CODEASSIST_FIELD_PREFIXES);
3054
3055                 preferences.setDefault(CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$
3056                 optionNames.add(CODEASSIST_STATIC_FIELD_PREFIXES);
3057
3058                 preferences.setDefault(CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$
3059                 optionNames.add(CODEASSIST_LOCAL_PREFIXES);
3060
3061                 preferences.setDefault(CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$
3062                 optionNames.add(CODEASSIST_ARGUMENT_PREFIXES);
3063
3064                 preferences.setDefault(CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$
3065                 optionNames.add(CODEASSIST_FIELD_SUFFIXES);
3066
3067                 preferences.setDefault(CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$
3068                 optionNames.add(CODEASSIST_STATIC_FIELD_SUFFIXES);
3069
3070                 preferences.setDefault(CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$
3071                 optionNames.add(CODEASSIST_LOCAL_SUFFIXES);
3072
3073                 preferences.setDefault(CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$
3074                 optionNames.add(CODEASSIST_ARGUMENT_SUFFIXES);
3075         }
3076
3077         /**
3078          * Returns whether the given marker references the given Java element. Used
3079          * for markers, which denote a Java element rather than a resource.
3080          * 
3081          * @param element
3082          *            the element
3083          * @param marker
3084          *            the marker
3085          * @return <code>true</code> if the marker references the element, false
3086          *         otherwise
3087          * @exception CoreException
3088          *                if the <code>IMarker.getAttribute</code> on the marker
3089          *                fails
3090          */
3091         public static boolean isReferencedBy(IJavaElement element, IMarker marker)
3092                         throws CoreException {
3093
3094                 // only match units or classfiles
3095                 if (element instanceof IMember) {
3096                         IMember member = (IMember) element;
3097                         if (member.isBinary()) {
3098                                 element = null; //member.getClassFile();
3099                         } else {
3100                                 element = member.getCompilationUnit();
3101                         }
3102                 }
3103                 if (element == null)
3104                         return false;
3105                 if (marker == null)
3106                         return false;
3107
3108                 String markerHandleId = (String) marker.getAttribute(ATT_HANDLE_ID);
3109                 if (markerHandleId == null)
3110                         return false;
3111
3112                 IJavaElement markerElement = JavaCore.create(markerHandleId);
3113                 //      while (true){
3114                 if (element.equals(markerElement))
3115                         return true; // external elements may still be equal with different
3116                                                  // handleIDs.
3117
3118                 // cycle through enclosing types in case marker is associated with a
3119                 // classfile (15568)
3120                 //              if (markerElement instanceof IClassFile){
3121                 //                      IType enclosingType =
3122                 // ((IClassFile)markerElement).getType().getDeclaringType();
3123                 //                      if (enclosingType != null){
3124                 //                              markerElement = enclosingType.getClassFile(); // retry with immediate
3125                 // enclosing classfile
3126                 //                              continue;
3127                 //                      }
3128                 //              }
3129                 //              break;
3130                 //      }
3131                 return false;
3132         }
3133
3134         /**
3135          * Returns whether the given marker delta references the given Java element.
3136          * Used for markers deltas, which denote a Java element rather than a
3137          * resource.
3138          * 
3139          * @param element
3140          *            the element
3141          * @param markerDelta
3142          *            the marker delta
3143          * @return <code>true</code> if the marker delta references the element
3144          * @exception CoreException
3145          *                if the <code>IMarkerDelta.getAttribute</code> on the
3146          *                marker delta fails
3147          */
3148         public static boolean isReferencedBy(IJavaElement element,
3149                         IMarkerDelta markerDelta) throws CoreException {
3150
3151                 // only match units or classfiles
3152                 if (element instanceof IMember) {
3153                         IMember member = (IMember) element;
3154                         if (member.isBinary()) {
3155                                 element = null; //member.getClassFile();
3156                         } else {
3157                                 element = member.getCompilationUnit();
3158                         }
3159                 }
3160                 if (element == null)
3161                         return false;
3162                 if (markerDelta == null)
3163                         return false;
3164
3165                 String markerDeltarHandleId = (String) markerDelta
3166                                 .getAttribute(ATT_HANDLE_ID);
3167                 if (markerDeltarHandleId == null)
3168                         return false;
3169
3170                 IJavaElement markerElement = JavaCore.create(markerDeltarHandleId);
3171                 //      while (true){
3172                 if (element.equals(markerElement))
3173                         return true; // external elements may still be equal with different
3174                                                  // handleIDs.
3175
3176                 // cycle through enclosing types in case marker is associated with a
3177                 // classfile (15568)
3178                 //              if (markerElement instanceof IClassFile){
3179                 //                      IType enclosingType =
3180                 // ((IClassFile)markerElement).getType().getDeclaringType();
3181                 //                      if (enclosingType != null){
3182                 //                              markerElement = enclosingType.getClassFile(); // retry with immediate
3183                 // enclosing classfile
3184                 //                              continue;
3185                 //                      }
3186                 //              }
3187                 //              break;
3188                 //      }
3189                 return false;
3190         }
3191
3192         /**
3193          * Creates and returns a new classpath entry of kind
3194          * <code>CPE_CONTAINER</code> for the given path. The path of the
3195          * container will be used during resolution so as to map this container
3196          * entry to a set of other classpath entries the container is acting for.
3197          * <p>
3198          * A container entry allows to express indirect references to a set of
3199          * libraries, projects and variable entries, which can be interpreted
3200          * differently for each Java project where it is used. A classpath container
3201          * entry can be resolved using
3202          * <code>JavaCore.getResolvedClasspathContainer</code>, and updated with
3203          * <code>JavaCore.classpathContainerChanged</code>
3204          * <p>
3205          * A container is exclusively resolved by a
3206          * <code>ClasspathContainerInitializer</code> registered onto the
3207          * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
3208          * <p>
3209          * A container path must be formed of at least one segment, where:
3210          * <ul>
3211          * <li>the first segment is a unique ID identifying the target container,
3212          * there must be a container initializer registered onto this ID through the
3213          * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
3214          * </li>
3215          * <li>the remaining segments will be passed onto the initializer, and can
3216          * be used as additional hints during the initialization phase.</li>
3217          * </ul>
3218          * <p>
3219          * Example of an ClasspathContainerInitializer for a classpath container
3220          * denoting a default JDK container:
3221          * 
3222          * containerEntry = JavaCore.newContainerEntry(new
3223          * Path("MyProvidedJDK/default"));
3224          * 
3225          * <extension point="org.eclipse.jdt.core.classpathContainerInitializer">
3226          * <containerInitializer id="MyProvidedJDK"
3227          * class="com.example.MyInitializer"/>
3228          * <p>
3229          * Note that this operation does not attempt to validate classpath
3230          * containers or access the resources at the given paths.
3231          * <p>
3232          * The resulting entry is not exported to dependent projects. This method is
3233          * equivalent to <code>newContainerEntry(-,false)</code>.
3234          * <p>
3235          * 
3236          * @param containerPath
3237          *            the path identifying the container, it must be formed of two
3238          *            segments
3239          * @return a new container classpath entry
3240          * 
3241          * @see JavaCore#getClasspathContainer(IPath, IJavaProject)
3242          * @see JavaCore#newContainerEntry(IPath, boolean)
3243          * @since 2.0
3244          */
3245         public static IClasspathEntry newContainerEntry(IPath containerPath) {
3246
3247     return newContainerEntry(containerPath, false);
3248   }
3249
3250   /**
3251    * Creates and returns a new classpath entry of kind
3252    * <code>CPE_CONTAINER</code> for the given path. The path of the
3253    * container will be used during resolution so as to map this container
3254    * entry to a set of other classpath entries the container is acting for.
3255    * <p>
3256    * A container entry allows to express indirect references to a set of
3257    * libraries, projects and variable entries, which can be interpreted
3258    * differently for each Java project where it is used. A classpath container
3259    * entry can be resolved using
3260    * <code>JavaCore.getResolvedClasspathContainer</code>, and updated with
3261    * <code>JavaCore.classpathContainerChanged</code>
3262    * <p>
3263    * A container is exclusively resolved by a
3264    * <code>ClasspathContainerInitializer</code> registered onto the
3265    * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
3266    * <p>
3267    * A container path must be formed of at least one segment, where:
3268    * <ul>
3269    * <li>the first segment is a unique ID identifying the target container,
3270    * there must be a container initializer registered onto this ID through the
3271    * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
3272    * </li>
3273    * <li>the remaining segments will be passed onto the initializer, and can
3274    * be used as additional hints during the initialization phase.</li>
3275    * </ul>
3276    * <p>
3277    * Example of an ClasspathContainerInitializer for a classpath container
3278    * denoting a default JDK container:
3279    * 
3280    * containerEntry = JavaCore.newContainerEntry(new
3281    * Path("MyProvidedJDK/default"));
3282    * 
3283    * <extension point="org.eclipse.jdt.core.classpathContainerInitializer">
3284    * <containerInitializer id="MyProvidedJDK"
3285    * class="com.example.MyInitializer"/>
3286    * <p>
3287    * Note that this operation does not attempt to validate classpath
3288    * containers or access the resources at the given paths.
3289    * <p>
3290    * 
3291    * @param containerPath
3292    *            the path identifying the container, it must be formed of at
3293    *            least one segment (ID+hints)
3294    * @param isExported
3295    *            a boolean indicating whether this entry is contributed to
3296    *            dependent projects in addition to the output location
3297    * @return a new container classpath entry
3298    * 
3299    * @see JavaCore#getClasspathContainer(IPath, IJavaProject)
3300    * @see JavaCore#setClasspathContainer(IPath, IJavaProject[],
3301    *      IClasspathContainer[], IProgressMonitor)
3302    * @see JavaCore#newContainerEntry(IPath, boolean)
3303    * @since 2.0
3304    */
3305   public static IClasspathEntry newContainerEntry(IPath containerPath,
3306       boolean isExported) {
3307
3308     if (containerPath == null || containerPath.segmentCount() < 1) {
3309       Assert
3310           .isTrue(
3311               false,
3312               "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$
3313     }
3314     return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE,
3315         IClasspathEntry.CPE_CONTAINER, containerPath,
3316         ClasspathEntry.NO_EXCLUSION_PATTERNS, null, // source attachment
3317         null, // source attachment root
3318         null, // specific output folder
3319         isExported);
3320   }
3321
3322   /**
3323    * Creates and returns a new non-exported classpath entry of kind
3324    * <code>CPE_LIBRARY</code> for the JAR or folder identified by the given
3325    * absolute path. This specifies that all package fragments within the root
3326    * will have children of type <code>IClassFile</code>.
3327    * <p>
3328    * A library entry is used to denote a prerequisite JAR or root folder
3329    * containing binaries. The target JAR or folder can either be defined
3330    * internally to the workspace (absolute path relative to the workspace
3331    * root) or externally to the workspace (absolute path in the file system).
3332    * <p>
3333    * e.g. Here are some examples of binary path usage
3334    * <ul>
3335    * <li><code> "c:/jdk1.2.2/jre/lib/rt.jar" </code>- reference to an
3336    * external JAR</li>
3337    * <li><code> "/Project/someLib.jar" </code>- reference to an internal JAR
3338    * </li>
3339    * <li><code> "c:/classes/" </code>- reference to an external binary
3340    * folder</li>
3341    * </ul>
3342    * Note that this operation does not attempt to validate or access the
3343    * resources at the given paths.
3344    * <p>
3345    * The resulting entry is not exported to dependent projects. This method is
3346    * equivalent to <code>newLibraryEntry(-,-,-,false)</code>.
3347    * <p>
3348    * 
3349    * @param path
3350    *            the absolute path of the binary archive
3351    * @param sourceAttachmentPath
3352    *            the absolute path of the corresponding source archive or
3353    *            folder, or <code>null</code> if none
3354    * @param sourceAttachmentRootPath
3355    *            the location of the root within the source archive or folder
3356    *            or <code>null</code> if this location should be
3357    *            automatically detected.
3358    * @return a new library classpath entry
3359    * 
3360    * @see #newLibraryEntry(IPath, IPath, IPath, boolean)
3361    */
3362   //public static IClasspathEntry newLibraryEntry(
3363   //    IPath path,
3364   //    IPath sourceAttachmentPath,
3365   //    IPath sourceAttachmentRootPath) {
3366   //                    
3367   //    return newLibraryEntry(path, sourceAttachmentPath,
3368   // sourceAttachmentRootPath, false);
3369   //}
3370   /**
3371    * Creates and returns a new classpath entry of kind
3372    * <code>CPE_LIBRARY</code> for the JAR or folder identified by the given
3373    * absolute path. This specifies that all package fragments within the root
3374    * will have children of type <code>IClassFile</code>.
3375    * <p>
3376    * A library entry is used to denote a prerequisite JAR or root folder
3377    * containing binaries. The target JAR or folder can either be defined
3378    * internally to the workspace (absolute path relative to the workspace
3379    * root) or externally to the workspace (absolute path in the file system).
3380    * <p>
3381    * e.g. Here are some examples of binary path usage
3382    * <ul>
3383    * <li><code> "c:/jdk1.2.2/jre/lib/rt.jar" </code>- reference to an
3384    * external JAR</li>
3385    * <li><code> "/Project/someLib.jar" </code>- reference to an internal JAR
3386    * </li>
3387    * <li><code> "c:/classes/" </code>- reference to an external binary
3388    * folder</li>
3389    * </ul>
3390    * Note that this operation does not attempt to validate or access the
3391    * resources at the given paths.
3392    * <p>
3393    * 
3394    * @param path
3395    *            the absolute path of the binary archive
3396    * @param sourceAttachmentPath
3397    *            the absolute path of the corresponding source archive or
3398    *            folder, or <code>null</code> if none
3399    * @param sourceAttachmentRootPath
3400    *            the location of the root within the source archive or folder
3401    *            or <code>null</code> if this location should be
3402    *            automatically detected.
3403    * @param isExported
3404    *            indicates whether this entry is contributed to dependent
3405    *            projects in addition to the output location
3406    * @return a new library classpath entry
3407    * @since 2.0
3408    */
3409   //public static IClasspathEntry newLibraryEntry(
3410   //    IPath path,
3411   //    IPath sourceAttachmentPath,
3412   //    IPath sourceAttachmentRootPath,
3413   //    boolean isExported) {
3414   //                    
3415   //    if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry
3416   // must be absolute"); //$NON-NLS-1$
3417   //
3418   //    return new ClasspathEntry(
3419   //            IPackageFragmentRoot.K_BINARY,
3420   //            IClasspathEntry.CPE_LIBRARY,
3421   //            JavaProject.canonicalizedPath(path),
3422   //            ClasspathEntry.NO_EXCLUSION_PATTERNS,
3423   //            sourceAttachmentPath,
3424   //            sourceAttachmentRootPath,
3425   //            null, // specific output folder
3426   //            isExported);
3427   //}
3428   /**
3429    * Creates and returns a new non-exported classpath entry of kind
3430    * <code>CPE_PROJECT</code> for the project identified by the given
3431    * absolute path.
3432    * <p>
3433    * A project entry is used to denote a prerequisite project on a classpath.
3434    * The referenced project will be contributed as a whole, either as sources
3435    * (in the Java Model, it contributes all its package fragment roots) or as
3436    * binaries (when building, it contributes its whole output location).
3437    * <p>
3438    * A project reference allows to indirect through another project,
3439    * independently from its internal layout.
3440    * <p>
3441    * The prerequisite project is referred to using an absolute path relative
3442    * to the workspace root.
3443    * <p>
3444    * The resulting entry is not exported to dependent projects. This method is
3445    * equivalent to <code>newProjectEntry(_,false)</code>.
3446    * <p>
3447    * 
3448    * @param path
3449    *            the absolute path of the binary archive
3450    * @return a new project classpath entry
3451    * 
3452    * @see JavaCore#newProjectEntry(IPath, boolean)
3453    */
3454   public static IClasspathEntry newProjectEntry(IPath path) {
3455     return newProjectEntry(path, false);
3456   }
3457
3458   /**
3459    * Creates and returns a new classpath entry of kind
3460    * <code>CPE_PROJECT</code> for the project identified by the given
3461    * absolute path.
3462    * <p>
3463    * A project entry is used to denote a prerequisite project on a classpath.
3464    * The referenced project will be contributed as a whole, either as sources
3465    * (in the Java Model, it contributes all its package fragment roots) or as
3466    * binaries (when building, it contributes its whole output location).
3467    * <p>
3468    * A project reference allows to indirect through another project,
3469    * independently from its internal layout.
3470    * <p>
3471    * The prerequisite project is referred to using an absolute path relative
3472    * to the workspace root.
3473    * <p>
3474    * 
3475    * @param path
3476    *            the absolute path of the prerequisite project
3477    * @param isExported
3478    *            indicates whether this entry is contributed to dependent
3479    *            projects in addition to the output location
3480    * @return a new project classpath entry
3481    * @since 2.0
3482    */
3483   public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) {
3484
3485     if (!path.isAbsolute())
3486       Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
3487
3488     return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE,
3489         IClasspathEntry.CPE_PROJECT, path,
3490         ClasspathEntry.NO_EXCLUSION_PATTERNS, null, // source attachment
3491         null, // source attachment root
3492         null, // specific output folder
3493         isExported);
3494   }
3495
3496   /**
3497    * Returns a new empty region.
3498    * 
3499    * @return a new empty region
3500    */
3501   public static IRegion newRegion() {
3502     return new Region();
3503   }
3504
3505   /**
3506    * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
3507    * for the project's source folder identified by the given absolute
3508    * workspace-relative path. This specifies that all package fragments within
3509    * the root will have children of type <code>ICompilationUnit</code>.
3510    * <p>
3511    * The source folder is referred to using an absolute path relative to the
3512    * workspace root, e.g. <code>/Project/src</code>. A project's source
3513    * folders are located with that project. That is, a source classpath entry
3514    * specifying the path <code>/P1/src</code> is only usable for project
3515    * <code>P1</code>.
3516    * </p>
3517    * <p>
3518    * The source classpath entry created by this method includes all source
3519    * files below the given workspace-relative path. To selectively exclude
3520    * some of these source files, use the factory method
3521    * <code>JavaCore.newSourceEntry(IPath,IPath[])</code> instead.
3522    * </p>
3523    * <p>
3524    * Note that all sources/binaries inside a project are contributed as a
3525    * whole through a project entry (see <code>JavaCore.newProjectEntry</code>).
3526    * Particular source entries cannot be selectively exported.
3527    * </p>
3528    * 
3529    * @param path
3530    *            the absolute workspace-relative path of a source folder
3531    * @return a new source classpath entry with not exclusion patterns
3532    * 
3533    * @see #newSourceEntry(org.eclipse.core.runtime.IPath,org.eclipse.core.runtime.IPath[])
3534    */
3535   public static IClasspathEntry newSourceEntry(IPath path) {
3536
3537     return newSourceEntry(path, ClasspathEntry.NO_EXCLUSION_PATTERNS, null /*
3538      * output
3539      * location
3540      */);
3541   }
3542
3543   /**
3544    * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
3545    * for the project's source folder identified by the given absolute
3546    * workspace-relative path but excluding all source files with paths
3547    * matching any of the given patterns. This specifies that all package
3548    * fragments within the root will have children of type
3549    * <code>ICompilationUnit</code>.
3550    * <p>
3551    * The source folder is referred to using an absolute path relative to the
3552    * workspace root, e.g. <code>/Project/src</code>. A project's source
3553    * folders are located with that project. That is, a source classpath entry
3554    * specifying the path <code>/P1/src</code> is only usable for project
3555    * <code>P1</code>.
3556    * </p>
3557    * <p>
3558    * The source classpath entry created by this method includes all source
3559    * files below the given workspace-relative path except for those matched by
3560    * one (or more) of the given exclusion patterns. Each exclusion pattern is
3561    * represented by a relative path, which is interpreted as relative to the
3562    * source folder. For example, if the source folder path is
3563    * <code>/Project/src</code> and the exclusion pattern is
3564    * <code>com/xyz/tests/&#42;&#42;</code>, then source files like
3565    * <code>/Project/src/com/xyz/Foo.java</code> and
3566    * <code>/Project/src/com/xyz/utils/Bar.java</code> would be included,
3567    * whereas <code>/Project/src/com/xyz/tests/T1.java</code> and
3568    * <code>/Project/src/com/xyz/tests/quick/T2.java</code> would be
3569    * excluded. Exclusion patterns can contain can contain '**', '*' or '?'
3570    * wildcards; see <code>IClasspathEntry.getExclusionPatterns</code> for
3571    * the full description of the syntax and semantics of exclusion patterns.
3572    * </p>
3573    * If the empty list of exclusion patterns is specified, the source folder
3574    * will automatically include all resources located inside the source
3575    * folder. In that case, the result is entirely equivalent to using the
3576    * factory method <code>JavaCore.newSourceEntry(IPath)</code>.
3577    * </p>
3578    * <p>
3579    * Note that all sources/binaries inside a project are contributed as a
3580    * whole through a project entry (see <code>JavaCore.newProjectEntry</code>).
3581    * Particular source entries cannot be selectively exported.
3582    * </p>
3583    * 
3584    * @param path
3585    *            the absolute workspace-relative path of a source folder
3586    * @param exclusionPatterns
3587    *            the possibly empty list of exclusion patterns represented as
3588    *            relative paths
3589    * @return a new source classpath entry with the given exclusion patterns
3590    * @see #newSourceEntry(org.eclipse.core.runtime.IPath)
3591    * @see IClasspathEntry#getExclusionPatterns
3592    * 
3593    * @since 2.1
3594    */
3595   public static IClasspathEntry newSourceEntry(IPath path,
3596       IPath[] exclusionPatterns) {
3597
3598     return newSourceEntry(path, exclusionPatterns, null /* output location */);
3599   }
3600
3601   /**
3602    * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
3603    * for the project's source folder identified by the given absolute
3604    * workspace-relative path but excluding all source files with paths
3605    * matching any of the given patterns, and associated with a specific output
3606    * location (that is, ".class" files are not going to the project default
3607    * output location). All package fragments within the root will have
3608    * children of type <code>ICompilationUnit</code>.
3609    * <p>
3610    * The source folder is referred to using an absolute path relative to the
3611    * workspace root, e.g. <code>/Project/src</code>. A project's source
3612    * folders are located with that project. That is, a source classpath entry
3613    * specifying the path <code>/P1/src</code> is only usable for project
3614    * <code>P1</code>.
3615    * </p>
3616    * <p>
3617    * The source classpath entry created by this method includes all source
3618    * files below the given workspace-relative path except for those matched by
3619    * one (or more) of the given exclusion patterns. Each exclusion pattern is
3620    * represented by a relative path, which is interpreted as relative to the
3621    * source folder. For example, if the source folder path is
3622    * <code>/Project/src</code> and the exclusion pattern is
3623    * <code>com/xyz/tests/&#42;&#42;</code>, then source files like
3624    * <code>/Project/src/com/xyz/Foo.java</code> and
3625    * <code>/Project/src/com/xyz/utils/Bar.java</code> would be included,
3626    * whereas <code>/Project/src/com/xyz/tests/T1.java</code> and
3627    * <code>/Project/src/com/xyz/tests/quick/T2.java</code> would be
3628    * excluded. Exclusion patterns can contain can contain '**', '*' or '?'
3629    * wildcards; see <code>IClasspathEntry.getExclusionPatterns</code> for
3630    * the full description of the syntax and semantics of exclusion patterns.
3631    * </p>
3632    * If the empty list of exclusion patterns is specified, the source folder
3633    * will automatically include all resources located inside the source
3634    * folder. In that case, the result is entirely equivalent to using the
3635    * factory method <code>JavaCore.newSourceEntry(IPath)</code>.
3636    * </p>
3637    * <p>
3638    * Additionally, a source entry can be associated with a specific output
3639    * location. By doing so, the Java builder will ensure that the generated
3640    * ".class" files will be issued inside this output location, as opposed to
3641    * be generated into the project default output location (when output
3642    * location is <code>null</code>). Note that multiple source entries may
3643    * target the same output location. The output location is referred to using
3644    * an absolute path relative to the workspace root, e.g.
3645    * <code>"/Project/bin"</code>, it must be located inside the same
3646    * project as the source folder.
3647    * </p>
3648    * <p>
3649    * Also note that all sources/binaries inside a project are contributed as a
3650    * whole through a project entry (see <code>JavaCore.newProjectEntry</code>).
3651    * Particular source entries cannot be selectively exported.
3652    * </p>
3653    * 
3654    * @param path
3655    *            the absolute workspace-relative path of a source folder
3656    * @param exclusionPatterns
3657    *            the possibly empty list of exclusion patterns represented as
3658    *            relative paths
3659    * @param outputLocation
3660    *            the specific output location for this source entry (
3661    *            <code>null</code> if using project default ouput location)
3662    * @return a new source classpath entry with the given exclusion patterns
3663    * @see #newSourceEntry(org.eclipse.core.runtime.IPath)
3664    * @see IClasspathEntry#getExclusionPatterns
3665    * @see IClasspathEntry#getOutputLocation()
3666    * 
3667    * @since 2.1
3668    */
3669   public static IClasspathEntry newSourceEntry(IPath path,
3670       IPath[] exclusionPatterns, IPath specificOutputLocation) {
3671
3672     if (!path.isAbsolute())
3673       Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
3674     if (exclusionPatterns == null)
3675       Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$
3676
3677     return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE,
3678         IClasspathEntry.CPE_SOURCE, path, exclusionPatterns, null, // source
3679         // attachment
3680         null, // source attachment root
3681         specificOutputLocation, // custom output location
3682         false);
3683   }
3684
3685   /**
3686    * Creates and returns a new non-exported classpath entry of kind
3687    * <code>CPE_VARIABLE</code> for the given path. The first segment of the
3688    * path is the name of a classpath variable. The trailing segments of the
3689    * path will be appended to resolved variable path.
3690    * <p>
3691    * A variable entry allows to express indirect references on a classpath to
3692    * other projects or libraries, depending on what the classpath variable is
3693    * referring.
3694    * <p>
3695    * It is possible to register an automatic initializer (
3696    * <code>ClasspathVariableInitializer</code>), which will be invoked
3697    * through the extension point
3698    * "org.eclipse.jdt.core.classpathVariableInitializer". After resolution, a
3699    * classpath variable entry may either correspond to a project or a library
3700    * entry.</li>
3701    * <p>
3702    * e.g. Here are some examples of variable path usage
3703    * <ul>
3704    * <li>"JDTCORE" where variable <code>JDTCORE</code> is bound to
3705    * "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the
3706    * library "c:\jars\jdtcore.jar"</li>
3707    * <li>"JDTCORE" where variable <code>JDTCORE</code> is bound to
3708    * "/Project_JDTCORE". The resolved classpath entry is denoting the project
3709    * "/Project_JDTCORE"</li>
3710    * <li>"PLUGINS/com.example/example.jar" where variable
3711    * <code>PLUGINS</code> is bound to "c:/eclipse/plugins". The resolved
3712    * classpath entry is denoting the library
3713    * "c:/eclipse/plugins/com.example/example.jar"</li>
3714    * </ul>
3715    * Note that this operation does not attempt to validate classpath variables
3716    * or access the resources at the given paths.
3717    * <p>
3718    * The resulting entry is not exported to dependent projects. This method is
3719    * equivalent to <code>newVariableEntry(-,-,-,false)</code>.
3720    * <p>
3721    * 
3722    * @param variablePath
3723    *            the path of the binary archive; first segment is the name of a
3724    *            classpath variable
3725    * @param variableSourceAttachmentPath
3726    *            the path of the corresponding source archive, or
3727    *            <code>null</code> if none; if present, the first segment is
3728    *            the name of a classpath variable (not necessarily the same
3729    *            variable as the one that begins <code>variablePath</code>)
3730    * @param sourceAttachmentRootPath
3731    *            the location of the root within the source archive or
3732    *            <code>null</code> if <code>archivePath</code> is also
3733    *            <code>null</code>
3734    * @return a new library classpath entry
3735    * 
3736    * @see JavaCore#newVariableEntry(IPath, IPath, IPath, boolean)
3737    */
3738   //public static IClasspathEntry newVariableEntry(
3739   //    IPath variablePath,
3740   //    IPath variableSourceAttachmentPath,
3741   //    IPath sourceAttachmentRootPath) {
3742   //
3743   //    return newVariableEntry(variablePath, variableSourceAttachmentPath,
3744   // sourceAttachmentRootPath, false);
3745   //}
3746   /**
3747    * Creates and returns a new non-exported classpath entry of kind
3748    * <code>CPE_VARIABLE</code> for the given path. The first segment of the
3749    * path is the name of a classpath variable. The trailing segments of the
3750    * path will be appended to resolved variable path.
3751    * <p>
3752    * A variable entry allows to express indirect references on a classpath to
3753    * other projects or libraries, depending on what the classpath variable is
3754    * referring.
3755    * <p>
3756    * It is possible to register an automatic initializer (
3757    * <code>ClasspathVariableInitializer</code>), which will be invoked
3758    * through the extension point
3759    * "org.eclipse.jdt.core.classpathVariableInitializer". After resolution, a
3760    * classpath variable entry may either correspond to a project or a library
3761    * entry.</li>
3762    * <p>
3763    * e.g. Here are some examples of variable path usage
3764    * <ul>
3765    * <li>"JDTCORE" where variable <code>JDTCORE</code> is bound to
3766    * "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the
3767    * library "c:\jars\jdtcore.jar"</li>
3768    * <li>"JDTCORE" where variable <code>JDTCORE</code> is bound to
3769    * "/Project_JDTCORE". The resolved classpath entry is denoting the project
3770    * "/Project_JDTCORE"</li>
3771    * <li>"PLUGINS/com.example/example.jar" where variable
3772    * <code>PLUGINS</code> is bound to "c:/eclipse/plugins". The resolved
3773    * classpath entry is denoting the library
3774    * "c:/eclipse/plugins/com.example/example.jar"</li>
3775    * </ul>
3776    * Note that this operation does not attempt to validate classpath variables
3777    * or access the resources at the given paths.
3778    * <p>
3779    * 
3780    * @param variablePath
3781    *            the path of the binary archive; first segment is the name of a
3782    *            classpath variable
3783    * @param variableSourceAttachmentPath
3784    *            the path of the corresponding source archive, or
3785    *            <code>null</code> if none; if present, the first segment is
3786    *            the name of a classpath variable (not necessarily the same
3787    *            variable as the one that begins <code>variablePath</code>)
3788    * @param sourceAttachmentRootPath
3789    *            the location of the root within the source archive or
3790    *            <code>null</code> if <code>archivePath</code> is also
3791    *            <code>null</code>
3792    * @param isExported
3793    *            indicates whether this entry is contributed to dependent
3794    *            projects in addition to the output location
3795    * @return a new variable classpath entry
3796    * @since 2.0
3797    */
3798   //public static IClasspathEntry newVariableEntry(
3799   //    IPath variablePath,
3800   //    IPath variableSourceAttachmentPath,
3801   //    IPath variableSourceAttachmentRootPath,
3802   //    boolean isExported) {
3803   //                    
3804   //    if (variablePath == null || variablePath.segmentCount() < 1) {
3805   //            Assert.isTrue(
3806   //                    false,
3807   //                    "Illegal classpath variable path: \'" +
3808   // variablePath.makeRelative().toString() + "\', must have at least one
3809   // segment"); //$NON-NLS-1$//$NON-NLS-2$
3810   //    }
3811   //    
3812   //    return new ClasspathEntry(
3813   //            IPackageFragmentRoot.K_SOURCE,
3814   //            IClasspathEntry.CPE_VARIABLE,
3815   //            variablePath,
3816   //            ClasspathEntry.NO_EXCLUSION_PATTERNS,
3817   //            variableSourceAttachmentPath, // source attachment
3818   //            variableSourceAttachmentRootPath, // source attachment root
3819   //            null, // specific output folder
3820   //            isExported);
3821   //}
3822   /**
3823    * Removed the given classpath variable. Does nothing if no value was set
3824    * for this classpath variable.
3825    * <p>
3826    * This functionality cannot be used while the resource tree is locked.
3827    * <p>
3828    * Classpath variable values are persisted locally to the workspace, and are
3829    * preserved from session to session.
3830    * <p>
3831    * 
3832    * @param variableName
3833    *            the name of the classpath variable
3834    * @see #setClasspathVariable
3835    * 
3836    * @deprecated - use version with extra IProgressMonitor
3837    */
3838   //public static void removeClasspathVariable(String variableName) {
3839   //    removeClasspathVariable(variableName, null);
3840   //}
3841   /**
3842    * Removed the given classpath variable. Does nothing if no value was set
3843    * for this classpath variable.
3844    * <p>
3845    * This functionality cannot be used while the resource tree is locked.
3846    * <p>
3847    * Classpath variable values are persisted locally to the workspace, and are
3848    * preserved from session to session.
3849    * <p>
3850    * 
3851    * @param variableName
3852    *            the name of the classpath variable
3853    * @param monitor
3854    *            the progress monitor to report progress
3855    * @see #setClasspathVariable
3856    */
3857   //public static void removeClasspathVariable(
3858   //    String variableName,
3859   //    IProgressMonitor monitor) {
3860   //
3861   //    try {
3862   //            updateVariableValues(new String[]{ variableName}, new IPath[]{ null },
3863   // monitor);
3864   //    } catch (JavaModelException e) {
3865   //    }
3866   //}
3867   /**
3868    * Removes the given element changed listener. Has no affect if an identical
3869    * listener is not registered.
3870    * 
3871    * @param listener
3872    *            the listener
3873    */
3874   public static void removeElementChangedListener(
3875       IElementChangedListener listener) {
3876     JavaModelManager.getJavaModelManager().removeElementChangedListener(
3877         listener);
3878   }
3879
3880   /**
3881    * Bind a container reference path to some actual containers (
3882    * <code>IClasspathContainer</code>). This API must be invoked whenever
3883    * changes in container need to be reflected onto the JavaModel. Containers
3884    * can have distinct values in different projects, therefore this API
3885    * considers a set of projects with their respective containers.
3886    * <p>
3887    * <code>containerPath</code> is the path under which these values can be
3888    * referenced through container classpath entries (
3889    * <code>IClasspathEntry#CPE_CONTAINER</code>). A container path is
3890    * formed by a first ID segment followed with extra segments, which can be
3891    * used as additional hints for the resolution. The container ID is used to
3892    * identify a <code>ClasspathContainerInitializer</code> registered on the
3893    * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
3894    * <p>
3895    * There is no assumption that each individual container value passed in
3896    * argument (<code>respectiveContainers</code>) must answer the exact
3897    * same path when requested <code>IClasspathContainer#getPath</code>.
3898    * Indeed, the containerPath is just an indication for resolving it to an
3899    * actual container object. It can be delegated to a
3900    * <code>ClasspathContainerInitializer</code>, which can be activated
3901    * through the extension point
3902    * "org.eclipse.jdt.core.ClasspathContainerInitializer").
3903    * <p>
3904    * In reaction to changing container values, the JavaModel will be updated
3905    * to reflect the new state of the updated container.
3906    * <p>
3907    * This functionality cannot be used while the resource tree is locked.
3908    * <p>
3909    * Classpath container values are persisted locally to the workspace, but
3910    * are not preserved from a session to another. It is thus highly
3911    * recommended to register a <code>ClasspathContainerInitializer</code>
3912    * for each referenced container (through the extension point
3913    * "org.eclipse.jdt.core.ClasspathContainerInitializer").
3914    * <p>
3915    * Note: setting a container to <code>null</code> will cause it to be
3916    * lazily resolved again whenever its value is required. In particular, this
3917    * will cause a registered initializer to be invoked again.
3918    * <p>
3919    * 
3920    * @param containerPath -
3921    *            the name of the container reference, which is being updated
3922    * @param affectedProjects -
3923    *            the set of projects for which this container is being bound
3924    * @param respectiveContainers -
3925    *            the set of respective containers for the affected projects
3926    * @param monitor
3927    *            a monitor to report progress
3928    * 
3929    * @see ClasspathContainerInitializer
3930    * @see #getClasspathContainer(IPath, IJavaProject)
3931    * @see IClasspathContainer
3932    * @since 2.0
3933    */
3934   //public static void setClasspathContainer(final IPath containerPath,
3935   // IJavaProject[] affectedProjects, IClasspathContainer[]
3936   // respectiveContainers, IProgressMonitor monitor) throws JavaModelException
3937   // {
3938   //
3939   //    if (affectedProjects.length != respectiveContainers.length)
3940   // Assert.isTrue(false, "Projects and containers collections should have the
3941   // same size"); //$NON-NLS-1$
3942   //    
3943   //    if (monitor != null && monitor.isCanceled()) return;
3944   //    
3945   //    if (JavaModelManager.CP_RESOLVE_VERBOSE){
3946   //            System.out.println("CPContainer SET - setting container:
3947   // ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$
3948   //                    + (Util.toString(affectedProjects,
3949   //                                    new Util.Displayable(){
3950   //                                            public String displayString(Object o) { return ((IJavaProject)
3951   // o).getElementName(); }
3952   //                                    }))
3953   //                    + "} with values: " //$NON-NLS-1$
3954   //                    + (Util.toString(respectiveContainers,
3955   //                                    new Util.Displayable(){
3956   //                                            public String displayString(Object o) { return ((IClasspathContainer)
3957   // o).getDescription(); }
3958   //                                    }))
3959   //                            );
3960   //    }
3961   //
3962   //    final int projectLength = affectedProjects.length;
3963   //    final IJavaProject[] modifiedProjects;
3964   //    System.arraycopy(affectedProjects, 0, modifiedProjects = new
3965   // IJavaProject[projectLength], 0, projectLength);
3966   //    final IClasspathEntry[][] oldResolvedPaths = new
3967   // IClasspathEntry[projectLength][];
3968   //                    
3969   //    // filter out unmodified project containers
3970   //    int remaining = 0;
3971   //    for (int i = 0; i < projectLength; i++){
3972   //    
3973   //            if (monitor != null && monitor.isCanceled()) return;
3974   //    
3975   //            IJavaProject affectedProject = affectedProjects[i];
3976   //            IClasspathContainer newContainer = respectiveContainers[i];
3977   //            if (newContainer == null) newContainer =
3978   // JavaModelManager.ContainerInitializationInProgress; // 30920 - prevent
3979   // infinite loop
3980   //            boolean found = false;
3981   //            if (JavaProject.hasJavaNature(affectedProject.getProject())){
3982   //                    IClasspathEntry[] rawClasspath = affectedProject.getRawClasspath();
3983   //                    for (int j = 0, cpLength = rawClasspath.length; j <cpLength; j++) {
3984   //                            IClasspathEntry entry = rawClasspath[j];
3985   //                            if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER &&
3986   // entry.getPath().equals(containerPath)){
3987   //                                    found = true;
3988   //                                    break;
3989   //                            }
3990   //                    }
3991   //            }
3992   //            if (!found){
3993   //                    modifiedProjects[i] = null; // filter out this project - does not
3994   // reference the container path, or isnt't yet Java project
3995   //                    JavaModelManager.containerPut(affectedProject, containerPath,
3996   // newContainer);
3997   //                    continue;
3998   //            }
3999   //            IClasspathContainer oldContainer =
4000   // JavaModelManager.containerGet(affectedProject, containerPath);
4001   //            if (oldContainer == JavaModelManager.ContainerInitializationInProgress) {
4002   //                    Map previousContainerValues =
4003   // (Map)JavaModelManager.PreviousSessionContainers.get(affectedProject);
4004   //                    if (previousContainerValues != null){
4005   //                            IClasspathContainer previousContainer =
4006   // (IClasspathContainer)previousContainerValues.get(containerPath);
4007   //                            if (previousContainer != null) {
4008   //                                    if (JavaModelManager.CP_RESOLVE_VERBOSE){
4009   //                                            System.out.println("CPContainer INIT - reentering access to project
4010   // container: ["+affectedProject.getElementName()+"] " + containerPath + "
4011   // during its initialization, will see previous value: "+
4012   // previousContainer.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
4013   // //$NON-NLS-3$
4014   //                                    }
4015   //                                    JavaModelManager.containerPut(affectedProject, containerPath,
4016   // previousContainer);
4017   //                            }
4018   //                            oldContainer = null; //33695 - cannot filter out restored container, must
4019   // update affected project to reset cached CP
4020   //                    } else {
4021   //                            oldContainer = null;
4022   //                    }
4023   //            }
4024   //            if (oldContainer != null &&
4025   // oldContainer.equals(respectiveContainers[i])){// TODO: could improve to
4026   // only compare entries
4027   //                    modifiedProjects[i] = null; // filter out this project - container did
4028   // not change
4029   //                    continue;
4030   //            }
4031   //            remaining++;
4032   //            oldResolvedPaths[i] = affectedProject.getResolvedClasspath(true);
4033   //            JavaModelManager.containerPut(affectedProject, containerPath,
4034   // newContainer);
4035   //    }
4036   //            
4037   //    if (remaining == 0) return;
4038   //            
4039   //    // trigger model refresh
4040   //    try {
4041   //            JavaCore.run(new IWorkspaceRunnable() {
4042   //                    public void run(IProgressMonitor monitor) throws CoreException {
4043   //                            for(int i = 0; i < projectLength; i++){
4044   //            
4045   //                                    if (monitor != null && monitor.isCanceled()) return;
4046   //            
4047   //                                    JavaProject affectedProject = (JavaProject)modifiedProjects[i];
4048   //                                    if (affectedProject == null) continue; // was filtered out
4049   //                                            
4050   //                                    if (JavaModelManager.CP_RESOLVE_VERBOSE){
4051   //                                            System.out.println("CPContainer SET - updating affected project:
4052   // ["+affectedProject.getElementName()+"] due to setting container: " +
4053   // containerPath); //$NON-NLS-1$ //$NON-NLS-2$
4054   //                                    }
4055   //
4056   //                                    // force a refresh of the affected project (will compute deltas)
4057   //                                    affectedProject.setRawClasspath(
4058   //                                                    affectedProject.getRawClasspath(),
4059   //                                                    SetClasspathOperation.ReuseOutputLocation,
4060   //                                                    monitor,
4061   //                                                    !ResourcesPlugin.getWorkspace().isTreeLocked(), // can save resources
4062   //                                                    oldResolvedPaths[i],
4063   //                                                    false, // updating - no validation
4064   //                                                    false); // updating - no need to save
4065   //                            }
4066   //                    }
4067   //            },
4068   //            monitor);
4069   //    } catch(CoreException e) {
4070   //            if (JavaModelManager.CP_RESOLVE_VERBOSE){
4071   //                    System.out.println("CPContainer SET - FAILED DUE TO EXCEPTION:
4072   // "+containerPath); //$NON-NLS-1$
4073   //                    e.printStackTrace();
4074   //            }
4075   //            if (e instanceof JavaModelException) {
4076   //                    throw (JavaModelException)e;
4077   //            } else {
4078   //                    throw new JavaModelException(e);
4079   //            }
4080   //    } finally {
4081   //            for (int i = 0; i < projectLength; i++) {
4082   //                    if (respectiveContainers[i] == null) {
4083   //                            JavaModelManager.containerPut(affectedProjects[i], containerPath, null);
4084   // // reset init in progress marker
4085   //                    }
4086   //            }
4087   //    }
4088   //                                    
4089   //}
4090   /**
4091    * Sets the value of the given classpath variable. The path must have at
4092    * least one segment.
4093    * <p>
4094    * This functionality cannot be used while the resource tree is locked.
4095    * <p>
4096    * Classpath variable values are persisted locally to the workspace, and are
4097    * preserved from session to session.
4098    * <p>
4099    * 
4100    * @param variableName
4101    *            the name of the classpath variable
4102    * @param path
4103    *            the path
4104    * @see #getClasspathVariable
4105    * 
4106    * @deprecated - use API with IProgressMonitor
4107    */
4108   //public static void setClasspathVariable(String variableName, IPath path)
4109   //    throws JavaModelException {
4110   //
4111   //    setClasspathVariable(variableName, path, null);
4112   //}
4113   /**
4114    * Sets the value of the given classpath variable. The path must not be
4115    * null.
4116    * <p>
4117    * This functionality cannot be used while the resource tree is locked.
4118    * <p>
4119    * Classpath variable values are persisted locally to the workspace, and are
4120    * preserved from session to session.
4121    * <p>
4122    * Updating a variable with the same value has no effect.
4123    * 
4124    * @param variableName
4125    *            the name of the classpath variable
4126    * @param path
4127    *            the path
4128    * @param monitor
4129    *            a monitor to report progress
4130    * @see #getClasspathVariable
4131    */
4132   //public static void setClasspathVariable(
4133   //    String variableName,
4134   //    IPath path,
4135   //    IProgressMonitor monitor)
4136   //    throws JavaModelException {
4137   //
4138   //    if (path == null) Assert.isTrue(false, "Variable path cannot be null");
4139   // //$NON-NLS-1$
4140   //    setClasspathVariables(new String[]{variableName}, new IPath[]{ path },
4141   // monitor);
4142   //}
4143   /**
4144    * Sets the values of all the given classpath variables at once. Null paths
4145    * can be used to request corresponding variable removal.
4146    * <p>
4147    * This functionality cannot be used while the resource tree is locked.
4148    * <p>
4149    * Classpath variable values are persisted locally to the workspace, and are
4150    * preserved from session to session.
4151    * <p>
4152    * Updating a variable with the same value has no effect.
4153    * 
4154    * @param variableNames
4155    *            an array of names for the updated classpath variables
4156    * @param paths
4157    *            an array of path updates for the modified classpath variables
4158    *            (null meaning that the corresponding value will be removed
4159    * @param monitor
4160    *            a monitor to report progress
4161    * @see #getClasspathVariable
4162    * @since 2.0
4163    */
4164   //public static void setClasspathVariables(
4165   //    String[] variableNames,
4166   //    IPath[] paths,
4167   //    IProgressMonitor monitor)
4168   //    throws JavaModelException {
4169   //
4170   //    if (variableNames.length != paths.length) Assert.isTrue(false, "Variable
4171   // names and paths collections should have the same size"); //$NON-NLS-1$
4172   //    //TODO: should check that null cannot be used as variable paths
4173   //    updateVariableValues(variableNames, paths, monitor);
4174   //}
4175   /*
4176    * (non-Javadoc) Method declared on IExecutableExtension. Record any
4177    * necessary initialization data from the plugin.
4178    */
4179   public void setInitializationData(IConfigurationElement cfig,
4180       String propertyName, Object data) throws CoreException {
4181   }
4182
4183   /**
4184    * Sets the current table of options. All and only the options explicitly
4185    * included in the given table are remembered; all previous option settings
4186    * are forgotten, including ones not explicitly mentioned.
4187    * <p>
4188    * For a complete description of the configurable options, see
4189    * <code>getDefaultOptions</code>.
4190    * </p>
4191    * 
4192    * @param newOptions
4193    *            the new options (key type: <code>String</code>; value type:
4194    *            <code>String</code>), or <code>null</code> to reset all
4195    *            options to their default values
4196    * @see JavaCore#getDefaultOptions
4197    */
4198   public static void setOptions(Hashtable newOptions) {
4199
4200     // see #initializeDefaultPluginPreferences() for changing default
4201     // settings
4202     Preferences preferences = getPlugin().getPluginPreferences();
4203
4204     if (newOptions == null) {
4205       newOptions = JavaCore.getDefaultOptions();
4206     }
4207     Enumeration keys = newOptions.keys();
4208     while (keys.hasMoreElements()) {
4209       String key = (String) keys.nextElement();
4210       if (!JavaModelManager.OptionNames.contains(key))
4211         continue; // unrecognized option
4212       if (key.equals(CORE_ENCODING))
4213         continue; // skipped, contributed by resource prefs
4214       String value = (String) newOptions.get(key);
4215       preferences.setValue(key, value);
4216     }
4217
4218     // persist options
4219     getPlugin().savePluginPreferences();
4220   }
4221
4222   /**
4223    * Shutdown the JavaCore plug-in.
4224    * <p>
4225    * De-registers the JavaModelManager as a resource changed listener and save
4226    * participant.
4227    * <p>
4228    * 
4229    * @see org.eclipse.core.runtime.Plugin#shutdown()
4230    */
4231   // moved to PHPeclipsePlugin#shutdown()
4232   //public void shutdown() {
4233   //
4234   //    //savePluginPreferences();
4235   //    getPlugin().savePluginPreferences();
4236   //    IWorkspace workspace = ResourcesPlugin.getWorkspace();
4237   //    workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaProcessor);
4238   //    workspace.removeSaveParticipant(PHPeclipsePlugin.getDefault());
4239   //
4240   //    ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown();
4241   //}
4242   /**
4243    * Initiate the background indexing process. This should be deferred after
4244    * the plugin activation.
4245    */
4246   //private void startIndexing() {
4247   //
4248   //    JavaModelManager.getJavaModelManager().getIndexManager().reset();
4249   //}
4250   /**
4251    * Startup of the JavaCore plug-in.
4252    * <p>
4253    * Registers the JavaModelManager as a resource changed listener and save
4254    * participant. Starts the background indexing, and restore saved classpath
4255    * variable values.
4256    * <p>
4257    * 
4258    * @see org.eclipse.core.runtime.Plugin#startup()
4259    */
4260
4261   // moved to PHPeclipsePlugin#startup()
4262   //public void startup() {
4263   //            
4264   //    JavaModelManager manager = JavaModelManager.getJavaModelManager();
4265   //    try {
4266   //            manager.configurePluginDebugOptions();
4267   //
4268   //            // request state folder creation (workaround 19885)
4269   //            JavaCore.getPlugin().getStateLocation();
4270   //
4271   //            // retrieve variable values
4272   //            JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new
4273   // JavaModelManager.PluginPreferencesListener());
4274   //// TODO : jsurfer temp-del
4275   //// manager.loadVariablesAndContainers();
4276   //
4277   //            IWorkspace workspace = ResourcesPlugin.getWorkspace();
4278   //            workspace.addResourceChangeListener(
4279   //                    manager.deltaProcessor,
4280   //                    IResourceChangeEvent.PRE_AUTO_BUILD
4281   //                            | IResourceChangeEvent.POST_AUTO_BUILD
4282   //                            | IResourceChangeEvent.POST_CHANGE
4283   //                            | IResourceChangeEvent.PRE_DELETE
4284   //                            | IResourceChangeEvent.PRE_CLOSE);
4285   //
4286   //// startIndexing();
4287   //            workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager);
4288   //                    
4289   //    } catch (CoreException e) {
4290   //    } catch (RuntimeException e) {
4291   //            manager.shutdown();
4292   //            throw e;
4293   //    }
4294   //}
4295   /**
4296    * Internal updating of a variable values (null path meaning removal),
4297    * allowing to change multiple variable values at once.
4298    */
4299   //private static void updateVariableValues(
4300   //    String[] variableNames,
4301   //    IPath[] variablePaths,
4302   //    IProgressMonitor monitor) throws JavaModelException {
4303   //    
4304   //    if (monitor != null && monitor.isCanceled()) return;
4305   //            
4306   //    if (JavaModelManager.CP_RESOLVE_VERBOSE){
4307   //            System.out.println("CPVariable SET - setting variables: {" +
4308   // Util.toString(variableNames) //$NON-NLS-1$
4309   //                    + "} with values: " + Util.toString(variablePaths)); //$NON-NLS-1$
4310   //    }
4311   //
4312   //    int varLength = variableNames.length;
4313   //            
4314   //    // gather classpath information for updating
4315   //    final HashMap affectedProjects = new HashMap(5);
4316   //    JavaModelManager manager = JavaModelManager.getJavaModelManager();
4317   //    IJavaModel model = manager.getJavaModel();
4318   //    
4319   //    // filter out unmodified variables
4320   //    int discardCount = 0;
4321   //    for (int i = 0; i < varLength; i++){
4322   //            String variableName = variableNames[i];
4323   //            IPath oldPath = (IPath)JavaModelManager.variableGet(variableName); // if
4324   // reentering will provide previous session value
4325   //            if (oldPath == JavaModelManager.VariableInitializationInProgress){
4326   //                    IPath previousPath =
4327   // (IPath)JavaModelManager.PreviousSessionVariables.get(variableName);
4328   //                    if (previousPath != null){
4329   //                            if (JavaModelManager.CP_RESOLVE_VERBOSE){
4330   //                                    System.out.println("CPVariable INIT - reentering access to variable: " +
4331   // variableName+ " during its initialization, will see previous value: "+
4332   // previousPath); //$NON-NLS-1$ //$NON-NLS-2$
4333   //                            }
4334   //                            JavaModelManager.variablePut(variableName, previousPath); // replace
4335   // value so reentering calls are seeing old value
4336   //                    }
4337   //                    oldPath = null; //33695 - cannot filter out restored variable, must
4338   // update affected project to reset cached CP
4339   //            }
4340   //            if (oldPath != null && oldPath.equals(variablePaths[i])){
4341   //                    variableNames[i] = null;
4342   //                    discardCount++;
4343   //            }
4344   //    }
4345   //    if (discardCount > 0){
4346   //            if (discardCount == varLength) return;
4347   //            int changedLength = varLength - discardCount;
4348   //            String[] changedVariableNames = new String[changedLength];
4349   //            IPath[] changedVariablePaths = new IPath[changedLength];
4350   //            for (int i = 0, index = 0; i < varLength; i++){
4351   //                    if (variableNames[i] != null){
4352   //                            changedVariableNames[index] = variableNames[i];
4353   //                            changedVariablePaths[index] = variablePaths[i];
4354   //                            index++;
4355   //                    }
4356   //            }
4357   //            variableNames = changedVariableNames;
4358   //            variablePaths = changedVariablePaths;
4359   //            varLength = changedLength;
4360   //    }
4361   //            
4362   //    if (monitor != null && monitor.isCanceled()) return;
4363   //
4364   //    if (model != null) {
4365   //            IJavaProject[] projects = model.getJavaProjects();
4366   //            nextProject : for (int i = 0, projectLength = projects.length; i <
4367   // projectLength; i++){
4368   //                    IJavaProject project = projects[i];
4369   //                                            
4370   //                    // check to see if any of the modified variables is present on the
4371   // classpath
4372   //                    IClasspathEntry[] classpath = project.getRawClasspath();
4373   //                    for (int j = 0, cpLength = classpath.length; j < cpLength; j++){
4374   //                                    
4375   //                            IClasspathEntry entry = classpath[j];
4376   //                            for (int k = 0; k < varLength; k++){
4377   //    
4378   //                                    String variableName = variableNames[k];
4379   //                                    if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE){
4380   //    
4381   //                                            if (variableName.equals(entry.getPath().segment(0))){
4382   //                                                    affectedProjects.put(project, project.getResolvedClasspath(true));
4383   //                                                    continue nextProject;
4384   //                                            }
4385   //                                            IPath sourcePath, sourceRootPath;
4386   //                                            if (((sourcePath = entry.getSourceAttachmentPath()) != null &&
4387   // variableName.equals(sourcePath.segment(0)))
4388   //                                                    || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null &&
4389   // variableName.equals(sourceRootPath.segment(0)))) {
4390   //    
4391   //                                                    affectedProjects.put(project, project.getResolvedClasspath(true));
4392   //                                                    continue nextProject;
4393   //                                            }
4394   //                                    }
4395   //                            }
4396   //                    }
4397   //            }
4398   //    }
4399   //    // update variables
4400   //    for (int i = 0; i < varLength; i++){
4401   //            JavaModelManager.variablePut(variableNames[i], variablePaths[i]);
4402   //    }
4403   //    final String[] dbgVariableNames = variableNames;
4404   //                            
4405   //    // update affected project classpaths
4406   //    if (!affectedProjects.isEmpty()) {
4407   //            try {
4408   //                    JavaCore_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt.run(
4409   //                            new IWorkspaceRunnable() {
4410   //                                    public void run(IProgressMonitor monitor) throws CoreException {
4411   //                                            // propagate classpath change
4412   //                                            Iterator projectsToUpdate = affectedProjects.keySet().iterator();
4413   //                                            while (projectsToUpdate.hasNext()) {
4414   //                    
4415   //                                                    if (monitor != null && monitor.isCanceled()) return;
4416   //                    
4417   //                                                    JavaProject project = (JavaProject) projectsToUpdate.next();
4418   //
4419   //                                                    if (JavaModelManager.CP_RESOLVE_VERBOSE){
4420   //                                                            System.out.println("CPVariable SET - updating affected project:
4421   // ["+project.getElementName()+"] due to setting variables: "+
4422   // Util.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$
4423   //                                                    }
4424   //                                                            
4425   //                                                    project
4426   //                                                            .setRawClasspath(
4427   //                                                                    project.getRawClasspath(),
4428   //                                                                    SetClasspathOperation.ReuseOutputLocation,
4429   //                                                                    null, // don't call beginTask on the monitor (see
4430   // http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717)
4431   //                                                                    !ResourcesPlugin.getWorkspace().isTreeLocked(), // can change resources
4432   //                                                                    (IClasspathEntry[]) affectedProjects.get(project),
4433   //                                                                    false, // updating - no validation
4434   //                                                                    false); // updating - no need to save
4435   //                                            }
4436   //                                    }
4437   //                            },
4438   //                            monitor);
4439   //            } catch (CoreException e) {
4440   //                    if (JavaModelManager.CP_RESOLVE_VERBOSE){
4441   //                            System.out.println("CPVariable SET - FAILED DUE TO EXCEPTION:
4442   // "+Util.toString(dbgVariableNames)); //$NON-NLS-1$
4443   //                            e.printStackTrace();
4444   //                    }
4445   //                    if (e instanceof JavaModelException) {
4446   //                            throw (JavaModelException)e;
4447   //                    } else {
4448   //                            throw new JavaModelException(e);
4449   //                    }
4450   //            }
4451   //    }
4452   //}
4453   /*
4454    * (non-Javadoc) Startup the JavaCore plug-in. <p> Registers the
4455    * JavaModelManager as a resource changed listener and save participant.
4456    * Starts the background indexing, and restore saved classpath variable
4457    * values. <p> @throws Exception
4458    * 
4459    * @see org.eclipse.core.runtime.Plugin#start(BundleContext)
4460    */
4461   //public static void start(final Plugin plugin, BundleContext context)
4462   // throws Exception {
4463   //// super.start(context);
4464   //    
4465   //    final JavaModelManager manager = JavaModelManager.getJavaModelManager();
4466   //    try {
4467   //            manager.configurePluginDebugOptions();
4468   //
4469   //            // request state folder creation (workaround 19885)
4470   //            JavaCore.getPlugin().getStateLocation();
4471   //
4472   //            // retrieve variable values
4473   //            //JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new
4474   // JavaModelManager.PluginPreferencesListener());
4475   //// manager.loadVariablesAndContainers();
4476   //
4477   //            final IWorkspace workspace = ResourcesPlugin.getWorkspace();
4478   //            workspace.addResourceChangeListener(
4479   //                    manager.deltaState,
4480   //                    IResourceChangeEvent.PRE_BUILD
4481   //                            | IResourceChangeEvent.POST_BUILD
4482   //                            | IResourceChangeEvent.POST_CHANGE
4483   //                            | IResourceChangeEvent.PRE_DELETE
4484   //                            | IResourceChangeEvent.PRE_CLOSE);
4485   //
4486   //// startIndexing();
4487   //            
4488   //            // process deltas since last activated in indexer thread so that indexes
4489   // are up-to-date.
4490   //            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
4491   //            Job processSavedState = new Job(Util.bind("savedState.jobName")) {
4492   // //$NON-NLS-1$
4493   //                    protected IStatus run(IProgressMonitor monitor) {
4494   //                            try {
4495   //                                    // add save participant and process delta atomically
4496   //                                    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
4497   //                                    workspace.run(
4498   //                                            new IWorkspaceRunnable() {
4499   //                                                    public void run(IProgressMonitor progress) throws CoreException {
4500   //// ISavedState savedState = workspace.addSaveParticipant(JavaCore.this,
4501   // manager);
4502   //                                                            ISavedState savedState = workspace.addSaveParticipant(plugin, manager);
4503   //                                                            if (savedState != null) {
4504   //                                                                    // the event type coming from the saved state is always POST_AUTO_BUILD
4505   //                                                                    // force it to be POST_CHANGE so that the delta processor can handle it
4506   //                                                                    manager.deltaState.getDeltaProcessor().overridenEventType =
4507   // IResourceChangeEvent.POST_CHANGE;
4508   //                                                                    savedState.processResourceChangeEvents(manager.deltaState);
4509   //                                                            }
4510   //                                                    }
4511   //                                            },
4512   //                                            monitor);
4513   //                            } catch (CoreException e) {
4514   //                                    return e.getStatus();
4515   //                            }
4516   //                            return Status.OK_STATUS;
4517   //                    }
4518   //            };
4519   //            processSavedState.setSystem(true);
4520   //            processSavedState.setPriority(Job.SHORT); // process asap
4521   //            processSavedState.schedule();
4522   //    } catch (RuntimeException e) {
4523   //            manager.shutdown();
4524   //            throw e;
4525   //    }
4526   //}
4527   /*
4528    * (non-Javadoc) Shutdown the JavaCore plug-in. <p> De-registers the
4529    * JavaModelManager as a resource changed listener and save participant. <p>
4530    * 
4531    * @see org.eclipse.core.runtime.Plugin#stop(BundleContext)
4532    */
4533 //  public static void stop(Plugin plugin, BundleContext context)
4534 //      throws Exception {
4535 //    try {
4536 //      plugin.savePluginPreferences();
4537 //      IWorkspace workspace = ResourcesPlugin.getWorkspace();
4538 //      workspace.removeResourceChangeListener(JavaModelManager
4539 //          .getJavaModelManager().deltaState);
4540 //      workspace.removeSaveParticipant(plugin);
4541 //
4542 //      JavaModelManager.getJavaModelManager().shutdown();
4543 //    } finally {
4544 //      // ensure we call super.stop as the last thing
4545 //      //              super.stop(context);
4546 //    }
4547 //  }
4548 }