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