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