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