KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > JavaCore


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  * IBM Corporation - added the following constants:
11  * COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE
12  * COMPILER_PB_STATIC_ACCESS_RECEIVER
13  * COMPILER_TASK_TAGS
14  * CORE_CIRCULAR_CLASSPATH
15  * CORE_INCOMPLETE_CLASSPATH
16  * IBM Corporation - added run(IWorkspaceRunnable, IProgressMonitor)
17  * IBM Corporation - added exclusion patterns to source classpath entries
18  * IBM Corporation - added specific output location to source classpath entries
19  * IBM Corporation - added the following constants:
20  * CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER
21  * CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER
22  * CLEAN
23  * IBM Corporation - added getClasspathContainerInitializer(String)
24  * IBM Corporation - added the following constants:
25  * CODEASSIST_ARGUMENT_PREFIXES
26  * CODEASSIST_ARGUMENT_SUFFIXES
27  * CODEASSIST_FIELD_PREFIXES
28  * CODEASSIST_FIELD_SUFFIXES
29  * CODEASSIST_LOCAL_PREFIXES
30  * CODEASSIST_LOCAL_SUFFIXES
31  * CODEASSIST_STATIC_FIELD_PREFIXES
32  * CODEASSIST_STATIC_FIELD_SUFFIXES
33  * COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION
34  * IBM Corporation - added the following constants:
35  * COMPILER_PB_LOCAL_VARIABLE_HIDING
36  * COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD
37  * COMPILER_PB_FIELD_HIDING
38  * COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT
39  * CORE_INCOMPATIBLE_JDK_LEVEL
40  * VERSION_1_5
41  * COMPILER_PB_EMPTY_STATEMENT
42  * IBM Corporation - added the following constants:
43  * COMPILER_PB_INDIRECT_STATIC_ACCESS
44  * COMPILER_PB_BOOLEAN_METHOD_THROWING_EXCEPTION
45  * COMPILER_PB_UNNECESSARY_CAST
46  * IBM Corporation - added the following constants:
47  * COMPILER_PB_INVALID_JAVADOC
48  * COMPILER_PB_INVALID_JAVADOC_TAGS
49  * COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY
50  * COMPILER_PB_MISSING_JAVADOC_TAGS
51  * COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY
52  * COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING
53  * COMPILER_PB_MISSING_JAVADOC_COMMENTS
54  * COMPILER_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY
55  * COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING
56  * COMPILER_PB_DEPRECATION_WHEN_OVERRIDING_DEPRECATED_METHOD
57  * COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING
58  * IBM Corporation - added the following constants:
59  * TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC
60  * IBM Corporation - added the following constants:
61  * COMPILER_PB_FALLTHROUGH_CASE
62  * COMPILER_PB_PARAMETER_ASSIGNMENT
63  * COMPILER_PB_NULL_REFERENCE
64  * IBM Corporation - added the following constants:
65  * CODEASSIST_DEPRECATION_CHECK
66  * IBM Corporation - added the following constants:
67  * COMPILER_PB_POTENTIAL_NULL_REFERENCE
68  * COMPILER_PB_REDUNDANT_NULL_CHECK
69  * IBM Corporation - added the following constants:
70  * COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE
71  *******************************************************************************/

72 package org.eclipse.jdt.core;
73
74 import java.io.File JavaDoc;
75 import java.util.ArrayList JavaDoc;
76 import java.util.HashMap JavaDoc;
77 import java.util.Hashtable JavaDoc;
78 import java.util.Map JavaDoc;
79
80 import org.eclipse.core.resources.IContainer;
81 import org.eclipse.core.resources.IFile;
82 import org.eclipse.core.resources.IFolder;
83 import org.eclipse.core.resources.IMarker;
84 import org.eclipse.core.resources.IMarkerDelta;
85 import org.eclipse.core.resources.IProject;
86 import org.eclipse.core.resources.IResource;
87 import org.eclipse.core.resources.IResourceChangeEvent;
88 import org.eclipse.core.resources.IResourceChangeListener;
89 import org.eclipse.core.resources.IWorkspace;
90 import org.eclipse.core.resources.IWorkspaceRoot;
91 import org.eclipse.core.resources.IWorkspaceRunnable;
92 import org.eclipse.core.resources.ResourcesPlugin;
93 import org.eclipse.core.runtime.Assert;
94 import org.eclipse.core.runtime.CoreException;
95 import org.eclipse.core.runtime.IConfigurationElement;
96 import org.eclipse.core.runtime.IExtension;
97 import org.eclipse.core.runtime.IExtensionPoint;
98 import org.eclipse.core.runtime.IPath;
99 import org.eclipse.core.runtime.IProgressMonitor;
100 import org.eclipse.core.runtime.OperationCanceledException;
101 import org.eclipse.core.runtime.Platform;
102 import org.eclipse.core.runtime.Plugin;
103 import org.eclipse.core.runtime.QualifiedName;
104 import org.eclipse.core.runtime.SubProgressMonitor;
105 import org.eclipse.core.runtime.jobs.ISchedulingRule;
106 import org.eclipse.jdt.core.compiler.CharOperation;
107 import org.eclipse.jdt.core.search.IJavaSearchConstants;
108 import org.eclipse.jdt.core.search.IJavaSearchScope;
109 import org.eclipse.jdt.core.search.SearchEngine;
110 import org.eclipse.jdt.core.search.SearchPattern;
111 import org.eclipse.jdt.core.search.TypeNameRequestor;
112 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
113 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
114 import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
115 import org.eclipse.jdt.internal.core.*;
116 import org.eclipse.jdt.internal.core.builder.JavaBuilder;
117 import org.eclipse.jdt.internal.core.builder.State;
118 import org.eclipse.jdt.internal.core.util.MementoTokenizer;
119 import org.eclipse.jdt.internal.core.util.Messages;
120 import org.eclipse.jdt.internal.core.util.Util;
121 import org.osgi.framework.BundleContext;
122
123 /**
124  * The plug-in runtime class for the Java model plug-in containing the core
125  * (UI-free) support for Java projects.
126  * <p>
127  * Like all plug-in runtime classes (subclasses of <code>Plugin</code>), this
128  * class is automatically instantiated by the platform when the plug-in gets
129  * activated. Clients must not attempt to instantiate plug-in runtime classes
130  * directly.
131  * </p>
132  * <p>
133  * The single instance of this class can be accessed from any plug-in declaring
134  * the Java model plug-in as a prerequisite via
135  * <code>JavaCore.getJavaCore()</code>. The Java model plug-in will be activated
136  * automatically if not already active.
137  * </p>
138  */

139 public final class JavaCore extends Plugin {
140
141     private static final IResource[] NO_GENERATED_RESOURCES = new IResource[0];
142
143     private static Plugin JAVA_CORE_PLUGIN = null;
144     /**
145      * The plug-in identifier of the Java core support
146      * (value <code>"org.eclipse.jdt.core"</code>).
147      */

148     public static final String JavaDoc PLUGIN_ID = "org.eclipse.jdt.core" ; //$NON-NLS-1$
149

150     /**
151      * The identifier for the Java builder
152      * (value <code>"org.eclipse.jdt.core.javabuilder"</code>).
153      */

154     public static final String JavaDoc BUILDER_ID = PLUGIN_ID + ".javabuilder" ; //$NON-NLS-1$
155

156     /**
157      * The identifier for the Java model
158      * (value <code>"org.eclipse.jdt.core.javamodel"</code>).
159      */

160     public static final String JavaDoc MODEL_ID = PLUGIN_ID + ".javamodel" ; //$NON-NLS-1$
161

162     /**
163      * The identifier for the Java nature
164      * (value <code>"org.eclipse.jdt.core.javanature"</code>).
165      * The presence of this nature on a project indicates that it is
166      * Java-capable.
167      *
168      * @see org.eclipse.core.resources.IProject#hasNature(java.lang.String)
169      */

170     public static final String JavaDoc NATURE_ID = PLUGIN_ID + ".javanature" ; //$NON-NLS-1$
171

172     /**
173      * Name of the handle id attribute in a Java marker.
174      */

175     protected static final String JavaDoc ATT_HANDLE_ID =
176         "org.eclipse.jdt.internal.core.JavaModelManager.handleId" ; //$NON-NLS-1$
177

178     /**
179      * Name of the User Library Container id.
180      * @since 3.0
181      */

182     public static final String JavaDoc USER_LIBRARY_CONTAINER_ID= "org.eclipse.jdt.USER_LIBRARY"; //$NON-NLS-1$
183

184     // *************** Possible IDs for configurable options. ********************
185

186     /**
187      * Possible configurable option ID.
188      * @see #getDefaultOptions()
189      */

190     public static final String JavaDoc COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + ".compiler.debug.localVariable"; //$NON-NLS-1$
191
/**
192      * Possible configurable option ID.
193      * @see #getDefaultOptions()
194      */

195     public static final String JavaDoc COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + ".compiler.debug.lineNumber"; //$NON-NLS-1$
196
/**
197      * Possible configurable option ID.
198      * @see #getDefaultOptions()
199      */

200     public static final String JavaDoc COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + ".compiler.debug.sourceFile"; //$NON-NLS-1$
201
/**
202      * Possible configurable option ID.
203      * @see #getDefaultOptions()
204      */

205     public static final String JavaDoc COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + ".compiler.codegen.unusedLocal"; //$NON-NLS-1$
206
/**
207      * Possible configurable option ID.
208      * @see #getDefaultOptions()
209      */

210     public static final String JavaDoc COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"; //$NON-NLS-1$
211
/**
212      * Possible configurable option ID.
213      * @see #getDefaultOptions()
214      * @since 3.0
215      */

216     public static final String JavaDoc COMPILER_CODEGEN_INLINE_JSR_BYTECODE = PLUGIN_ID + ".compiler.codegen.inlineJsrBytecode"; //$NON-NLS-1$
217
/**
218      * Possible configurable option ID.
219      * @see #getDefaultOptions()
220      * @since 3.0
221      */

222     public static final String JavaDoc COMPILER_DOC_COMMENT_SUPPORT = PLUGIN_ID + ".compiler.doc.comment.support"; //$NON-NLS-1$
223
/**
224      * Possible configurable option ID.
225      * @see #getDefaultOptions()
226      * @deprecated - discontinued since turning off would violate language specs
227      */

228     public static final String JavaDoc COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"; //$NON-NLS-1$
229
/**
230      * Possible configurable option ID.
231      * @see #getDefaultOptions()
232      * @deprecated - discontinued since turning off would violate language specs
233      */

234     public static final String JavaDoc COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + ".compiler.problem.invalidImport"; //$NON-NLS-1$
235
/**
236      * Possible configurable option ID.
237      * @see #getDefaultOptions()
238      */

239     public static final String JavaDoc COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + ".compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$
240
/**
241      * Possible configurable option ID.
242      * @see #getDefaultOptions()
243      */

244     public static final String JavaDoc COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"; //$NON-NLS-1$
245
/**
246      * Possible configurable option ID.
247      * @see #getDefaultOptions()
248      */

249     public static final String JavaDoc COMPILER_PB_DEPRECATION = PLUGIN_ID + ".compiler.problem.deprecation"; //$NON-NLS-1$
250
/**
251      * Possible configurable option ID.
252      * @see #getDefaultOptions()
253      * @since 2.1
254      */

255     public static final String JavaDoc COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID + ".compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$
256
/**
257      * Possible configurable option ID.
258      * @see #getDefaultOptions()
259      * @since 3.0
260      */

261     public static final String JavaDoc COMPILER_PB_DEPRECATION_WHEN_OVERRIDING_DEPRECATED_METHOD = "org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod"; //$NON-NLS-1$
262
/**
263      * Possible configurable option ID.
264      * @see #getDefaultOptions()
265      */

266     public static final String JavaDoc COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$
267
/**
268      * Possible configurable option ID.
269      * @see #getDefaultOptions()
270      */

271     public static final String JavaDoc COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"; //$NON-NLS-1$
272
/**
273      * Possible configurable option ID.
274      * @see #getDefaultOptions()
275      */

276     public static final String JavaDoc COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"; //$NON-NLS-1$
277
/**
278      * Possible configurable option ID.
279      * @see #getDefaultOptions()
280      * @since 2.1
281      */

282     public static final String JavaDoc COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID + ".compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$
283
/**
284      * Possible configurable option ID.
285      * @see #getDefaultOptions()
286      * @since 2.1
287      */

288     public static final String JavaDoc COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID + ".compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$
289
/**
290      * Possible configurable option ID.
291      * @see #getDefaultOptions()
292      * @since 3.3
293      */

294     public static final String JavaDoc COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE = PLUGIN_ID + ".compiler.problem.unusedParameterIncludeDocCommentReference"; //$NON-NLS-1$
295
/**
296      * Possible configurable option ID.
297      * @see #getDefaultOptions()
298      * @since 2.0
299      */

300     public static final String JavaDoc COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + ".compiler.problem.unusedImport"; //$NON-NLS-1$
301
/**
302      * Possible configurable option ID.
303      * @see #getDefaultOptions()
304      */

305     public static final String JavaDoc COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + ".compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$
306
/**
307      * Possible configurable option ID.
308      * @see #getDefaultOptions()
309      * @since 2.0
310      */

311     public static final String JavaDoc COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID + ".compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$
312
/**
313      * Possible configurable option ID.
314      * @see #getDefaultOptions()
315      * @since 2.0
316      */

317     public static final String JavaDoc COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID + ".compiler.problem.assertIdentifier"; //$NON-NLS-1$
318
/**
319      * Possible configurable option ID.
320      * @see #getDefaultOptions()
321      * @since 3.1
322      */

323     public static final String JavaDoc COMPILER_PB_ENUM_IDENTIFIER = PLUGIN_ID + ".compiler.problem.enumIdentifier"; //$NON-NLS-1$
324
/**
325      * Possible configurable option ID.
326      * @see #getDefaultOptions()
327      * @since 2.1
328      */

329     public static final String JavaDoc COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID + ".compiler.problem.staticAccessReceiver"; //$NON-NLS-1$
330
/**
331      * Possible configurable option ID.
332      * @see #getDefaultOptions()
333      * @since 3.0
334      */

335     public static final String JavaDoc COMPILER_PB_INDIRECT_STATIC_ACCESS = PLUGIN_ID + ".compiler.problem.indirectStaticAccess"; //$NON-NLS-1$
336
/**
337      * Possible configurable option ID.
338      * @see #getDefaultOptions()
339      * @since 2.1
340      */

341     public static final String JavaDoc COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.noEffectAssignment"; //$NON-NLS-1$
342
/**
343      * Possible configurable option ID.
344      * @see #getDefaultOptions()
345      * @since 2.1
346      */

347     public static final String JavaDoc COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID + ".compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$
348
/**
349      * Possible configurable option ID.
350      * @see #getDefaultOptions()
351      * @since 2.1
352      */

353     public static final String JavaDoc COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$
354
/**
355      * Possible configurable option ID.
356      * @see #getDefaultOptions()
357      * @since 3.0
358      */

359     public static final String JavaDoc COMPILER_PB_LOCAL_VARIABLE_HIDING = PLUGIN_ID + ".compiler.problem.localVariableHiding"; //$NON-NLS-1$
360
/**
361      * Possible configurable option ID.
362      * @see #getDefaultOptions()
363      * @since 3.0
364      */

365     public static final String JavaDoc COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD = PLUGIN_ID + ".compiler.problem.specialParameterHidingField"; //$NON-NLS-1$
366
/**
367      * Possible configurable option ID.
368      * @see #getDefaultOptions()
369      * @since 3.0
370      */

371     public static final String JavaDoc COMPILER_PB_FIELD_HIDING = PLUGIN_ID + ".compiler.problem.fieldHiding"; //$NON-NLS-1$
372
/**
373      * Possible configurable option ID.
374      * @see #getDefaultOptions()
375      * @since 3.1
376      */

377     public static final String JavaDoc COMPILER_PB_TYPE_PARAMETER_HIDING = PLUGIN_ID + ".compiler.problem.typeParameterHiding"; //$NON-NLS-1$
378
/**
379      * Possible configurable option ID.
380      * @see #getDefaultOptions()
381      * @since 3.0
382      */

383     public static final String JavaDoc COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.possibleAccidentalBooleanAssignment"; //$NON-NLS-1$
384
/**
385      * Possible configurable option ID.
386      * @see #getDefaultOptions()
387      * @since 3.2
388      */

389     public static final String JavaDoc COMPILER_PB_FALLTHROUGH_CASE = PLUGIN_ID + ".compiler.problem.fallthroughCase"; //$NON-NLS-1$
390
/**
391      * Possible configurable option ID.
392      * @see #getDefaultOptions()
393      * @since 3.0
394      */

395     public static final String JavaDoc COMPILER_PB_EMPTY_STATEMENT = PLUGIN_ID + ".compiler.problem.emptyStatement"; //$NON-NLS-1$
396
/**
397      * Possible configurable option ID.
398      * @see #getDefaultOptions()
399      * @since 3.0
400      */

401     public static final String JavaDoc COMPILER_PB_BOOLEAN_METHOD_THROWING_EXCEPTION = PLUGIN_ID + ".compiler.problem.booleanMethodThrowingException"; //$NON-NLS-1$
402
/**
403      * Possible configurable option ID.
404      * @see #getDefaultOptions()
405      * @since 3.0
406      */

407     public static final String JavaDoc COMPILER_PB_UNNECESSARY_TYPE_CHECK = PLUGIN_ID + ".compiler.problem.unnecessaryTypeCheck"; //$NON-NLS-1$
408
/**
409      * Possible configurable option ID.
410      * @see #getDefaultOptions()
411      * @since 3.0
412      */

413     public static final String JavaDoc COMPILER_PB_UNNECESSARY_ELSE = PLUGIN_ID + ".compiler.problem.unnecessaryElse"; //$NON-NLS-1$
414
/**
415      * Possible configurable option ID.
416      * @see #getDefaultOptions()
417      * @since 3.0
418      */

419     public static final String JavaDoc COMPILER_PB_UNDOCUMENTED_EMPTY_BLOCK = PLUGIN_ID + ".compiler.problem.undocumentedEmptyBlock"; //$NON-NLS-1$
420
/**
421      * Possible configurable option ID.
422      * @see #getDefaultOptions()
423      * @since 3.0
424      */

425     public static final String JavaDoc COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING = PLUGIN_ID + ".compiler.problem.finallyBlockNotCompletingNormally"; //$NON-NLS-1$
426
/**
427      * Possible configurable option ID.
428      * @see #getDefaultOptions()
429      * @since 3.0
430      */

431     public static final String JavaDoc COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION = PLUGIN_ID + ".compiler.problem.unusedDeclaredThrownException"; //$NON-NLS-1$
432
/**
433      * Possible configurable option ID.
434      * @see #getDefaultOptions()
435      * @since 3.0
436      */

437     public static final String JavaDoc COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING = PLUGIN_ID + ".compiler.problem.unusedDeclaredThrownExceptionWhenOverriding"; //$NON-NLS-1$
438
/**
439      * Possible configurable option ID.
440      * @see #getDefaultOptions()
441      * @since 3.0
442      */

443     public static final String JavaDoc COMPILER_PB_UNQUALIFIED_FIELD_ACCESS = PLUGIN_ID + ".compiler.problem.unqualifiedFieldAccess"; //$NON-NLS-1$
444
/**
445      * Possible configurable option ID.
446      * @see #getDefaultOptions()
447      * @deprecated - got renamed into {@link #COMPILER_PB_UNCHECKED_TYPE_OPERATION}
448      * @since 3.1
449      */

450     public static final String JavaDoc COMPILER_PB_UNSAFE_TYPE_OPERATION = PLUGIN_ID + ".compiler.problem.uncheckedTypeOperation"; //$NON-NLS-1$
451
/**
452      * Possible configurable option ID.
453      * @see #getDefaultOptions()
454      * @since 3.1
455      */

456     public static final String JavaDoc COMPILER_PB_UNCHECKED_TYPE_OPERATION = PLUGIN_ID + ".compiler.problem.uncheckedTypeOperation"; //$NON-NLS-1$
457
/**
458      * Possible configurable option ID.
459      * @see #getDefaultOptions()
460      * @since 3.2
461      */

462     public static final String JavaDoc COMPILER_PB_RAW_TYPE_REFERENCE = PLUGIN_ID + ".compiler.problem.rawTypeReference"; //$NON-NLS-1$
463
/**
464      * Possible configurable option ID.
465      * @see #getDefaultOptions()
466      * @since 3.1
467      */

468     public static final String JavaDoc COMPILER_PB_FINAL_PARAMETER_BOUND = PLUGIN_ID + ".compiler.problem.finalParameterBound"; //$NON-NLS-1$
469
/**
470      * Possible configurable option ID.
471      * @see #getDefaultOptions()
472      * @since 3.1
473      */

474     public static final String JavaDoc COMPILER_PB_MISSING_SERIAL_VERSION = PLUGIN_ID + ".compiler.problem.missingSerialVersion"; //$NON-NLS-1$
475
/**
476      * Possible configurable option ID.
477      * @see #getDefaultOptions()
478      * @since 3.1
479      */

480     public static final String JavaDoc COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST = PLUGIN_ID + ".compiler.problem.varargsArgumentNeedCast"; //$NON-NLS-1$
481
/**
482      * Possible configurable option ID.
483      * @see #getDefaultOptions()
484      * @since 3.1
485      */

486     public static final String JavaDoc COMPILER_PB_AUTOBOXING = PLUGIN_ID + ".compiler.problem.autoboxing"; //$NON-NLS-1$
487
/**
488      * Possible configurable option ID.
489      * @see #getDefaultOptions()
490      * @since 3.1
491      */

492     public static final String JavaDoc COMPILER_PB_ANNOTATION_SUPER_INTERFACE = PLUGIN_ID + ".compiler.problem.annotationSuperInterface"; //$NON-NLS-1$
493
/**
494      * Possible configurable option ID.
495      * @see #getDefaultOptions()
496      * @since 3.1
497      */

498     public static final String JavaDoc COMPILER_PB_MISSING_OVERRIDE_ANNOTATION = PLUGIN_ID + ".compiler.problem.missingOverrideAnnotation"; //$NON-NLS-1$
499
/**
500      * Possible configurable option ID.
501      * @see #getDefaultOptions()
502      * @since 3.1
503      */

504     public static final String JavaDoc COMPILER_PB_MISSING_DEPRECATED_ANNOTATION = PLUGIN_ID + ".compiler.problem.missingDeprecatedAnnotation"; //$NON-NLS-1$
505
/**
506      * Possible configurable option ID.
507      * @see #getDefaultOptions()
508      * @since 3.1
509      */

510     public static final String JavaDoc COMPILER_PB_INCOMPLETE_ENUM_SWITCH = PLUGIN_ID + ".compiler.problem.incompleteEnumSwitch"; //$NON-NLS-1$
511
/**
512      * Possible configurable option ID.
513      * @since 3.1
514      * @deprecated use {@link #COMPILER_PB_NULL_REFERENCE} instead
515      */

516     public static final String JavaDoc COMPILER_PB_INCONSISTENT_NULL_CHECK = PLUGIN_ID + ".compiler.problem.inconsistentNullCheck"; //$NON-NLS-1$
517
/**
518      * Possible configurable option ID.
519      * @see #getDefaultOptions()
520      * @since 3.2
521      */

522     public static final String JavaDoc COMPILER_PB_UNUSED_LABEL = PLUGIN_ID + ".compiler.problem.unusedLabel"; //$NON-NLS-1$
523
/**
524      * Possible configurable option ID.
525      * @see #getDefaultOptions()
526      * @since 3.0
527      */

528     public static final String JavaDoc COMPILER_PB_INVALID_JAVADOC = PLUGIN_ID + ".compiler.problem.invalidJavadoc"; //$NON-NLS-1$
529
/**
530      * Possible configurable option ID.
531      * @see #getDefaultOptions()
532      * @since 3.0
533      */

534     public static final String JavaDoc COMPILER_PB_INVALID_JAVADOC_TAGS = PLUGIN_ID + ".compiler.problem.invalidJavadocTags"; //$NON-NLS-1$
535
/**
536      * Possible configurable option ID.
537      * @see #getDefaultOptions()
538      * @since 3.1
539      */

540     public static final String JavaDoc COMPILER_PB_INVALID_JAVADOC_TAGS__DEPRECATED_REF = PLUGIN_ID + ".compiler.problem.invalidJavadocTagsDeprecatedRef"; //$NON-NLS-1$
541
/**
542      * Possible configurable option ID.
543      * @see #getDefaultOptions()
544      * @since 3.1
545      */

546     public static final String JavaDoc COMPILER_PB_INVALID_JAVADOC_TAGS__NOT_VISIBLE_REF = PLUGIN_ID + ".compiler.problem.invalidJavadocTagsNotVisibleRef"; //$NON-NLS-1$
547
/**
548      * Possible configurable option ID.
549      * @see #getDefaultOptions()
550      * @since 3.0
551      */

552     public static final String JavaDoc COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY = PLUGIN_ID + ".compiler.problem.invalidJavadocTagsVisibility"; //$NON-NLS-1$
553
/**
554      * Possible configurable option ID.
555      * @see #getDefaultOptions()
556      * @since 3.0
557      */

558     public static final String JavaDoc COMPILER_PB_MISSING_JAVADOC_TAGS = PLUGIN_ID + ".compiler.problem.missingJavadocTags"; //$NON-NLS-1$
559
/**
560      * Possible configurable option ID.
561      * @see #getDefaultOptions()
562      * @since 3.0
563      */

564     public static final String JavaDoc COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY = PLUGIN_ID + ".compiler.problem.missingJavadocTagsVisibility"; //$NON-NLS-1$
565
/**
566      * Possible configurable option ID.
567      * @see #getDefaultOptions()
568      * @since 3.0
569      */

570     public static final String JavaDoc COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING = PLUGIN_ID + ".compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
571
/**
572      * Possible configurable option ID.
573      * @see #getDefaultOptions()
574      * @since 3.0
575      */

576     public static final String JavaDoc COMPILER_PB_MISSING_JAVADOC_COMMENTS = PLUGIN_ID + ".compiler.problem.missingJavadocComments"; //$NON-NLS-1$
577
/**
578      * Possible configurable option ID.
579      * @see #getDefaultOptions()
580      * @since 3.0
581      */

582     public static final String JavaDoc COMPILER_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY = PLUGIN_ID + ".compiler.problem.missingJavadocCommentsVisibility"; //$NON-NLS-1$
583
/**
584      * Possible configurable option ID.
585      * @see #getDefaultOptions()
586      * @since 3.0
587      */

588     public static final String JavaDoc COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING = PLUGIN_ID + ".compiler.problem.missingJavadocCommentsOverriding"; //$NON-NLS-1$
589
/**
590      * Possible configurable option ID.
591      * @see #getDefaultOptions()
592      * @since 2.1
593      */

594     public static final String JavaDoc COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID + ".compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$
595
/**
596      * Possible configurable option ID.
597      * @see #getDefaultOptions()
598      * @since 2.0
599      */

600     public static final String JavaDoc COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID + ".compiler.maxProblemPerUnit"; //$NON-NLS-1$
601
/**
602      * Possible configurable option ID.
603      * @see #getDefaultOptions()
604      * @since 3.2
605      */

606     public static final String JavaDoc COMPILER_PB_FATAL_OPTIONAL_ERROR = PLUGIN_ID + ".compiler.problem.fatalOptionalError"; //$NON-NLS-1$
607
/**
608      * Possible configurable option ID.
609      * @see #getDefaultOptions()
610      * @since 3.2
611      */

612     public static final String JavaDoc COMPILER_PB_PARAMETER_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.parameterAssignment"; //$NON-NLS-1$
613
/**
614      * Possible configurable option ID.
615      * @see #getDefaultOptions()
616      * @since 2.0
617      */

618     public static final String JavaDoc COMPILER_SOURCE = PLUGIN_ID + ".compiler.source"; //$NON-NLS-1$
619
/**
620      * Possible configurable option ID.
621      * @see #getDefaultOptions()
622      * @since 2.0
623      */

624     public static final String JavaDoc COMPILER_COMPLIANCE = PLUGIN_ID + ".compiler.compliance"; //$NON-NLS-1$
625
/**
626      * Possible configurable option ID.
627      * @see #getDefaultOptions()
628      * @since 2.1
629      */

630     public static final String JavaDoc COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$
631
/**
632      * Possible configurable option value for COMPILER_TASK_PRIORITIES.
633      * @see #getDefaultOptions()
634      * @since 2.1
635      */

636     public static final String JavaDoc COMPILER_TASK_PRIORITY_HIGH = "HIGH"; //$NON-NLS-1$
637
/**
638      * Possible configurable option value for COMPILER_TASK_PRIORITIES.
639      * @see #getDefaultOptions()
640      * @since 2.1
641      */

642     public static final String JavaDoc COMPILER_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$
643
/**
644      * Possible configurable option value for COMPILER_TASK_PRIORITIES.
645      * @see #getDefaultOptions()
646      * @since 2.1
647      */

648     public static final String JavaDoc COMPILER_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$
649
/**
650      * Possible configurable option ID.
651      * @see #getDefaultOptions()
652      * @since 2.1
653      */

654     public static final String JavaDoc COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$
655
/**
656      * Possible configurable option ID.
657      * @see #getDefaultOptions()
658      * @since 3.0
659      */

660     public static final String JavaDoc COMPILER_TASK_CASE_SENSITIVE = PLUGIN_ID + ".compiler.taskCaseSensitive"; //$NON-NLS-1$
661
/**
662      * Possible configurable option ID.
663      * @see #getDefaultOptions()
664      * @since 3.1
665      */

666     public static final String JavaDoc COMPILER_PB_FORBIDDEN_REFERENCE = PLUGIN_ID + ".compiler.problem.forbiddenReference"; //$NON-NLS-1$
667
/**
668      * Possible configurable option ID.
669      * @see #getDefaultOptions()
670      * @since 3.1
671      */

672     public static final String JavaDoc COMPILER_PB_DISCOURAGED_REFERENCE = PLUGIN_ID + ".compiler.problem.discouragedReference"; //$NON-NLS-1$
673
/**
674      * Possible configurable option ID.
675      * @see #getDefaultOptions()
676      * @since 3.1
677      */

678     public static final String JavaDoc COMPILER_PB_SUPPRESS_WARNINGS = PLUGIN_ID + ".compiler.problem.suppressWarnings"; //$NON-NLS-1$
679
/**
680      * Possible configurable option ID.
681      * @see #getDefaultOptions()
682      * @since 3.1
683      */

684     public static final String JavaDoc COMPILER_PB_UNHANDLED_WARNING_TOKEN = PLUGIN_ID + ".compiler.problem.unhandledWarningToken"; //$NON-NLS-1$
685
/**
686      * Possible configurable option ID.
687      * @see #getDefaultOptions()
688      * @since 3.2
689      */

690     public static final String JavaDoc COMPILER_PB_NULL_REFERENCE = PLUGIN_ID + ".compiler.problem.nullReference"; //$NON-NLS-1$
691
/**
692      * Possible configurable option ID.
693      * @see #getDefaultOptions()
694      * @since 3.3
695      */

696     public static final String JavaDoc COMPILER_PB_POTENTIAL_NULL_REFERENCE = PLUGIN_ID + ".compiler.problem.potentialNullReference"; //$NON-NLS-1$
697
/**
698      * Possible configurable option ID.
699      * @see #getDefaultOptions()
700      * @since 3.3
701      */

702     public static final String JavaDoc COMPILER_PB_REDUNDANT_NULL_CHECK = PLUGIN_ID + ".compiler.problem.redundantNullCheck"; //$NON-NLS-1$
703
/**
704      * Possible configurable option ID.
705      * @see #getDefaultOptions()
706      * @since 3.3
707      */

708     public static final String JavaDoc COMPILER_PB_OVERRIDING_METHOD_WITHOUT_SUPER_INVOCATION = PLUGIN_ID + ".compiler.problem.overridingMethodWithoutSuperInvocation"; //$NON-NLS-1$
709
/**
710      * Possible configurable option ID.
711      * @see #getDefaultOptions()
712      */

713     public static final String JavaDoc CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"; //$NON-NLS-1$
714
/**
715      * Possible configurable option ID.
716      * @see #getDefaultOptions()
717      * @since 2.0
718      */

719     public static final String JavaDoc CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID + ".builder.resourceCopyExclusionFilter"; //$NON-NLS-1$
720
/**
721      * Possible configurable option ID.
722      * @see #getDefaultOptions()
723      * @since 2.1
724      */

725     public static final String JavaDoc CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID + ".builder.duplicateResourceTask"; //$NON-NLS-1$
726
/**
727      * Possible configurable option ID.
728      * @see #getDefaultOptions()
729      * @since 2.1
730      */

731     public static final String JavaDoc CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.cleanOutputFolder"; //$NON-NLS-1$
732
/**
733      * Possible configurable option ID.
734      * @see #getDefaultOptions()
735      * @since 3.2
736      */

737     public static final String JavaDoc CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.recreateModifiedClassFileInOutputFolder"; //$NON-NLS-1$
738
/**
739      * Possible configurable option ID.
740      * @see #getDefaultOptions()
741      * @since 2.1
742      */

743     public static final String JavaDoc CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + ".incompleteClasspath"; //$NON-NLS-1$
744
/**
745      * Possible configurable option ID.
746      * @see #getDefaultOptions()
747      * @since 2.1
748      */

749     public static final String JavaDoc CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + ".circularClasspath"; //$NON-NLS-1$
750
/**
751      * Possible configurable option ID.
752      * @see #getDefaultOptions()
753      * @since 3.0
754      */

755     public static final String JavaDoc CORE_INCOMPATIBLE_JDK_LEVEL = PLUGIN_ID + ".incompatibleJDKLevel"; //$NON-NLS-1$
756
/**
757      * Possible configurable option ID.
758      * @see #getDefaultOptions()
759      * @since 2.0
760      */

761     public static final String JavaDoc CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID + ".builder.invalidClasspath"; //$NON-NLS-1$
762
/**
763      * Possible configurable option ID.
764      * @see #getDefaultOptions()
765      * @since 2.0
766      */

767     public static final String JavaDoc CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$
768
/**
769      * Possible configurable option ID.
770      * @see #getDefaultOptions()
771      * @since 2.1
772      */

773     public static final String JavaDoc CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + ".classpath.exclusionPatterns"; //$NON-NLS-1$
774
/**
775      * Possible configurable option ID.
776      * @see #getDefaultOptions()
777      * @since 2.1
778      */

779     public static final String JavaDoc CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + ".classpath.multipleOutputLocations"; //$NON-NLS-1$
780
/**
781      * Default task tag
782      * @deprecated Use {@link #DEFAULT_TASK_TAGS} instead
783      * @since 2.1
784      */

785     public static final String JavaDoc DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$
786
/**
787      * Default task priority
788      * @deprecated Use {@link #DEFAULT_TASK_PRIORITIES} instead
789      * @since 2.1
790      */

791     public static final String JavaDoc DEFAULT_TASK_PRIORITY = "NORMAL"; //$NON-NLS-1$
792
/**
793      * Default task tag
794      * @since 3.0
795      */

796     public static final String JavaDoc DEFAULT_TASK_TAGS = "TODO,FIXME,XXX"; //$NON-NLS-1$
797
/**
798      * Default task priority
799      * @since 3.0
800      */

801     public static final String JavaDoc DEFAULT_TASK_PRIORITIES = "NORMAL,HIGH,NORMAL"; //$NON-NLS-1$
802
/**
803      * Possible configurable option ID.
804      * @see #getDefaultOptions()
805      * @since 2.0
806      * @deprecated Use {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION},
807      * {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_BRACE_POSITION_FOR_BLOCK} ,
808      * {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION},
809      * {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION},
810      * {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_BRACE_POSITION_FOR_SWITCH},
811      * {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION} instead
812      */

813     public static final String JavaDoc FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID + ".formatter.newline.openingBrace"; //$NON-NLS-1$
814
/**
815      * Possible configurable option ID.
816      * @see #getDefaultOptions()
817      * @since 2.0
818      * @deprecated Use {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT},
819      * {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT},
820      * {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT},
821      * {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT} instead.
822      */

823     public static final String JavaDoc FORMATTER_NEWLINE_CONTROL = PLUGIN_ID + ".formatter.newline.controlStatement"; //$NON-NLS-1$
824
/**
825      * Possible configurable option ID.
826      * @see #getDefaultOptions()
827      * @since 2.0
828      * @deprecated Use {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMPACT_ELSE_IF} instead
829      */

830     public static final String JavaDoc FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID + ".formatter.newline.elseIf"; //$NON-NLS-1$
831
/**
832      * Possible configurable option ID.
833      * @see #getDefaultOptions()
834      * @since 2.0
835      * @deprecated Use {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK} instead
836      */

837     public static final String JavaDoc FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID + ".formatter.newline.emptyBlock"; //$NON-NLS-1$
838
/**
839      * Possible configurable option ID.
840      * @see #getDefaultOptions()
841      * @since 2.0
842      * @deprecated Use {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE} instead
843      */

844     public static final String JavaDoc FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID + ".formatter.newline.clearAll"; //$NON-NLS-1$
845
/**
846      * Possible configurable option ID.
847      * @see #getDefaultOptions()
848      * @since 2.0
849      * @deprecated Use {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_LINE_SPLIT} instead
850      */

851     public static final String JavaDoc FORMATTER_LINE_SPLIT = PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$
852
/**
853      * Possible configurable option ID.
854      * @see #getDefaultOptions()
855      * @since 2.0
856      * @deprecated Use {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR} instead
857      */

858     public static final String JavaDoc FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID + ".formatter.style.assignment"; //$NON-NLS-1$
859
/**
860      * Possible configurable option ID.
861      * @see #getDefaultOptions()
862      * @since 2.0
863      * @deprecated Use {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_TAB_CHAR}} instead
864      */

865     public static final String JavaDoc FORMATTER_TAB_CHAR = PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$
866
/**
867      * Possible configurable option ID.
868      * @see #getDefaultOptions()
869      * @since 2.0
870      * @deprecated Use {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_TAB_SIZE} instead
871      */

872     public static final String JavaDoc FORMATTER_TAB_SIZE = PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$
873
/**
874      * Possible configurable option ID
875      * @see #getDefaultOptions()
876      * @since 2.1
877      * @deprecated Use {@link org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST} instead
878      */

879     public static final String JavaDoc FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID + ".formatter.space.castexpression"; //$NON-NLS-1$
880
/**
881      * Possible configurable option ID.
882      * @see #getDefaultOptions()
883      * @since 2.0
884      */

885     public static final String JavaDoc CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID + ".codeComplete.visibilityCheck"; //$NON-NLS-1$
886
/**
887      * Possible configurable option ID.
888      * @see #getDefaultOptions()
889      * @since 3.2
890      */

891     public static final String JavaDoc CODEASSIST_DEPRECATION_CHECK = PLUGIN_ID + ".codeComplete.deprecationCheck"; //$NON-NLS-1$
892
/**
893      * Possible configurable option ID.
894      * @see #getDefaultOptions()
895      * @since 3.2
896      */

897     public static final String JavaDoc CODEASSIST_CAMEL_CASE_MATCH = PLUGIN_ID + ".codeComplete.camelCaseMatch"; //$NON-NLS-1$
898
/**
899      * Possible configurable option ID.
900      * @see #getDefaultOptions()
901      * @since 2.0
902      */

903     public static final String JavaDoc CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID + ".codeComplete.forceImplicitQualification"; //$NON-NLS-1$
904
/**
905      * Possible configurable option ID.
906      * @see #getDefaultOptions()
907      * @since 2.1
908      */

909     public static final String JavaDoc CODEASSIST_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.fieldPrefixes"; //$NON-NLS-1$
910
/**
911      * Possible configurable option ID.
912      * @see #getDefaultOptions()
913      * @since 2.1
914      */

915     public static final String JavaDoc CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.staticFieldPrefixes"; //$NON-NLS-1$
916
/**
917      * Possible configurable option ID.
918      * @see #getDefaultOptions()
919      * @since 2.1
920      */

921     public static final String JavaDoc CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID + ".codeComplete.localPrefixes"; //$NON-NLS-1$
922
/**
923      * Possible configurable option ID.
924      * @see #getDefaultOptions()
925      * @since 2.1
926      */

927     public static final String JavaDoc CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID + ".codeComplete.argumentPrefixes"; //$NON-NLS-1$
928
/**
929      * Possible configurable option ID.
930      * @see #getDefaultOptions()
931      * @since 2.1
932      */

933     public static final String JavaDoc CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.fieldSuffixes"; //$NON-NLS-1$
934
/**
935      * Possible configurable option ID.
936      * @see #getDefaultOptions()
937      * @since 2.1
938      */

939     public static final String JavaDoc CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.staticFieldSuffixes"; //$NON-NLS-1$
940
/**
941      * Possible configurable option ID.
942      * @see #getDefaultOptions()
943      * @since 2.1
944      */

945     public static final String JavaDoc CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID + ".codeComplete.localSuffixes"; //$NON-NLS-1$
946
/**
947      * Possible configurable option ID.
948      * @see #getDefaultOptions()
949      * @since 2.1
950      */

951     public static final String JavaDoc CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID + ".codeComplete.argumentSuffixes"; //$NON-NLS-1$
952
/**
953      * Possible configurable option ID.
954      * @see #getDefaultOptions()
955      * @since 3.1
956      */

957     public static final String JavaDoc CODEASSIST_FORBIDDEN_REFERENCE_CHECK= PLUGIN_ID + ".codeComplete.forbiddenReferenceCheck"; //$NON-NLS-1$
958
/**
959      * Possible configurable option ID.
960      * @see #getDefaultOptions()
961      * @since 3.1
962      */

963     public static final String JavaDoc CODEASSIST_DISCOURAGED_REFERENCE_CHECK= PLUGIN_ID + ".codeComplete.discouragedReferenceCheck"; //$NON-NLS-1$
964
/**
965      * Possible configurable option ID.
966      * @see #getDefaultOptions()
967      * @since 3.3
968      */

969     public static final String JavaDoc CODEASSIST_SUGGEST_STATIC_IMPORTS= PLUGIN_ID + ".codeComplete.suggestStaticImports"; //$NON-NLS-1$
970
/**
971      * Possible configurable option ID.
972      * @see #getDefaultOptions()
973      * @since 3.2
974      */

975     public static final String JavaDoc TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC = PLUGIN_ID + ".timeoutForParameterNameFromAttachedJavadoc"; //$NON-NLS-1$
976

977     /**
978      * Possible configurable option value.
979      * @see #getDefaultOptions()
980      */

981     public static final String JavaDoc GENERATE = "generate"; //$NON-NLS-1$
982
/**
983      * Possible configurable option value.
984      * @see #getDefaultOptions()
985      */

986     public static final String JavaDoc DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$
987
/**
988      * Possible configurable option value.
989      * @see #getDefaultOptions()
990      */

991     public static final String JavaDoc PRESERVE = "preserve"; //$NON-NLS-1$
992
/**
993      * Possible configurable option value.
994      * @see #getDefaultOptions()
995      */

996     public static final String JavaDoc OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$
997
/**
998      * Possible configurable option value.
999      * @see #getDefaultOptions()
1000     */

1001    public static final String JavaDoc VERSION_1_1 = "1.1"; //$NON-NLS-1$
1002
/**
1003     * Possible configurable option value.
1004     * @see #getDefaultOptions()
1005     */

1006    public static final String JavaDoc VERSION_1_2 = "1.2"; //$NON-NLS-1$
1007
/**
1008     * Possible configurable option value.
1009     * @see #getDefaultOptions()
1010     * @since 2.0
1011     */

1012    public static final String JavaDoc VERSION_1_3 = "1.3"; //$NON-NLS-1$
1013
/**
1014     * Possible configurable option value.
1015     * @see #getDefaultOptions()
1016     * @since 2.0
1017     */

1018    public static final String JavaDoc VERSION_1_4 = "1.4"; //$NON-NLS-1$
1019
/**
1020     * Possible configurable option value.
1021     * @see #getDefaultOptions()
1022     * @since 3.0
1023     */

1024    public static final String JavaDoc VERSION_1_5 = "1.5"; //$NON-NLS-1$
1025
/**
1026     * Possible configurable option value.
1027     * @see #getDefaultOptions()
1028     * @since 3.2
1029     */

1030    public static final String JavaDoc VERSION_1_6 = "1.6"; //$NON-NLS-1$
1031
/**
1032     * Possible configurable option value.
1033     * @see #getDefaultOptions()
1034     * @since 3.3
1035     */

1036    public static final String JavaDoc VERSION_1_7 = "1.7"; //$NON-NLS-1$
1037
/**
1038     * Possible configurable option value.
1039     * @see #getDefaultOptions()
1040     * @since 2.0
1041     */

1042    public static final String JavaDoc ABORT = "abort"; //$NON-NLS-1$
1043
/**
1044     * Possible configurable option value.
1045     * @see #getDefaultOptions()
1046     */

1047    public static final String JavaDoc ERROR = "error"; //$NON-NLS-1$
1048
/**
1049     * Possible configurable option value.
1050     * @see #getDefaultOptions()
1051     */

1052    public static final String JavaDoc WARNING = "warning"; //$NON-NLS-1$
1053
/**
1054     * Possible configurable option value.
1055     * @see #getDefaultOptions()
1056     */

1057    public static final String JavaDoc IGNORE = "ignore"; //$NON-NLS-1$
1058
/**
1059     * Possible configurable option value.
1060     * @see #getDefaultOptions()
1061     */

1062    public static final String JavaDoc COMPUTE = "compute"; //$NON-NLS-1$
1063
/**
1064     * Possible configurable option value.
1065     * @see #getDefaultOptions()
1066     * @since 2.0
1067     */

1068    public static final String JavaDoc INSERT = "insert"; //$NON-NLS-1$
1069
/**
1070     * Possible configurable option value.
1071     * @see #getDefaultOptions()
1072     * @since 2.0
1073     */

1074    public static final String JavaDoc DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$
1075
/**
1076     * Possible configurable option value.
1077     * @see #getDefaultOptions()
1078     * @since 2.0
1079     */

1080    public static final String JavaDoc PRESERVE_ONE = "preserve one"; //$NON-NLS-1$
1081
/**
1082     * Possible configurable option value.
1083     * @see #getDefaultOptions()
1084     * @since 2.0
1085     */

1086    public static final String JavaDoc CLEAR_ALL = "clear all"; //$NON-NLS-1$
1087
/**
1088     * Possible configurable option value.
1089     * @see #getDefaultOptions()
1090     * @since 2.0
1091     */

1092    public static final String JavaDoc NORMAL = "normal"; //$NON-NLS-1$
1093
/**
1094     * Possible configurable option value.
1095     * @see #getDefaultOptions()
1096     * @since 2.0
1097     */

1098    public static final String JavaDoc COMPACT = "compact"; //$NON-NLS-1$
1099
/**
1100     * Possible configurable option value.
1101     * @see #getDefaultOptions()
1102     * @since 2.0
1103     */

1104    public static final String JavaDoc TAB = "tab"; //$NON-NLS-1$
1105
/**
1106     * Possible configurable option value.
1107     * @see #getDefaultOptions()
1108     * @since 2.0
1109     */

1110    public static final String JavaDoc SPACE = "space"; //$NON-NLS-1$
1111
/**
1112     * Possible configurable option value.
1113     * @see #getDefaultOptions()
1114     * @since 2.0
1115     */

1116    public static final String JavaDoc ENABLED = "enabled"; //$NON-NLS-1$
1117
/**
1118     * Possible configurable option value.
1119     * @see #getDefaultOptions()
1120     * @since 2.0
1121     */

1122    public static final String JavaDoc DISABLED = "disabled"; //$NON-NLS-1$
1123
/**
1124     * Possible configurable option value.
1125     * @see #getDefaultOptions()
1126     * @since 2.1
1127     */

1128    public static final String JavaDoc CLEAN = "clean"; //$NON-NLS-1$
1129
/**
1130     * Possible configurable option value.
1131     * @see #getDefaultOptions()
1132     * @since 3.0
1133     */

1134    public static final String JavaDoc PUBLIC = "public"; //$NON-NLS-1$
1135
/**
1136     * Possible configurable option value.
1137     * @see #getDefaultOptions()
1138     * @since 3.0
1139     */

1140    public static final String JavaDoc PROTECTED = "protected"; //$NON-NLS-1$
1141
/**
1142     * Possible configurable option value.
1143     * @see #getDefaultOptions()
1144     * @since 3.0
1145     */

1146    public static final String JavaDoc DEFAULT = "default"; //$NON-NLS-1$
1147
/**
1148     * Possible configurable option value.
1149     * @see #getDefaultOptions()
1150     * @since 3.0
1151     */

1152    public static final String JavaDoc PRIVATE = "private"; //$NON-NLS-1$
1153
/**
1154     * Possible configurable option value.
1155     * @see #getDefaultOptions()
1156     * @since 3.1
1157     */

1158    public static final String JavaDoc NEVER = "never"; //$NON-NLS-1$
1159

1160    /**
1161     * Value of the content-type for Java source files. Use this value to retrieve the Java content type
1162     * from the content type manager, and to add new Java-like extensions to this content type.
1163     *
1164     * @see org.eclipse.core.runtime.content.IContentTypeManager#getContentType(String)
1165     * @see #getJavaLikeExtensions()
1166     * @since 3.2
1167     */

1168    public static final String JavaDoc JAVA_SOURCE_CONTENT_TYPE = JavaCore.PLUGIN_ID+".javaSource" ; //$NON-NLS-1$
1169

1170    /**
1171     * Creates the Java core plug-in.
1172     * <p>
1173     * The plug-in instance is created automatically by the
1174     * Eclipse platform. Clients must not call.
1175     * </p>
1176     *
1177     * @since 3.0
1178     */

1179    public JavaCore() {
1180        super();
1181        JAVA_CORE_PLUGIN = this;
1182    }
1183
1184    /**
1185     * Adds the given listener for changes to Java elements.
1186     * Has no effect if an identical listener is already registered.
1187     *
1188     * This listener will only be notified during the POST_CHANGE resource change notification
1189     * and any reconcile operation (POST_RECONCILE).
1190     * For finer control of the notification, use <code>addElementChangedListener(IElementChangedListener,int)</code>,
1191     * which allows to specify a different eventMask.
1192     *
1193     * @param listener the listener
1194     * @see ElementChangedEvent
1195     */

1196    public static void addElementChangedListener(IElementChangedListener listener) {
1197        addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE);
1198    }
1199
1200    /**
1201     * Adds the given listener for changes to Java elements.
1202     * Has no effect if an identical listener is already registered.
1203     * After completion of this method, the given listener will be registered for exactly
1204     * the specified events. If they were previously registered for other events, they
1205     * will be deregistered.
1206     * <p>
1207     * Once registered, a listener starts receiving notification of changes to
1208     * java elements in the model. The listener continues to receive
1209     * notifications until it is replaced or removed.
1210     * </p>
1211     * <p>
1212     * Listeners can listen for several types of event as defined in <code>ElementChangeEvent</code>.
1213     * Clients are free to register for any number of event types however if they register
1214     * for more than one, it is their responsibility to ensure they correctly handle the
1215     * case where the same java element change shows up in multiple notifications.
1216     * Clients are guaranteed to receive only the events for which they are registered.
1217     * </p>
1218     *
1219     * @param listener the listener
1220     * @param eventMask the bit-wise OR of all event types of interest to the listener
1221     * @see IElementChangedListener
1222     * @see ElementChangedEvent
1223     * @see #removeElementChangedListener(IElementChangedListener)
1224     * @since 2.0
1225     */

1226    public static void addElementChangedListener(IElementChangedListener listener, int eventMask) {
1227        JavaModelManager.getJavaModelManager().deltaState.addElementChangedListener(listener, eventMask);
1228    }
1229
1230    /**
1231     * Configures the given marker attribute map for the given Java element.
1232     * Used for markers, which denote a Java element rather than a resource.
1233     *
1234     * @param attributes the mutable marker attribute map (key type: <code>String</code>,
1235     * value type: <code>String</code>)
1236     * @param element the Java element for which the marker needs to be configured
1237     */

1238    public static void addJavaElementMarkerAttributes(
1239        Map JavaDoc attributes,
1240        IJavaElement element) {
1241        if (element instanceof IMember)
1242            element = ((IMember) element).getClassFile();
1243        if (attributes != null && element != null)
1244            attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier());
1245    }
1246
1247    private static void addNonJavaResources(Object JavaDoc[] nonJavaResources,
1248            IContainer container,
1249            int rootPathSegmentCounts,
1250            ArrayList JavaDoc collector) {
1251        for (int i = 0, max = nonJavaResources.length; i < max; i++) {
1252            Object JavaDoc nonJavaResource = nonJavaResources[i];
1253            if (nonJavaResource instanceof IFile) {
1254                IFile file = (IFile) nonJavaResource;
1255                IPath path = file.getFullPath().removeFirstSegments(rootPathSegmentCounts);
1256                IResource member = container.findMember(path);
1257                if (member != null && member.exists()) {
1258                    collector.add(member);
1259                }
1260            } else if (nonJavaResource instanceof IFolder) {
1261                IFolder folder = (IFolder) nonJavaResource;
1262                IResource[] members = null;
1263                try {
1264                    members = folder.members();
1265                } catch (CoreException e) {
1266                    // ignore
1267
}
1268                if (members != null) {
1269                    addNonJavaResources(members, container, rootPathSegmentCounts, collector);
1270                }
1271            }
1272        }
1273    }
1274
1275    /**
1276     * Adds the given listener for POST_CHANGE resource change events to the Java core.
1277     * The listener is guaranteed to be notified of the POST_CHANGE resource change event before
1278     * the Java core starts processing the resource change event itself.
1279     * <p>
1280     * Has no effect if an identical listener is already registered.
1281     * </p>
1282     *
1283     * @param listener the listener
1284     * @see #removePreProcessingResourceChangedListener(IResourceChangeListener)
1285     * @since 3.0
1286     * @deprecated use addPreProcessingResourceChangedListener(listener, IResourceChangeEvent.POST_CHANGE) instead
1287     */

1288    public static void addPreProcessingResourceChangedListener(IResourceChangeListener listener) {
1289        addPreProcessingResourceChangedListener(listener, IResourceChangeEvent.POST_CHANGE);
1290    }
1291
1292    /**
1293     * Adds the given listener for resource change events of the given types to the Java core.
1294     * The listener is guaranteed to be notified of the resource change event before
1295     * the Java core starts processing the resource change event itself.
1296     * <p>
1297     * If an identical listener is already registered, the given event types are added to the event types
1298     * of interest to the listener.
1299     * </p>
1300     * <p>
1301     * Supported event types are:
1302     * <ul>
1303     * <li>{@link IResourceChangeEvent#PRE_BUILD}</li>
1304     * <li>{@link IResourceChangeEvent#POST_BUILD}</li>
1305     * <li>{@link IResourceChangeEvent#POST_CHANGE}</li>
1306     * <li>{@link IResourceChangeEvent#PRE_DELETE}</li>
1307     * <li>{@link IResourceChangeEvent#PRE_CLOSE}</li>
1308     * </ul>
1309     * This list may increase in the future.
1310     * </p>
1311     *
1312     * @param listener the listener
1313     * @param eventMask the bit-wise OR of all event types of interest to the
1314     * listener
1315     * @see #removePreProcessingResourceChangedListener(IResourceChangeListener)
1316     * @see IResourceChangeEvent
1317     * @since 3.2
1318     */

1319    public static void addPreProcessingResourceChangedListener(IResourceChangeListener listener, int eventMask) {
1320        JavaModelManager.getJavaModelManager().deltaState.addPreResourceChangedListener(listener, eventMask);
1321    }
1322
1323    /**
1324     * Configures the given marker for the given Java element.
1325     * Used for markers, which denote a Java element rather than a resource.
1326     *
1327     * @param marker the marker to be configured
1328     * @param element the Java element for which the marker needs to be configured
1329     * @exception CoreException if the <code>IMarker.setAttribute</code> on the marker fails
1330     */

1331    public void configureJavaElementMarker(IMarker marker, IJavaElement element)
1332        throws CoreException {
1333        if (element instanceof IMember)
1334            element = ((IMember) element).getClassFile();
1335        if (marker != null && element != null)
1336            marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier());
1337    }
1338
1339    /**
1340     * Returns the Java model element corresponding to the given handle identifier
1341     * generated by <code>IJavaElement.getHandleIdentifier()</code>, or
1342     * <code>null</code> if unable to create the associated element.
1343     *
1344     * @param handleIdentifier the given handle identifier
1345     * @return the Java element corresponding to the handle identifier
1346     */

1347    public static IJavaElement create(String JavaDoc handleIdentifier) {
1348        return create(handleIdentifier, DefaultWorkingCopyOwner.PRIMARY);
1349    }
1350
1351    /**
1352     * Returns the Java model element corresponding to the given handle identifier
1353     * generated by <code>IJavaElement.getHandleIdentifier()</code>, or
1354     * <code>null</code> if unable to create the associated element.
1355     * If the returned Java element is an <code>ICompilationUnit</code>, its owner
1356     * is the given owner if such a working copy exists, otherwise the compilation unit
1357     * is a primary compilation unit.
1358     *
1359     * @param handleIdentifier the given handle identifier
1360     * @param owner the owner of the returned compilation unit, ignored if the returned
1361     * element is not a compilation unit
1362     * @return the Java element corresponding to the handle identifier
1363     * @since 3.0
1364     */

1365    public static IJavaElement create(String JavaDoc handleIdentifier, WorkingCopyOwner owner) {
1366        if (handleIdentifier == null) {
1367            return null;
1368        }
1369        MementoTokenizer memento = new MementoTokenizer(handleIdentifier);
1370        JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
1371        return model.getHandleFromMemento(memento, owner);
1372    }
1373
1374    /**
1375     * Returns the Java element corresponding to the given file, or
1376     * <code>null</code> if unable to associate the given file
1377     * with a Java element.
1378     *
1379     * <p>The file must be one of:<ul>
1380     * <li>a file with one of the {@link JavaCore#getJavaLikeExtensions()
1381     * Java-like extensions} - the element returned is the corresponding <code>ICompilationUnit</code></li>
1382     * <li>a <code>.class</code> file - the element returned is the corresponding <code>IClassFile</code></li>
1383     * <li>a <code>.jar</code> file - the element returned is the corresponding <code>IPackageFragmentRoot</code></li>
1384     * </ul>
1385     * <p>
1386     * Creating a Java element has the side effect of creating and opening all of the
1387     * element's parents if they are not yet open.
1388     *
1389     * @param file the given file
1390     * @return the Java element corresponding to the given file, or
1391     * <code>null</code> if unable to associate the given file
1392     * with a Java element
1393     */

1394    public static IJavaElement create(IFile file) {
1395        return JavaModelManager.create(file, null/*unknown java project*/);
1396    }
1397    /**
1398     * Returns the package fragment or package fragment root corresponding to the given folder, or
1399     * <code>null</code> if unable to associate the given folder with a Java element.
1400     * <p>
1401     * Note that a package fragment root is returned rather than a default package.
1402     * <p>
1403     * Creating a Java element has the side effect of creating and opening all of the
1404     * element's parents if they are not yet open.
1405     *
1406     * @param folder the given folder
1407     * @return the package fragment or package fragment root corresponding to the given folder, or
1408     * <code>null</code> if unable to associate the given folder with a Java element
1409     */

1410    public static IJavaElement create(IFolder folder) {
1411        return JavaModelManager.create(folder, null/*unknown java project*/);
1412    }
1413    /**
1414     * Returns the Java project corresponding to the given project.
1415     * <p>
1416     * Creating a Java Project has the side effect of creating and opening all of the
1417     * project's parents if they are not yet open.
1418     * <p>
1419     * Note that no check is done at this time on the existence or the java nature of this project.
1420     *
1421     * @param project the given project
1422     * @return the Java project corresponding to the given project, null if the given project is null
1423     */

1424    public static IJavaProject create(IProject project) {
1425        if (project == null) {
1426            return null;
1427        }
1428        JavaModel javaModel = JavaModelManager.getJavaModelManager().getJavaModel();
1429        return javaModel.getJavaProject(project);
1430    }
1431    /**
1432     * Returns the Java element corresponding to the given resource, or
1433     * <code>null</code> if unable to associate the given resource
1434     * with a Java element.
1435     * <p>
1436     * The resource must be one of:<ul>
1437     * <li>a project - the element returned is the corresponding <code>IJavaProject</code></li>
1438     * <li>a file with one of the {@link JavaCore#getJavaLikeExtensions()
1439     * Java-like extensions} - the element returned is the corresponding <code>ICompilationUnit</code></li>
1440     * <li>a <code>.class</code> file - the element returned is the corresponding <code>IClassFile</code></li>
1441     * <li>a <code>.jar</code> file - the element returned is the corresponding <code>IPackageFragmentRoot</code></li>
1442     * <li>a folder - the element returned is the corresponding <code>IPackageFragmentRoot</code>
1443     * or <code>IPackageFragment</code></li>
1444     * <li>the workspace root resource - the element returned is the <code>IJavaModel</code></li>
1445     * </ul>
1446     * <p>
1447     * Creating a Java element has the side effect of creating and opening all of the
1448     * element's parents if they are not yet open.
1449     *
1450     * @param resource the given resource
1451     * @return the Java element corresponding to the given resource, or
1452     * <code>null</code> if unable to associate the given resource
1453     * with a Java element
1454     */

1455    public static IJavaElement create(IResource resource) {
1456        return JavaModelManager.create(resource, null/*unknown java project*/);
1457    }
1458    /**
1459     * Returns the Java element corresponding to the given file, its project being the given
1460     * project. Returns <code>null</code> if unable to associate the given resource
1461     * with a Java element.
1462     *<p>
1463     * The resource must be one of:<ul>
1464     * <li>a project - the element returned is the corresponding <code>IJavaProject</code></li>
1465     * <li>a file with one of the {@link JavaCore#getJavaLikeExtensions()
1466     * Java-like extensions} - the element returned is the corresponding <code>ICompilationUnit</code></li>
1467     * <li>a <code>.class</code> file - the element returned is the corresponding <code>IClassFile</code></li>
1468     * <li>a <code>.jar</code> file - the element returned is the corresponding <code>IPackageFragmentRoot</code></li>
1469     * <li>a folder - the element returned is the corresponding <code>IPackageFragmentRoot</code>
1470     * or <code>IPackageFragment</code></li>
1471     * <li>the workspace root resource - the element returned is the <code>IJavaModel</code></li>
1472     * </ul>
1473     * <p>
1474     * Creating a Java element has the side effect of creating and opening all of the
1475     * element's parents if they are not yet open.
1476     *
1477     * @param resource the given resource
1478     * @return the Java element corresponding to the given file, or
1479     * <code>null</code> if unable to associate the given file
1480     * with a Java element
1481     * @since 3.3
1482     */

1483    public static IJavaElement create(IResource resource, IJavaProject project) {
1484        return JavaModelManager.create(resource, project);
1485    }
1486    /**
1487     * Returns the Java model.
1488     *
1489     * @param root the given root
1490     * @return the Java model, or <code>null</code> if the root is null
1491     */

1492    public static IJavaModel create(IWorkspaceRoot root) {
1493        if (root == null) {
1494            return null;
1495        }
1496        return JavaModelManager.getJavaModelManager().getJavaModel();
1497    }
1498    /**
1499     * Creates and returns a class file element for
1500     * the given <code>.class</code> file. Returns <code>null</code> if unable
1501     * to recognize the class file.
1502     *
1503     * @param file the given <code>.class</code> file
1504     * @return a class file element for the given <code>.class</code> file, or <code>null</code> if unable
1505     * to recognize the class file
1506     */

1507    public static IClassFile createClassFileFrom(IFile file) {
1508        return JavaModelManager.createClassFileFrom(file, null);
1509    }
1510    /**
1511     * Creates and returns a compilation unit element for
1512     * the given source file (i.e. a file with one of the {@link JavaCore#getJavaLikeExtensions()
1513     * Java-like extensions}). Returns <code>null</code> if unable
1514     * to recognize the compilation unit.
1515     *
1516     * @param file the given source file
1517     * @return a compilation unit element for the given source file, or <code>null</code> if unable
1518     * to recognize the compilation unit
1519     */

1520    public static ICompilationUnit createCompilationUnitFrom(IFile file) {
1521        return JavaModelManager.createCompilationUnitFrom(file, null/*unknown java project*/);
1522    }
1523    /**
1524     * Creates and returns a handle for the given JAR file.
1525     * The Java model associated with the JAR's project may be
1526     * created as a side effect.
1527     *
1528     * @param file the given JAR file
1529     * @return a handle for the given JAR file, or <code>null</code> if unable to create a JAR package fragment root.
1530     * (for example, if the JAR file represents a non-Java resource)
1531     */

1532    public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file) {
1533        return JavaModelManager.createJarPackageFragmentRootFrom(file, null/*unknown java project*/);
1534    }
1535
1536    /**
1537     * Answers the project specific value for a given classpath container.
1538     * In case this container path could not be resolved, then will answer <code>null</code>.
1539     * Both the container path and the project context are supposed to be non-null.
1540     * <p>
1541     * The containerPath is a formed by a first ID segment followed with extra segments, which can be
1542     * used as additional hints for resolution. If no container was ever recorded for this container path
1543     * onto this project (using <code>setClasspathContainer</code>, then a
1544     * <code>ClasspathContainerInitializer</code> will be activated if any was registered for this container
1545     * ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
1546     * <p>
1547     * There is no assumption that the returned container must answer the exact same containerPath
1548     * when requested <code>IClasspathContainer#getPath</code>.
1549     * Indeed, the containerPath is just an indication for resolving it to an actual container object.
1550     * <p>
1551     * Classpath container values are persisted locally to the workspace, but
1552     * are not preserved from a session to another. It is thus highly recommended to register a
1553     * <code>ClasspathContainerInitializer</code> for each referenced container
1554     * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer").
1555     * <p>
1556     * @param containerPath the name of the container, which needs to be resolved
1557     * @param project a specific project in which the container is being resolved
1558     * @return the corresponding classpath container or <code>null</code> if unable to find one.
1559     *
1560     * @exception JavaModelException if an exception occurred while resolving the container, or if the resolved container
1561     * contains illegal entries (contains CPE_CONTAINER entries or null entries).
1562     *
1563     * @see ClasspathContainerInitializer
1564     * @see IClasspathContainer
1565     * @see #setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor)
1566     * @since 2.0
1567     */

1568    public static IClasspathContainer getClasspathContainer(IPath containerPath, IJavaProject project) throws JavaModelException {
1569
1570        JavaModelManager manager = JavaModelManager.getJavaModelManager();
1571        IClasspathContainer container = manager.getClasspathContainer(containerPath, project);
1572        if (container == JavaModelManager.CONTAINER_INITIALIZATION_IN_PROGRESS) {
1573            return manager.getPreviousSessionContainer(containerPath, project);
1574        }
1575        return container;
1576    }
1577
1578    /**
1579     * Helper method finding the classpath container initializer registered for a given classpath container ID
1580     * or <code>null</code> if none was found while iterating over the contributions to extension point to
1581     * the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
1582     * <p>
1583     * A containerID is the first segment of any container path, used to identify the registered container initializer.
1584     * <p>
1585     * @param containerID - a containerID identifying a registered initializer
1586     * @return ClasspathContainerInitializer - the registered classpath container initializer or <code>null</code> if
1587     * none was found.
1588     * @since 2.1
1589     */

1590    public static ClasspathContainerInitializer getClasspathContainerInitializer(String JavaDoc containerID) {
1591        HashMap JavaDoc containerInitializersCache = JavaModelManager.getJavaModelManager().containerInitializersCache;
1592        ClasspathContainerInitializer initializer = (ClasspathContainerInitializer) containerInitializersCache.get(containerID);
1593        if (initializer == null) {
1594            initializer = computeClasspathContainerInitializer(containerID);
1595            if (initializer == null)
1596                return null;
1597            containerInitializersCache.put(containerID, initializer);
1598        }
1599        return initializer;
1600    }
1601
1602    private static ClasspathContainerInitializer computeClasspathContainerInitializer(String JavaDoc containerID) {
1603        Plugin jdtCorePlugin = JavaCore.getPlugin();
1604        if (jdtCorePlugin == null) return null;
1605
1606        IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(JavaCore.PLUGIN_ID, JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID);
1607        if (extension != null) {
1608            IExtension[] extensions = extension.getExtensions();
1609            for(int i = 0; i < extensions.length; i++){
1610                IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
1611                for(int j = 0; j < configElements.length; j++){
1612                    IConfigurationElement configurationElement = configElements[j];
1613                    String JavaDoc initializerID = configurationElement.getAttribute("id"); //$NON-NLS-1$
1614
if (initializerID != null && initializerID.equals(containerID)){
1615                        if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED)
1616                            verbose_found_container_initializer(containerID, configurationElement);
1617                        try {
1618                            Object JavaDoc execExt = configurationElement.createExecutableExtension("class"); //$NON-NLS-1$
1619
if (execExt instanceof ClasspathContainerInitializer){
1620                                return (ClasspathContainerInitializer)execExt;
1621                            }
1622                        } catch(CoreException e) {
1623                            // executable extension could not be created: ignore this initializer
1624
if (JavaModelManager.CP_RESOLVE_VERBOSE) {
1625                                verbose_failed_to_instanciate_container_initializer(containerID, configurationElement);
1626                                e.printStackTrace();
1627                            }
1628                        }
1629                    }
1630                }
1631            }
1632        }
1633        return null;
1634    }
1635
1636    private static void verbose_failed_to_instanciate_container_initializer(String JavaDoc containerID, IConfigurationElement configurationElement) {
1637        Util.verbose(
1638            "CPContainer INIT - failed to instanciate initializer\n" + //$NON-NLS-1$
1639
" container ID: " + containerID + '\n' + //$NON-NLS-1$
1640
" class: " + configurationElement.getAttribute("class"), //$NON-NLS-1$ //$NON-NLS-2$
1641
System.err);
1642    }
1643
1644    private static void verbose_found_container_initializer(String JavaDoc containerID, IConfigurationElement configurationElement) {
1645        Util.verbose(
1646            "CPContainer INIT - found initializer\n" + //$NON-NLS-1$
1647
" container ID: " + containerID + '\n' + //$NON-NLS-1$
1648
" class: " + configurationElement.getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$
1649
}
1650
1651    /**
1652     * Returns the path held in the given classpath variable.
1653     * Returns <code>null</code> if unable to bind.
1654     * <p>
1655     * Classpath variable values are persisted locally to the workspace, and
1656     * are preserved from session to session.
1657     * <p>
1658     * Note that classpath variables can be contributed registered initializers for,
1659     * using the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
1660     * If an initializer is registered for a variable, its persisted value will be ignored:
1661     * its initializer will thus get the opportunity to rebind the variable differently on
1662     * each session.
1663     *
1664     * @param variableName the name of the classpath variable
1665     * @return the path, or <code>null</code> if none
1666     * @see #setClasspathVariable(String, IPath)
1667     */

1668    public static IPath getClasspathVariable(final String JavaDoc variableName) {
1669
1670        JavaModelManager manager = JavaModelManager.getJavaModelManager();
1671        IPath variablePath = manager.variableGet(variableName);
1672        if (variablePath == JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS){
1673            return manager.getPreviousSessionVariable(variableName);
1674        }
1675
1676        if (variablePath != null) {
1677            if (variablePath == JavaModelManager.CP_ENTRY_IGNORE_PATH)
1678                return null;
1679            return variablePath;
1680        }
1681
1682        // even if persisted value exists, initializer is given priority, only if no initializer is found the persisted value is reused
1683
final ClasspathVariableInitializer initializer = JavaCore.getClasspathVariableInitializer(variableName);
1684        if (initializer != null){
1685            if (JavaModelManager.CP_RESOLVE_VERBOSE)
1686                verbose_triggering_variable_initialization(variableName, initializer);
1687            if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED)
1688                verbose_triggering_variable_initialization_invocation_trace();
1689            manager.variablePut(variableName, JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS); // avoid initialization cycles
1690
boolean ok = false;
1691            try {
1692                // let OperationCanceledException go through
1693
// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59363)
1694
initializer.initialize(variableName);
1695
1696                variablePath = manager.variableGet(variableName); // initializer should have performed side-effect
1697
if (variablePath == JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS) return null; // break cycle (initializer did not init or reentering call)
1698
if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED)
1699                    verbose_variable_value_after_initialization(variableName, variablePath);
1700                manager.variablesWithInitializer.add(variableName);
1701                ok = true;
1702            } catch (RuntimeException JavaDoc e) {
1703                if (JavaModelManager.CP_RESOLVE_VERBOSE)
1704                    e.printStackTrace();
1705                throw e;
1706            } catch (Error JavaDoc e) {
1707                if (JavaModelManager.CP_RESOLVE_VERBOSE)
1708                    e.printStackTrace();
1709                throw e;
1710            } finally {
1711                if (!ok) JavaModelManager.getJavaModelManager().variablePut(variableName, null); // flush cache
1712
}
1713        } else {
1714            if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED)
1715                verbose_no_variable_initializer_found(variableName);
1716        }
1717        return variablePath;
1718    }
1719
1720    private static void verbose_no_variable_initializer_found(String JavaDoc variableName) {
1721        Util.verbose(
1722            "CPVariable INIT - no initializer found\n" + //$NON-NLS-1$
1723
" variable: " + variableName); //$NON-NLS-1$
1724
}
1725
1726    private static void verbose_variable_value_after_initialization(String JavaDoc variableName, IPath variablePath) {
1727        Util.verbose(
1728            "CPVariable INIT - after initialization\n" + //$NON-NLS-1$
1729
" variable: " + variableName +'\n' + //$NON-NLS-1$
1730
" variable path: " + variablePath); //$NON-NLS-1$
1731
}
1732
1733    private static void verbose_triggering_variable_initialization(String JavaDoc variableName, ClasspathVariableInitializer initializer) {
1734        Util.verbose(
1735            "CPVariable INIT - triggering initialization\n" + //$NON-NLS-1$
1736
" variable: " + variableName + '\n' + //$NON-NLS-1$
1737
" initializer: " + initializer); //$NON-NLS-1$
1738
}
1739
1740    private static void verbose_triggering_variable_initialization_invocation_trace() {
1741        Util.verbose(
1742            "CPVariable INIT - triggering initialization\n" + //$NON-NLS-1$
1743
" invocation trace:"); //$NON-NLS-1$
1744
new Exception JavaDoc("<Fake exception>").printStackTrace(System.out); //$NON-NLS-1$
1745
}
1746
1747    /**
1748     * Returns deprecation message of a given classpath variable.
1749     *
1750     * @param variableName
1751     * @return A string if the classpath variable is deprecated, <code>null</code> otherwise.
1752     * @since 3.3
1753     */

1754    public static String JavaDoc getClasspathVariableDeprecationMessage(String JavaDoc variableName) {
1755        return (String JavaDoc) JavaModelManager.getJavaModelManager().deprecatedVariables.get(variableName);
1756    }
1757
1758    /**
1759     * Helper method finding the classpath variable initializer registered for a given classpath variable name
1760     * or <code>null</code> if none was found while iterating over the contributions to extension point to
1761     * the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
1762     * <p>
1763     * @param variable the given variable
1764     * @return ClasspathVariableInitializer - the registered classpath variable initializer or <code>null</code> if
1765     * none was found.
1766     * @since 2.1
1767     */

1768    public static ClasspathVariableInitializer getClasspathVariableInitializer(String JavaDoc variable){
1769
1770        Plugin jdtCorePlugin = JavaCore.getPlugin();
1771        if (jdtCorePlugin == null) return null;
1772
1773        IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(JavaCore.PLUGIN_ID, JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID);
1774        if (extension != null) {
1775            IExtension[] extensions = extension.getExtensions();
1776            for(int i = 0; i < extensions.length; i++){
1777                IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
1778                for(int j = 0; j < configElements.length; j++){
1779                    IConfigurationElement configElement = configElements[j];
1780                    try {
1781                        String JavaDoc varAttribute = configElement.getAttribute("variable"); //$NON-NLS-1$
1782
if (variable.equals(varAttribute)) {
1783                            if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED)
1784                                verbose_found_variable_initializer(variable, configElement);
1785                            Object JavaDoc execExt = configElement.createExecutableExtension("class"); //$NON-NLS-1$
1786
if (execExt instanceof ClasspathVariableInitializer){
1787                                ClasspathVariableInitializer initializer = (ClasspathVariableInitializer)execExt;
1788                                String JavaDoc deprecatedAttribute = configElement.getAttribute("deprecated"); //$NON-NLS-1$
1789
if (deprecatedAttribute != null) {
1790                                    JavaModelManager.getJavaModelManager().deprecatedVariables.put(variable, deprecatedAttribute);
1791                                }
1792                                String JavaDoc readOnlyAttribute = configElement.getAttribute("readOnly"); //$NON-NLS-1$
1793
if (JavaModelManager.TRUE.equals(readOnlyAttribute)) {
1794                                    JavaModelManager.getJavaModelManager().readOnlyVariables.add(variable);
1795                                }
1796                                return initializer;
1797                            }
1798                        }
1799                    } catch(CoreException e){
1800                        // executable extension could not be created: ignore this initializer
1801
if (JavaModelManager.CP_RESOLVE_VERBOSE) {
1802                            verbose_failed_to_instanciate_variable_initializer(variable, configElement);
1803                            e.printStackTrace();
1804                        }
1805                    }
1806                }
1807            }
1808        }
1809        return null;
1810    }
1811
1812    private static void verbose_failed_to_instanciate_variable_initializer(String JavaDoc variable, IConfigurationElement configElement) {
1813        Util.verbose(
1814            "CPContainer INIT - failed to instanciate initializer\n" + //$NON-NLS-1$
1815
" variable: " + variable + '\n' + //$NON-NLS-1$
1816
" class: " + configElement.getAttribute("class"), //$NON-NLS-1$ //$NON-NLS-2$
1817
System.err);
1818    }
1819
1820    private static void verbose_found_variable_initializer(String JavaDoc variable, IConfigurationElement configElement) {
1821        Util.verbose(
1822            "CPVariable INIT - found initializer\n" + //$NON-NLS-1$
1823
" variable: " + variable + '\n' + //$NON-NLS-1$
1824
" class: " + configElement.getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$
1825
}
1826
1827    /**
1828     * Returns the names of all known classpath variables.
1829     * <p>
1830     * Classpath variable values are persisted locally to the workspace, and
1831     * are preserved from session to session.
1832     * <p>
1833     *
1834     * @return the list of classpath variable names
1835     * @see #setClasspathVariable(String, IPath)
1836     */

1837    public static String JavaDoc[] getClasspathVariableNames() {
1838        return JavaModelManager.getJavaModelManager().variableNames();
1839    }
1840
1841    /**
1842     * Returns a table of all known configurable options with their default values.
1843     * These options allow to configure the behaviour of the underlying components.
1844     * The client may safely use the result as a template that they can modify and
1845     * then pass to <code>setOptions</code>.
1846     *
1847     * Helper constants have been defined on JavaCore for each of the option ID and
1848     * their possible constant values.
1849     *
1850     * Note: more options might be added in further releases.
1851     * <pre>
1852     * RECOGNIZED OPTIONS:
1853     *
1854     * COMPILER / Setting Compliance Level
1855     * Select the compliance level for the compiler. In "1.3" mode, source and target settings
1856     * should not go beyond "1.3" level.
1857     * - option id: "org.eclipse.jdt.core.compiler.compliance"
1858     * - possible values: { "1.3", "1.4", "1.5", "1.6", "1.7" }
1859     * - default: "1.4"
1860     *
1861     * COMPILER / Setting Source Compatibility Mode
1862     * Specify whether which source level compatibility is used. From 1.4 on, 'assert' is a keyword
1863     * reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
1864     * level should be set to "1.4" and the compliance mode should be "1.4".
1865     * Source level 1.5 is necessary to enable generics, autoboxing, covariance, annotations, enumerations
1866     * enhanced for loop, static imports and varargs. Once toggled, the target VM level should be set to "1.5"
1867     * and the compliance mode should be "1.5".
1868     * Source level 1.6 is necessary to enable the computation of stack map tables. Once toggled, the target
1869     * VM level should be set to "1.6" and the compliance mode should be "1.6".
1870     * Once the source level 1.7 is toggled, the target VM level should be set to "1.7" and the compliance mode
1871     * should be "1.7".
1872     * - option id: "org.eclipse.jdt.core.compiler.source"
1873     * - possible values: { "1.3", "1.4", "1.5", "1.6", "1.7" }
1874     * - default: "1.3"
1875     *
1876     * COMPILER / Defining Target Java Platform
1877     * For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
1878     * Note that "1.4" target requires to toggle compliance mode to "1.4", "1.5" target requires
1879     * to toggle compliance mode to "1.5", "1.6" target requires to toggle compliance mode to "1.6" and
1880     * "1.7" target requires to toggle compliance mode to "1.7".
1881     * - option id: "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
1882     * - possible values: { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7" }
1883     * - default: "1.2"
1884     *
1885     * COMPILER / Generating Local Variable Debug Attribute
1886     * When generated, this attribute will enable local variable names
1887     * to be displayed in debugger, only in place where variables are
1888     * definitely assigned (.class file is then bigger)
1889     * - option id: "org.eclipse.jdt.core.compiler.debug.localVariable"
1890     * - possible values: { "generate", "do not generate" }
1891     * - default: "generate"
1892     *
1893     * COMPILER / Generating Line Number Debug Attribute
1894     * When generated, this attribute will enable source code highlighting in debugger
1895     * (.class file is then bigger).
1896     * - option id: "org.eclipse.jdt.core.compiler.debug.lineNumber"
1897     * - possible values: { "generate", "do not generate" }
1898     * - default: "generate"
1899     *
1900     * COMPILER / Generating Source Debug Attribute
1901     * When generated, this attribute will enable the debugger to present the
1902     * corresponding source code.
1903     * - option id: "org.eclipse.jdt.core.compiler.debug.sourceFile"
1904     * - possible values: { "generate", "do not generate" }
1905     * - default: "generate"
1906     *
1907     * COMPILER / Preserving Unused Local Variables
1908     * Unless requested to preserve unused local variables (that is, never read), the
1909     * compiler will optimize them out, potentially altering debugging
1910     * - option id: "org.eclipse.jdt.core.compiler.codegen.unusedLocal"
1911     * - possible values: { "preserve", "optimize out" }
1912     * - default: "preserve"
1913     *
1914     * COMPILER / Inline JSR Bytecode Instruction
1915     * When enabled, the compiler will no longer generate JSR instructions, but rather inline corresponding
1916     * subroutine code sequences (mostly corresponding to try finally blocks). The generated code will thus
1917     * get bigger, but will load faster on virtual machines since the verification process is then much simpler.
1918     * This mode is anticipating support for the Java Specification Request 202.
1919     * Note that JSR inlining is optional only for target platform lesser than 1.5. From 1.5 on, the JSR
1920     * inlining is mandatory (also see related setting "org.eclipse.jdt.core.compiler.codegen.targetPlatform").
1921     * - option id: "org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode"
1922     * - possible values: { "enabled", "disabled" }
1923     * - default: "disabled"
1924     *
1925     * COMPILER / Javadoc Comment Support
1926     * When this support is disabled, the compiler will ignore all javadoc problems options settings
1927     * and will not report any javadoc problem. It will also not find any reference in javadoc comment and
1928     * DOM AST Javadoc node will be only a flat text instead of having structured tag elements.
1929     * - option id: "org.eclipse.jdt.core.compiler.doc.comment.support"
1930     * - possible values: { "enabled", "disabled" }
1931     * - default: "enabled"
1932     *
1933     * COMPILER / Reporting Attempt to Override Package-Default Method
1934     * A package default method is not visible in a different package, and thus
1935     * cannot be overridden. When enabling this option, the compiler will signal
1936     * such scenarii either as an error or a warning.
1937     * - option id: "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod"
1938     * - possible values: { "error", "warning", "ignore" }
1939     * - default: "warning"
1940     *
1941     * COMPILER / Reporting Method With Constructor Name
1942     * Naming a method with a constructor name is generally considered poor
1943     * style programming. When enabling this option, the compiler will signal such
1944     * scenarii either as an error or a warning.
1945     * - option id: "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName"
1946     * - possible values: { "error", "warning", "ignore" }
1947     * - default: "warning"
1948     *
1949     * COMPILER / Reporting Deprecation
1950     * When enabled, the compiler will signal use of deprecated API either as an
1951     * error or a warning.
1952     * - option id: "org.eclipse.jdt.core.compiler.problem.deprecation"
1953     * - possible values: { "error", "warning", "ignore" }
1954     * - default: "warning"
1955     *
1956     * COMPILER / Reporting Deprecation Inside Deprecated Code
1957     * When enabled, the compiler will signal use of deprecated API inside deprecated code.
1958     * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
1959     * - option id: "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode"
1960     * - possible values: { "enabled", "disabled" }
1961     * - default: "disabled"
1962     *
1963     * COMPILER / Reporting Deprecation When Overriding Deprecated Method
1964     * When enabled, the compiler will signal the declaration of a method overriding a deprecated one.
1965     * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
1966     * - option id: "org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod"
1967     * - possible values: { "enabled", "disabled" }
1968     * - default: "disabled"
1969     *
1970     * COMPILER / Reporting Hidden Catch Block
1971     * Locally to a try statement, some catch blocks may hide others . For example,
1972     * try { throw new java.io.CharConversionException();
1973     * } catch (java.io.CharConversionException e) {
1974     * } catch (java.io.IOException e) {}.
1975     * When enabling this option, the compiler will issue an error or a warning for hidden
1976     * catch blocks corresponding to checked exceptions
1977     * - option id: "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock"
1978     * - possible values: { "error", "warning", "ignore" }
1979     * - default: "warning"
1980     *
1981     * COMPILER / Reporting Unused Local
1982     * When enabled, the compiler will issue an error or a warning for unused local
1983     * variables (that is, variables never read from)
1984     * - option id: "org.eclipse.jdt.core.compiler.problem.unusedLocal"
1985     * - possible values: { "error", "warning", "ignore" }
1986     * - default: "ignore"
1987     *
1988     * COMPILER / Reporting Unused Parameter
1989     * When enabled, the compiler will issue an error or a warning for unused method
1990     * parameters (that is, parameters never read from)
1991     * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameter"
1992     * - possible values: { "error", "warning", "ignore" }
1993     * - default: "ignore"
1994     *
1995     * COMPILER / Reporting Unused Parameter if Implementing Abstract Method
1996     * When enabled, the compiler will signal unused parameters in abstract method implementations.
1997     * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
1998     * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
1999     * - possible values: { "enabled", "disabled" }
2000     * - default: "disabled"
2001     *
2002     * COMPILER / Reporting Unused Parameter if Overriding Concrete Method
2003     * When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
2004     * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
2005     * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
2006     * - possible values: { "enabled", "disabled" }
2007     * - default: "disabled"
2008     *
2009     * COMPILER / Consider Reference in Doc Comment for Unused Parameter Check
2010     * When enabled, the compiler will consider doc comment references to parameters (i.e. @param clauses) for the unused
2011     * parameter check. Thus, documented parameters will be considered as mandated as per doc contract.
2012     * The severity of the unused parameter problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
2013     * Note: this option has no effect until the doc comment support is enabled according to the
2014     * option "org.eclipse.jdt.core.compiler.doc.comment.support".
2015     * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocReference"
2016     * - possible values: { "enabled", "disabled" }
2017     * - default: "enabled"
2018     *
2019     * COMPILER / Reporting Unused Import
2020     * When enabled, the compiler will issue an error or a warning for unused import
2021     * reference
2022     * - option id: "org.eclipse.jdt.core.compiler.problem.unusedImport"
2023     * - possible values: { "error", "warning", "ignore" }
2024     * - default: "warning"
2025     *
2026     * COMPILER / Reporting Unused Private Members
2027     * When enabled, the compiler will issue an error or a warning whenever a private
2028     * method or field is declared but never used within the same unit.
2029     * - option id: "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember"
2030     * - possible values: { "error", "warning", "ignore" }
2031     * - default: "ignore"
2032     *
2033     * COMPILER / Reporting Assignment with no Effect
2034     * When enabled, the compiler will issue an error or a warning whenever an assignment
2035     * has no effect (e.g 'x = x').
2036     * - option id: "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"
2037     * - possible values: { "error", "warning", "ignore" }
2038     * - default: "warning"
2039     *
2040     * COMPILER / Reporting Empty Statements and Unnecessary Semicolons
2041     * When enabled, the compiler will issue an error or a warning if an empty statement or a
2042     * unnecessary semicolon is encountered.
2043     * - option id: "org.eclipse.jdt.core.compiler.problem.emptyStatement"
2044     * - possible values: { "error", "warning", "ignore" }
2045     * - default: "ignore"
2046     *
2047     * COMPILER / Reporting Unnecessary Type Check
2048     * When enabled, the compiler will issue an error or a warning when a cast or an instanceof operation
2049     * is unnecessary.
2050     * - option id: "org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck"
2051     * - possible values: { "error", "warning", "ignore" }
2052     * - default: "ignore"
2053     *
2054     * COMPILER / Reporting Unnecessary Else
2055     * When enabled, the compiler will issue an error or a warning when a statement is unnecessarily
2056     * nested within an else clause (in situation where then clause is not completing normally).
2057     * - option id: "org.eclipse.jdt.core.compiler.problem.unnecessaryElse"
2058     * - possible values: { "error", "warning", "ignore" }
2059     * - default: "ignore"
2060     *
2061     * COMPILER / Reporting Synthetic Access Emulation
2062     * When enabled, the compiler will issue an error or a warning whenever it emulates
2063     * access to a non-accessible member of an enclosing type. Such access can have
2064     * performance implications.
2065     * - option id: "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"
2066     * - possible values: { "error", "warning", "ignore" }
2067     * - default: "ignore"
2068     *
2069     * COMPILER / Reporting Non-Externalized String Literal
2070     * When enabled, the compiler will issue an error or a warning for non externalized
2071     * String literal (that is, not tagged with //$NON-NLS-&lt;n&gt;$).
2072     * - option id: "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral"
2073     * - possible values: { "error", "warning", "ignore" }
2074     * - default: "ignore"
2075     *
2076     * COMPILER / Reporting Usage of 'assert' Identifier
2077     * When enabled, the compiler will issue an error or a warning whenever 'assert' is
2078     * used as an identifier (reserved keyword in 1.4)
2079     * - option id: "org.eclipse.jdt.core.compiler.problem.assertIdentifier"
2080     * - possible values: { "error", "warning", "ignore" }
2081     * - default: "warning"
2082     *
2083     * COMPILER / Reporting Usage of 'enum' Identifier
2084     * When enabled, the compiler will issue an error or a warning whenever 'enum' is
2085     * used as an identifier (reserved keyword in 1.5)
2086     * - option id: "org.eclipse.jdt.core.compiler.problem.enumIdentifier"
2087     * - possible values: { "error", "warning", "ignore" }
2088     * - default: "warning"
2089     *
2090     * COMPILER / Reporting Non-Static Reference to a Static Member
2091     * When enabled, the compiler will issue an error or a warning whenever a static field
2092     * or method is accessed with an expression receiver. A reference to a static member should
2093     * be qualified with a type name.
2094     * - option id: "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver"
2095     * - possible values: { "error", "warning", "ignore" }
2096     * - default: "warning"
2097     *
2098     * COMPILER / Reporting Indirect Reference to a Static Member
2099     * When enabled, the compiler will issue an error or a warning whenever a static field
2100     * or method is accessed in an indirect way. A reference to a static member should
2101     * preferably be qualified with its declaring type name.
2102     * - option id: "org.eclipse.jdt.core.compiler.problem.indirectStaticAccess"
2103     * - possible values: { "error", "warning", "ignore" }
2104     * - default: "ignore"
2105     *
2106     * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
2107     * When enabled, the compiler will issue an error or a warning whenever an interface
2108     * defines a method incompatible with a non-inherited Object method. Until this conflict
2109     * is resolved, such an interface cannot be implemented, For example,
2110     * interface I {
2111     * int clone();
2112     * }
2113     * - option id: "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
2114     * - possible values: { "error", "warning", "ignore" }
2115     * - default: "warning"
2116     *
2117     * COMPILER / Reporting Usage of char[] Expressions in String Concatenations
2118     * When enabled, the compiler will issue an error or a warning whenever a char[] expression
2119     * is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
2120     * - option id: "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion"
2121     * - possible values: { "error", "warning", "ignore" }
2122     * - default: "warning"
2123     *
2124     * COMPILER / Reporting Local Variable Declaration Hiding another Variable
2125     * When enabled, the compiler will issue an error or a warning whenever a local variable
2126     * declaration is hiding some field or local variable (either locally, inherited or defined in enclosing type).
2127     * - option id: "org.eclipse.jdt.core.compiler.problem.localVariableHiding"
2128     * - possible values: { "error", "warning", "ignore" }
2129     * - default: "ignore"
2130     *
2131     * COMPILER / Reporting Field Declaration Hiding another Variable
2132     * When enabled, the compiler will issue an error or a warning whenever a field
2133     * declaration is hiding some field or local variable (either locally, inherited or defined in enclosing type).
2134     * - option id: "org.eclipse.jdt.core.compiler.problem.fieldHiding"
2135     * - possible values: { "error", "warning", "ignore" }
2136     * - default: "ignore"
2137     *
2138     * COMPILER / Reporting Special Parameter Hiding another Field
2139     * When enabled, the compiler will signal cases where a constructor or setter method parameter declaration
2140     * is hiding some field (either locally, inherited or defined in enclosing type).
2141     * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.localVariableHiding".
2142     * - option id: "org.eclipse.jdt.core.compiler.problem.specialParameterHidingField"
2143     * - possible values: { "enabled", "disabled" }
2144     * - default: "disabled"
2145     *
2146     * COMPILER / Reporting Type Declaration Hiding another Type
2147     * When enabled, the compiler will issue an error or a warning in situations where a type parameter
2148     * declaration is hiding some type, when a nested type is hiding some type parameter, or when
2149     * a nested type is hiding another nested type defined in same unit.
2150     * - option id: "org.eclipse.jdt.core.compiler.problem.typeParameterHiding"
2151     * - possible values: { "error", "warning", "ignore" }
2152     * - default: "warning"
2153     *
2154     * COMPILER / Reporting Possible Accidental Boolean Assignment
2155     * When enabled, the compiler will issue an error or a warning if a boolean assignment is acting as the condition
2156     * of a control statement (where it probably was meant to be a boolean comparison).
2157     * - option id: "org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment"
2158     * - possible values: { "error", "warning", "ignore" }
2159     * - default: "ignore"
2160     *
2161     * COMPILER / Reporting Undocumented Empty Block
2162     * When enabled, the compiler will issue an error or a warning when an empty block is detected and it is not
2163     * documented with any comment.
2164     * - option id: "org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock"
2165     * - possible values: { "error", "warning", "ignore" }
2166     * - default: "ignore"
2167     *
2168     * COMPILER / Reporting Finally Blocks Not Completing Normally
2169     * When enabled, the compiler will issue an error or a warning when a finally block does not complete normally.
2170     * - option id: "org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally"
2171     * - possible values: { "error", "warning", "ignore" }
2172     * - default: "warning"
2173     *
2174     * COMPILER / Reporting Unused Declared Thrown Exception
2175     * When enabled, the compiler will issue an error or a warning when a method or a constructor is declaring a
2176     * thrown checked exception, but never actually raises it in its body.
2177     * - option id: "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException"
2178     * - possible values: { "error", "warning", "ignore" }
2179     * - default: "ignore"
2180     *
2181     * COMPILER / Reporting Unused Declared Thrown Exception in Overridind Method
2182     * When disabled, the compiler will not include overriding methods in its diagnosis for unused declared
2183     * thrown exceptions.
2184     * <br>
2185     * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException".
2186     * - option id: "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding"
2187     * - possible values: { "enabled", "disabled" }
2188     * - default: "disabled"
2189     *
2190     * COMPILER / Reporting Unqualified Access to Field
2191     * When enabled, the compiler will issue an error or a warning when a field is access without any qualification.
2192     * In order to improve code readability, it should be qualified, e.g. 'x' should rather be written 'this.x'.
2193     * - option id: "org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess"
2194     * - possible values: { "error", "warning", "ignore" }
2195     * - default: "ignore"
2196     *
2197     * COMPILER / Reporting Unchecked Type Operation
2198     * When enabled, the compiler will issue an error or a warning whenever an operation involves generic types, and potentially
2199     * invalidates type safety since involving raw types (e.g. invoking #foo(X&lt;String&gt;) with arguments (X)).
2200     * - option id: "org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation"
2201     * - possible values: { "error", "warning", "ignore" }
2202     * - default: "warning"
2203     *
2204     * COMPILER / Reporting Raw Type Reference
2205     * When enabled, the compiler will issue an error or a warning when detecting references to raw types. Raw types are
2206     * discouraged, and are intended to help interfacing with legacy code. In the future, the language specification may
2207     * reject raw references to generic types.
2208     * - option id: "org.eclipse.jdt.core.compiler.problem.rawTypeReference"
2209     * - possible values: { "error", "warning", "ignore" }
2210     * - default: "warning"
2211     *
2212     * COMPILER / Reporting final Bound for Type Parameter
2213     * When enabled, the compiler will issue an error or a warning whenever a generic type parameter is associated with a
2214     * bound corresponding to a final type; since final types cannot be further extended, the parameter is pretty useless.
2215     * - option id: "org.eclipse.jdt.core.compiler.problem.finalParameterBound"
2216     * - possible values: { "error", "warning", "ignore" }
2217     * - default: "warning"
2218     *
2219     * COMPILER / Reporting Missing Declaration of serialVersionUID Field on Serializable Class
2220     * When enabled, the compiler will issue an error or a warning whenever a serializable class is missing a local declaration
2221     * of a serialVersionUID field. This field must be declared as static final and be of type long.
2222     * - option id: "org.eclipse.jdt.core.compiler.problem.missingSerialVersion"
2223     * - possible values: { "error", "warning", "ignore" }
2224     * - default: "warning"
2225     *
2226     * COMPILER / Reporting Varargs Argument Needing a Cast in Method/Constructor Invocation
2227     * When enabled, the compiler will issue an error or a warning whenever a varargs arguments should be cast
2228     * when passed to a method/constructor invocation. (e.g. Class.getMethod(String name, Class ... args )
2229     * invoked with arguments ("foo", null)).
2230     * - option id: "org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast"
2231     * - possible values: { "error", "warning", "ignore" }
2232     * - default: "warning"
2233     *
2234     * COMPILER / Reporting Null Dereference
2235     * When enabled, the compiler will issue an error or a warning whenever a
2236     * variable that is statically known to hold a null value is used to
2237     * access a field or method.
2238     *
2239     * - option id: "org.eclipse.jdt.core.compiler.problem.nullReference"
2240     * - possible values: { "error", "warning", "ignore" }
2241     * - default: "ignore"
2242     *
2243     * COMPILER / Reporting Potential Null Dereference
2244     * When enabled, the compiler will issue an error or a warning whenever a
2245     * variable that has formerly been tested against null but is not (no more)
2246     * statically known to hold a non-null value is used to access a field or
2247     * method.
2248     *
2249     * - option id: "org.eclipse.jdt.core.compiler.problem.potentialNullReference"
2250     * - possible values: { "error", "warning", "ignore" }
2251     * - default: "ignore"
2252     *
2253     * COMPILER / Reporting Redundant Null Check
2254     * When enabled, the compiler will issue an error or a warning whenever a
2255     * variable that is statically known to hold a null or a non-null value
2256     * is tested against null.
2257     *
2258     * - option id: "org.eclipse.jdt.core.compiler.problem.redundantNullCheck"
2259     * - possible values: { "error", "warning", "ignore" }
2260     * - default: "ignore"
2261     *
2262     * COMPILER / Reporting Use of Annotation Type as Super Interface
2263     * When enabled, the compiler will issue an error or a warning whenever an annotation type is used
2264     * as a super-interface. Though legal, this is discouraged.
2265     * - option id: "org.eclipse.jdt.core.compiler.problem.annotationSuperInterface"
2266     * - possible values: { "error", "warning", "ignore" }
2267     * - default: "warning"
2268     *
2269     * COMPILER / Reporting Missing @Override Annotation
2270     * When enabled, the compiler will issue an error or a warning whenever encountering a method
2271     * declaration which overrides a superclass method but has no @Override annotation.
2272     * - option id: "org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation"
2273     * - possible values: { "error", "warning", "ignore" }
2274     * - default: "ignore"
2275     *
2276     * COMPILER / Reporting Missing @Deprecated Annotation
2277     * When enabled, the compiler will issue an error or a warning whenever encountering a declaration
2278     * carrying a @deprecated doc tag but having no corresponding @Deprecated annotation.
2279     * - option id: "org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation"
2280     * - possible values: { "error", "warning", "ignore" }
2281     * - default: "ignore"
2282     *
2283     * COMPILER / Reporting Incomplete Enum Switch
2284     * When enabled, the compiler will issue an error or a warning whenever
2285     * an enum constant has no corresponding case label in an enum switch
2286     * statement.
2287     * - option id: "org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch"
2288     * - possible values: { "error", "warning", "ignore" }
2289     * - default: "ignore"
2290     *
2291     * COMPILER / Reporting Boxing/Unboxing Conversion
2292     * When enabled, the compiler will issue an error or a warning whenever a boxing or an unboxing
2293     * conversion is performed.
2294     * - option id: "org.eclipse.jdt.core.compiler.problem.autoboxing"
2295     * - possible values: { "error", "warning", "ignore" }
2296     * - default: "ignore"
2297     *
2298     * COMPILER / Reporting Invalid Javadoc Comment
2299     * This is the generic control for the severity of Javadoc problems.
2300     * When enabled, the compiler will issue an error or a warning for a problem in Javadoc.
2301     * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadoc"
2302     * - possible values: { "error", "warning", "ignore" }
2303     * - default: "ignore"
2304     *
2305     * COMPILER / Visibility Level For Invalid Javadoc Tags
2306     * Set the minimum visibility level for Javadoc tag problems. Below this level problems will be ignored.
2307     * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility"
2308     * - possible values: { "public", "protected", "default", "private" }
2309     * - default: "public"
2310     *
2311     * COMPILER / Reporting Invalid Javadoc Tags
2312     * When enabled, the compiler will signal unbound or unexpected reference tags in Javadoc.
2313     * A 'throws' tag referencing an undeclared exception would be considered as unexpected.
2314     * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc;
2315     * also see the setting "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility".
2316     * <br>
2317     * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.invalidJavadoc".
2318     * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTags"
2319     * - possible values: { "disabled", "enabled" }
2320     * - default: "disabled"
2321     *
2322     * COMPILER / Reporting Invalid Javadoc Tags with Deprecated References
2323     * Specify whether the compiler will report deprecated references used in Javadoc tags.
2324     * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc;
2325     * also see the setting "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility".
2326     * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef"
2327     * - possible values: { "enabled", "disabled" }
2328     * - default: "disabled"
2329     *
2330     * COMPILER / Reporting Invalid Javadoc Tags with Not Visible References
2331     * Specify whether the compiler will report non-visible references used in Javadoc tags.
2332     * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc;
2333     * also see the setting "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility".
2334     * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef"
2335     * - possible values: { "enabled", "disabled" }
2336     * - default: "disabled"
2337     *
2338     * COMPILER / Reporting Missing Javadoc Tags
2339     * This is the generic control for the severity of Javadoc missing tag problems.
2340     * When enabled, the compiler will issue an error or a warning when tags are missing in Javadoc comments.
2341     * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc;
2342     * also see the setting "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility".
2343     * <br>
2344     * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTags"
2345     * - possible values: { "error", "warning", "ignore" }
2346     * - default: "ignore"
2347     *
2348     * COMPILER / Visibility Level For Missing Javadoc Tags
2349     * Set the minimum visibility level for Javadoc missing tag problems. Below this level problems will be ignored.
2350     * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility"
2351     * - possible values: { "public", "protected", "default", "private" }
2352     * - default: "public"
2353     *
2354     * COMPILER / Reporting Missing Javadoc Tags on Overriding Methods
2355     * Specify whether the compiler will verify overriding methods in order to report Javadoc missing tag problems.
2356     * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding"
2357     * - possible values: { "enabled", "disabled" }
2358     * - default: "disabled"
2359     *
2360     * COMPILER / Reporting Missing Javadoc Comments
2361     * This is the generic control for the severity of missing Javadoc comment problems.
2362     * When enabled, the compiler will issue an error or a warning when Javadoc comments are missing.
2363     * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the expected Javadoc;
2364     * also see the setting "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility".
2365     * <br>
2366     * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocComments"
2367     * - possible values: { "error", "warning", "ignore" }
2368     * - default: "ignore"
2369     *
2370     * COMPILER / Visibility Level For Missing Javadoc Comments
2371     * Set the minimum visibility level for missing Javadoc problems. Below this level problems will be ignored.
2372     * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility"
2373     * - possible values: { "public", "protected", "default", "private" }
2374     * - default: "public"
2375     *
2376     * COMPILER / Reporting Missing Javadoc Comments on Overriding Methods
2377     * Specify whether the compiler will verify overriding methods in order to report missing Javadoc comment problems.
2378     * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding"
2379     * - possible values: { "enabled", "disabled" }
2380     * - default: "disabled"
2381     *
2382     * COMPILER / Maximum Number of Problems Reported per Compilation Unit
2383     * Specify the maximum number of problems reported on each compilation unit.
2384     * - option id: "org.eclipse.jdt.core.compiler.maxProblemPerUnit"
2385     * - possible values: "&lt;n&gt;" where &lt;n&gt; is zero or a positive integer (if zero then all problems are reported).
2386     * - default: "100"
2387     *
2388     * COMPILER / Treating Optional Error as Fatal
2389     * When enabled, optional errors (i.e. optional problems which severity is set to "error") will be treated as standard
2390     * compiler errors, yielding problem methods/types preventing from running offending code until the issue got resolved.
2391     * When disabled, optional errors are only considered as warnings, still carrying an error indication to make them more
2392     * severe. Note that by default, errors are fatal, whether they are optional or not.
2393     * - option id: "org.eclipse.jdt.core.compiler.problem.fatalOptionalError"
2394     * - possible values: { "enabled", "disabled" }
2395     * - default: "enabled"
2396     *
2397     * COMPILER / Defining the Automatic Task Tags
2398     * When the tag list is not empty, the compiler will issue a task marker whenever it encounters
2399     * one of the corresponding tags inside any comment in Java source code.
2400     * Generated task messages will start with the tag, and range until the next line separator,
2401     * comment ending, or tag.
2402     * When a given line of code bears multiple tags, each tag will be reported separately.
2403     * Moreover, a tag immediately followed by another tag will be reported using the contents of the
2404     * next non-empty tag of the line, if any.
2405     * Note that tasks messages are trimmed. If a tag is starting with a letter or digit, then it cannot be leaded by
2406     * another letter or digit to be recognized ("fooToDo" will not be recognized as a task for tag "ToDo", but "foo#ToDo"
2407     * will be detected for either tag "ToDo" or "#ToDo"). Respectively, a tag ending with a letter or digit cannot be followed
2408     * by a letter or digit to be recognized ("ToDofoo" will not be recognized as a task for tag "ToDo", but "ToDo:foo" will
2409     * be detected either for tag "ToDo" or "ToDo:").
2410     * - option id: "org.eclipse.jdt.core.compiler.taskTags"
2411     * - possible values: { "&lt;tag&gt;[,&lt;tag&gt;]*" } where &lt;tag&gt; is a String without any wild-card or leading/trailing spaces
2412     * - default: "TODO,FIXME,XXX"
2413     *
2414     * COMPILER / Defining the Automatic Task Priorities
2415     * In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
2416     * of the task markers issued by the compiler.
2417     * If the default is specified, the priority of each task marker is "NORMAL".
2418     * - option id: "org.eclipse.jdt.core.compiler.taskPriorities"
2419     * - possible values: { "&lt;priority&gt;[,&lt;priority&gt;]*" } where &lt;priority&gt; is one of "HIGH", "NORMAL" or "LOW"
2420     * - default: "NORMAL,HIGH,NORMAL"
2421     *
2422     * COMPILER / Determining whether task tags are case-sensitive
2423     * When enabled, task tags are considered in a case-sensitive way.
2424     * - option id: "org.eclipse.jdt.core.compiler.taskCaseSensitive"
2425     * - possible values: { "enabled", "disabled" }
2426     * - default: "enabled"
2427     *
2428     * COMPILER / Reporting Forbidden Reference to Type with Restricted Access
2429     * When enabled, the compiler will issue an error or a warning when referring to a type that is non accessible, as defined according
2430     * to the access rule specifications.
2431     * - option id: "org.eclipse.jdt.core.compiler.problem.forbiddenReference"
2432     * - possible values: { "error", "warning", "ignore" }
2433     * - default: "warning"
2434     *
2435     * COMPILER / Reporting Discouraged Reference to Type with Restricted Access
2436     * When enabled, the compiler will issue an error or a warning when referring to a type with discouraged access, as defined according
2437     * to the access rule specifications.
2438     * - option id: "org.eclipse.jdt.core.compiler.problem.discouragedReference"
2439     * - possible values: { "error", "warning", "ignore" }
2440     * - default: "warning"
2441     *
2442     * COMPILER / Determining Effect of @SuppressWarnings
2443     * When enabled, the @SuppressWarnings annotation can be used to suppress some compiler warnings.
2444     * When disabled, all @SupressWarnings annotations are ignored; i.e., warnings are reported.
2445     * - option id: "org.eclipse.jdt.core.compiler.problem.suppressWarnings"
2446     * - possible values: { "enabled", "disabled" }
2447     * - default: "enabled"
2448     *
2449     * COMPILER / Reporting Unhandled Warning Token for @SuppressWarnings
2450     * When enabled, the compiler will issue an error or a warning when encountering a token
2451     * it cannot handle inside a @SuppressWarnings annotation.
2452     * - option id: "org.eclipse.jdt.core.compiler.problem.unhandledWarningToken"
2453     * - possible values: { "error", "warning", "ignore" }
2454     * - default: "warning"
2455     *
2456     * COMPILER / Reporting Unreferenced Label
2457     * When enabled, the compiler will issue an error or a warning when encountering a labeled statement which label
2458     * is never explicitly referenced. A label is considered to be referenced if its name explicitly appears behind a break
2459     * or continue statement; for instance the following label would be considered unreferenced; LABEL: { break; }
2460     * - option id: "org.eclipse.jdt.core.compiler.problem.unusedLabel"
2461     * - possible values: { "error", "warning", "ignore" }
2462     * - default: "warning"
2463     *
2464     * COMPILER / Reporting Parameter Assignment
2465     * When enabled, the compiler will issue an error or a warning if a parameter is
2466     * assigned to.
2467     * - option id: "org.eclipse.jdt.core.compiler.problem.parameterAssignment"
2468     * - possible values: { "error", "warning", "ignore" }
2469     * - default: "ignore"
2470     *
2471     * COMPILER / Reporting Switch Fall-Through Case
2472     * When enabled, the compiler will issue an error or a warning if a case may be
2473     * entered by falling through previous case. Empty cases are allowed.
2474     * - option id: "org.eclipse.jdt.core.compiler.problem.fallthroughCase"
2475     * - possible values: { "error", "warning", "ignore" }
2476     * - default: "ignore"
2477     *
2478     * COMPILER / Reporting Overriding method that doesn't call the super method invocation
2479     * When enabled, the compiler will issue an error or a warning if a method is overriding a method without calling
2480     * the super invocation.
2481     * - option id: "org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation"
2482     * - possible values: { "error", "warning", "ignore" }
2483     * - default: "ignore"
2484     *
2485     * BUILDER / Specifying Filters for Resource Copying Control
2486     * Allow to specify some filters to control the resource copy process.
2487     * - option id: "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter"
2488     * - possible values: { "&lt;name&gt;[,&lt;name&gt;]* } where &lt;name&gt; is a file name pattern (* and ? wild-cards allowed)
2489     * or the name of a folder which ends with '/'
2490     * - default: ""
2491     *
2492     * BUILDER / Abort if Invalid Classpath
2493     * Allow to toggle the builder to abort if the classpath is invalid
2494     * - option id: "org.eclipse.jdt.core.builder.invalidClasspath"
2495     * - possible values: { "abort", "ignore" }
2496     * - default: "abort"
2497     *
2498     * BUILDER / Cleaning Output Folder(s)
2499     * Indicate whether the JavaBuilder is allowed to clean the output folders
2500     * when performing full build operations.
2501     * - option id: "org.eclipse.jdt.core.builder.cleanOutputFolder"
2502     * - possible values: { "clean", "ignore" }
2503     * - default: "clean"
2504     *
2505     * BUILDER / Recreate Modified class files in Output Folder
2506     * Indicate whether the JavaBuilder should check for any changes to .class files
2507     * in the output folders while performing incremental build operations. If changes
2508     * are detected to managed .class files, then a full build is performed, otherwise
2509     * the changes are left as is. Tools further altering generated .class files, like optimizers,
2510     * should ensure this option remains set in its default state of ignore.
2511     * - option id: "org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder"
2512     * - possible values: { "enabled", "ignore" }
2513     * - default: "ignore"
2514     *
2515     * BUILDER / Reporting Duplicate Resources
2516     * Indicate the severity of the problem reported when more than one occurrence
2517     * of a resource is to be copied into the output location.
2518     * - option id: "org.eclipse.jdt.core.builder.duplicateResourceTask"
2519     * - possible values: { "error", "warning" }
2520     * - default: "warning"
2521     *
2522     * JAVACORE / Computing Project Build Order
2523     * Indicate whether JavaCore should enforce the project build order to be based on
2524     * the classpath prerequisite chain. When requesting to compute, this takes over
2525     * the platform default order (based on project references).
2526     * - option id: "org.eclipse.jdt.core.computeJavaBuildOrder"
2527     * - possible values: { "compute", "ignore" }
2528     * - default: "ignore"
2529     *
2530     * JAVACORE / Default Source Encoding Format
2531     * Get the default encoding format of source files. This value is
2532     * immutable and preset to the result of ResourcesPlugin.getEncoding().
2533     * It is offered as a convenience shortcut only.
2534     * - option id: "org.eclipse.jdt.core.encoding"
2535     * - value: &lt;immutable, platform default value&gt;
2536     *
2537     * JAVACORE / Reporting Incomplete Classpath
2538     * Indicate the severity of the problem reported when an entry on the classpath does not exist,
2539     * is not legite or is not visible (for example, a referenced project is closed).
2540     * - option id: "org.eclipse.jdt.core.incompleteClasspath"
2541     * - possible values: { "error", "warning"}
2542     * - default: "error"
2543     *
2544     * JAVACORE / Reporting Classpath Cycle
2545     * Indicate the severity of the problem reported when a project is involved in a cycle.
2546     * - option id: "org.eclipse.jdt.core.circularClasspath"
2547     * - possible values: { "error", "warning" }
2548     * - default: "error"
2549     *
2550     * JAVACORE / Reporting Incompatible JDK Level for Required Binaries
2551     * Indicate the severity of the problem reported when a project prerequisites another project
2552     * or library with an incompatible target JDK level (e.g. project targeting 1.1 vm, but compiled against 1.4 libraries).
2553     * - option id: "org.eclipse.jdt.core.incompatibleJDKLevel"
2554     * - possible values: { "error", "warning", "ignore" }
2555     * - default: "ignore"
2556     *
2557     * JAVACORE / Enabling Usage of Classpath Exclusion Patterns
2558     * When disabled, no entry on a project classpath can be associated with
2559     * an exclusion pattern.
2560     * - option id: "org.eclipse.jdt.core.classpath.exclusionPatterns"
2561     * - possible values: { "enabled", "disabled" }
2562     * - default: "enabled"
2563     *
2564     * JAVACORE / Enabling Usage of Classpath Multiple Output Locations
2565     * When disabled, no entry on a project classpath can be associated with
2566     * a specific output location, preventing thus usage of multiple output locations.
2567     * - option id: "org.eclipse.jdt.core.classpath.multipleOutputLocations"
2568     * - possible values: { "enabled", "disabled" }
2569     * - default: "enabled"
2570     *
2571     * JAVACORE / Set the timeout value for retrieving the method's parameter names from javadoc
2572     * Timeout in milliseconds to retrieve the method's parameter names from javadoc.
2573     * If the value is 0, the parameter names are not fetched and the raw names are returned.
2574     * - option id: "org.eclipse.jdt.core.timeoutForParameterNameFromAttachedJavadoc"
2575     * - possible values: "&lt;n&gt;", where n is an integer greater than or equal to 0
2576     * - default: "50"
2577     *
2578     * DEPRECATED SEE DefaultCodeFormatterOptions: FORMATTER / Inserting New Line Before Opening Brace
2579     * When Insert, a new line is inserted before an opening brace, otherwise nothing
2580     * is inserted
2581     * - option id: "org.eclipse.jdt.core.formatter.newline.openingBrace"
2582     * - possible values: { "insert", "do not insert" }
2583     * - default: "do not insert"
2584     *
2585     * DEPRECATED SEE DefaultCodeFormatterOptions: FORMATTER / Inserting New Line Inside Control Statement
2586     * When Insert, a new line is inserted between } and following else, catch, finally
2587     * - option id: "org.eclipse.jdt.core.formatter.newline.controlStatement"
2588     * - possible values: { "insert", "do not insert" }
2589     * - default: "do not insert"
2590     *
2591     * DEPRECATED SEE DefaultCodeFormatterOptions: Clearing Blank Lines
2592     * When Clear all, all blank lines are removed. When Preserve one, only one is kept
2593     * and all others removed.
2594     * - option id: "org.eclipse.jdt.core.formatter.newline.clearAll"
2595     * - possible values: { "clear all", "preserve one" }
2596     * - default: "preserve one"
2597     *
2598     * DEPRECATED SEE DefaultCodeFormatterOptions: Inserting New Line Between Else/If
2599     * When Insert, a blank line is inserted between an else and an if when they are
2600     * contiguous. When choosing to not insert, else-if will be kept on the same
2601     * line when possible.
2602     * - option id: "org.eclipse.jdt.core.formatter.newline.elseIf"
2603     * - possible values: { "insert", "do not insert" }
2604     * - default: "do not insert"
2605     *
2606     * DEPRECATED SEE DefaultCodeFormatterOptions: Inserting New Line In Empty Block
2607     * When insert, a line break is inserted between contiguous { and }, if } is not followed
2608     * by a keyword.
2609     * - option id: "org.eclipse.jdt.core.formatter.newline.emptyBlock"
2610     * - possible values: { "insert", "do not insert" }
2611     * - default: "insert"
2612     *
2613     * DEPRECATED SEE DefaultCodeFormatterOptions: Splitting Lines Exceeding Length
2614     * Enable splitting of long lines (exceeding the configurable length). Length of 0 will
2615     * disable line splitting
2616     * - option id: "org.eclipse.jdt.core.formatter.lineSplit"
2617     * - possible values: "&lt;n&gt;", where n is zero or a positive integer
2618     * - default: "80"
2619     *
2620     * DEPRECATED SEE DefaultCodeFormatterOptions: Compacting Assignment
2621     * Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
2622     * is inserted before the assignment operator
2623     * - option id: "org.eclipse.jdt.core.formatter.style.assignment"
2624     * - possible values: { "compact", "normal" }
2625     * - default: "normal"
2626     *
2627     * DEPRECATED SEE DefaultCodeFormatterOptions: Defining Indentation Character
2628     * Either choose to indent with tab characters or spaces
2629     * - option id: "org.eclipse.jdt.core.formatter.tabulation.char"
2630     * - possible values: { "tab", "space" }
2631     * - default: "tab"
2632     *
2633     * DEPRECATED SEE DefaultCodeFormatterOptions: Defining Space Indentation Length
2634     * When using spaces, set the amount of space characters to use for each
2635     * indentation mark.
2636     * - option id: "org.eclipse.jdt.core.formatter.tabulation.size"
2637     * - possible values: "&lt;n&gt;", where n is a positive integer
2638     * - default: "4"
2639     *
2640     * DEPRECATED SEE DefaultCodeFormatterOptions: Inserting space in cast expression
2641     * When Insert, a space is added between the type and the expression in a cast expression.
2642     * - option id: "org.eclipse.jdt.core.formatter.space.castexpression"
2643     * - possible values: { "insert", "do not insert" }
2644     * - default: "insert"
2645     *
2646     * CODEASSIST / Activate Visibility Sensitive Completion
2647     * When active, completion doesn't show that you can not see
2648     * (for example, you can not see private methods of a super class).
2649     * - option id: "org.eclipse.jdt.core.codeComplete.visibilityCheck"
2650     * - possible values: { "enabled", "disabled" }
2651     * - default: "disabled"
2652     *
2653     * CODEASSIST / Activate Deprecation Sensitive Completion
2654     * When enabled, completion doesn't propose deprecated members and types.
2655     * - option id: "org.eclipse.jdt.core.codeComplete.deprecationCheck"
2656     * - possible values: { "enabled", "disabled" }
2657     * - default: "disabled"
2658     *
2659     * CODEASSIST / Automatic Qualification of Implicit Members
2660     * When active, completion automatically qualifies completion on implicit
2661     * field references and message expressions.
2662     * - option id: "org.eclipse.jdt.core.codeComplete.forceImplicitQualification"
2663     * - possible values: { "enabled", "disabled" }
2664     * - default: "disabled"
2665     *
2666     * CODEASSIST / Define the Prefixes for Field Name
2667     * When the prefixes is non empty, completion for field name will begin with
2668     * one of the proposed prefixes.
2669     * - option id: "org.eclipse.jdt.core.codeComplete.fieldPrefixes"
2670     * - possible values: { "&lt;prefix&gt;[,&lt;prefix&gt;]*" } where &lt;prefix&gt; is a String without any wild-card
2671     * - default: ""
2672     *
2673     * CODEASSIST / Define the Prefixes for Static Field Name
2674     * When the prefixes is non empty, completion for static field name will begin with
2675     * one of the proposed prefixes.
2676     * - option id: "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes"
2677     * - possible values: { "&lt;prefix&gt;[,&lt;prefix&gt;]*" } where &lt;prefix&gt; is a String without any wild-card
2678     * - default: ""
2679     *
2680     * CODEASSIST / Define the Prefixes for Local Variable Name
2681     * When the prefixes is non empty, completion for local variable name will begin with
2682     * one of the proposed prefixes.
2683     * - option id: "org.eclipse.jdt.core.codeComplete.localPrefixes"
2684     * - possible values: { "&lt;prefix&gt;[,&lt;prefix&gt;]*" } where &lt;prefix&gt; is a String without any wild-card
2685     * - default: ""
2686     *
2687     * CODEASSIST / Define the Prefixes for Argument Name
2688     * When the prefixes is non empty, completion for argument name will begin with
2689     * one of the proposed prefixes.
2690     * - option id: "org.eclipse.jdt.core.codeComplete.argumentPrefixes"
2691     * - possible values: { "&lt;prefix&gt;[,&lt;prefix&gt;]*" } where &lt;prefix&gt; is a String without any wild-card
2692     * - default: ""
2693     *
2694     * CODEASSIST / Define the Suffixes for Field Name
2695     * When the suffixes is non empty, completion for field name will end with
2696     * one of the proposed suffixes.
2697     * - option id: "org.eclipse.jdt.core.codeComplete.fieldSuffixes"
2698     * - possible values: { "&lt;suffix&gt;[,&lt;suffix&gt;]*" } where &lt;suffix&gt; is a String without any wild-card
2699     * - default: ""
2700     *
2701     * CODEASSIST / Define the Suffixes for Static Field Name
2702     * When the suffixes is non empty, completion for static field name will end with
2703     * one of the proposed suffixes.
2704     * - option id: "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes"
2705     * - possible values: { "&lt;suffix&gt;[,&lt;suffix&gt;]*" } where &lt;suffix&gt; is a String without any wild-card
2706     * - default: ""
2707     *
2708     * CODEASSIST / Define the Suffixes for Local Variable Name
2709     * When the suffixes is non empty, completion for local variable name will end with
2710     * one of the proposed suffixes.
2711     * - option id: "org.eclipse.jdt.core.codeComplete.localSuffixes"
2712     * - possible values: { "&lt;suffix&gt;[,&lt;suffix&gt;]*" } where &lt;suffix&gt; is a String without any wild-card
2713     * - default: ""
2714     *
2715     * CODEASSIST / Define the Suffixes for Argument Name
2716     * When the suffixes is non empty, completion for argument name will end with
2717     * one of the proposed suffixes.
2718     * - option id: "org.eclipse.jdt.core.codeComplete.argumentSuffixes"
2719     * - possible values: { "&lt;suffix&gt;[,&lt;suffix&gt;]*" } where &lt;suffix&gt; is a String without any wild-card
2720     * - default: ""
2721     *
2722     * CODEASSIST / Activate Forbidden Reference Sensitive Completion
2723     * When enabled, completion doesn't propose elements which match a
2724     * forbidden reference rule.
2725     * - option id: "org.eclipse.jdt.core.codeComplete.forbiddenReferenceCheck"
2726     * - possible values: { "enabled", "disabled" }
2727     * - default: "enabled"
2728     *
2729     * CODEASSIST / Activate Discouraged Reference Sensitive Completion
2730     * When enabled, completion doesn't propose elements which match a
2731     * discouraged reference rule.
2732     * - option id: "org.eclipse.jdt.core.codeComplete.discouragedReferenceCheck"
2733     * - possible values: { "enabled", "disabled" }
2734     * - default: "disabled"
2735     *
2736     * CODEASSIST / Activate Camel Case Sensitive Completion
2737     * When enabled, completion shows proposals whose name match the CamelCase
2738     * pattern.
2739     * - option id: "org.eclipse.jdt.core.codeComplete.camelCaseMatch"
2740     * - possible values: { "enabled", "disabled" }
2741     * - default: "enabled"
2742     *
2743     * CODEASSIST / Activate Suggestion of Static Import
2744     * When enabled, completion proposals can contain static import
2745     * pattern.
2746     * - option id: "org.eclipse.jdt.core.codeComplete.suggestStaticImports"
2747     * - possible values: { "enabled", "disabled" }
2748     * - default: "enabled"
2749     * </pre>
2750     */

2751    public static Hashtable JavaDoc getDefaultOptions(){
2752        return JavaModelManager.getJavaModelManager().getDefaultOptions();
2753    }
2754
2755    /**
2756     * Returns the workspace root default charset encoding.
2757     *
2758     * @return the name of the default charset encoding for workspace root.
2759     * @see IContainer#getDefaultCharset()
2760     * @see ResourcesPlugin#getEncoding()
2761     * @since 3.0
2762     */

2763    public static String JavaDoc getEncoding() {
2764        // Verify that workspace is not shutting down (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=60687)
2765
IWorkspace workspace = ResourcesPlugin.getWorkspace();
2766        if (workspace != null) {
2767            try {
2768                return workspace.getRoot().getDefaultCharset();
2769            } catch (CoreException e) {
2770                // fails silently and return plugin global encoding if core exception occurs
2771
}
2772        }
2773        return ResourcesPlugin.getEncoding();
2774    }
2775
2776    /**
2777     * Returns an array that contains the resources generated by the Java builder when building the
2778     * compilation units contained in the given region.
2779     * <p>The contents of the array is accurate only if the elements of the given region have been built.</p>
2780     * <p>The given region can contain instances of:</p>
2781     * <ul>
2782     * <li><code>org.eclipse.jdt.core.ICompilationUnit</code></li>
2783     * <li><code>org.eclipse.jdt.core.IPackageFragment</code></li>
2784     * <li><code>org.eclipse.jdt.core.IPackageFragmentRoot</code></li>
2785     * <li><code>org.eclipse.jdt.core.IJavaProject</code></li>
2786     * </ul>
2787     * <p>All other types of <code>org.eclipse.jdt.core.IJavaElement</code> are ignored.</p>
2788     *
2789     * @param region the given region
2790     * @param includesNonJavaResources a flag that indicates if non-java resources should be included
2791     *
2792     * @return an array that contains the resources generated by the Java builder when building the
2793     * compilation units contained in the given region, an empty array if none
2794     * @exception IllegalArgumentException if the given region is <code>null</code>
2795     * @since 3.3
2796     */

2797    public static IResource[] getGeneratedResources(IRegion region, boolean includesNonJavaResources) {
2798        if (region == null) throw new IllegalArgumentException JavaDoc("region cannot be null"); //$NON-NLS-1$
2799
IJavaElement[] elements = region.getElements();
2800        HashMap JavaDoc projectsStates = new HashMap JavaDoc();
2801        ArrayList JavaDoc collector = new ArrayList JavaDoc();
2802        for (int i = 0, max = elements.length; i < max; i++) {
2803            // collect all the java project
2804
IJavaElement element = elements[i];
2805            IJavaProject javaProject = element.getJavaProject();
2806            IProject project = javaProject.getProject();
2807            State state = null;
2808            State currentState = (State) projectsStates.get(project);
2809            if (currentState != null) {
2810                state = currentState;
2811            } else {
2812                state = (State) JavaModelManager.getJavaModelManager().getLastBuiltState(project, null);
2813                if (state != null) {
2814                    projectsStates.put(project, state);
2815                }
2816            }
2817            if (state == null) continue;
2818            if (element.getElementType() == IJavaElement.JAVA_PROJECT) {
2819                IPackageFragmentRoot[] roots = null;
2820                try {
2821                    roots = javaProject.getPackageFragmentRoots();
2822                } catch (JavaModelException e) {
2823                    // ignore
2824
}
2825                if (roots == null) continue;
2826                IRegion region2 = JavaCore.newRegion();
2827                for (int j = 0; j < roots.length; j++) {
2828                    region2.add(roots[j]);
2829                }
2830                IResource[] res = getGeneratedResources(region2, includesNonJavaResources);
2831                for (int j = 0, max2 = res.length; j < max2; j++) {
2832                    collector.add(res[j]);
2833                }
2834                continue;
2835            }
2836            IPath outputLocation = null;
2837            try {
2838                outputLocation = javaProject.getOutputLocation();
2839            } catch (JavaModelException e) {
2840                // ignore
2841
}
2842            IJavaElement root = element;
2843            while (root != null && root.getElementType() != IJavaElement.PACKAGE_FRAGMENT_ROOT) {
2844                root = root.getParent();
2845            }
2846            if (root == null) continue;
2847            IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) root;
2848            int rootPathSegmentCounts = packageFragmentRoot.getPath().segmentCount();
2849            try {
2850                IClasspathEntry entry = packageFragmentRoot.getRawClasspathEntry();
2851                IPath entryOutputLocation = entry.getOutputLocation();
2852                if (entryOutputLocation != null) {
2853                    outputLocation = entryOutputLocation;
2854                }
2855            } catch (JavaModelException e) {
2856                e.printStackTrace();
2857            }
2858            if (outputLocation == null) continue;
2859            IContainer container = (IContainer) project.getWorkspace().getRoot().findMember(outputLocation);
2860            switch(element.getElementType()) {
2861                case IJavaElement.COMPILATION_UNIT :
2862                    // get the .class files generated when this element was built
2863
ICompilationUnit unit = (ICompilationUnit) element;
2864                    getGeneratedResource(unit, container, state, rootPathSegmentCounts, collector);
2865                    break;
2866                case IJavaElement.PACKAGE_FRAGMENT :
2867                    // collect all the .class files generated when all the units in this package were built
2868
IPackageFragment fragment = (IPackageFragment) element;
2869                    ICompilationUnit[] compilationUnits = null;
2870                    try {
2871                        compilationUnits = fragment.getCompilationUnits();
2872                    } catch (JavaModelException e) {
2873                        // ignore
2874
}
2875                    if (compilationUnits == null) continue;
2876                    for (int j = 0, max2 = compilationUnits.length; j < max2; j++) {
2877                        getGeneratedResource(compilationUnits[j], container, state, rootPathSegmentCounts, collector);
2878                    }
2879                    if (includesNonJavaResources) {
2880                        // retrieve all non-java resources from the output location using the package fragment path
2881
Object JavaDoc[] nonJavaResources = null;
2882                        try {
2883                            nonJavaResources = fragment.getNonJavaResources();
2884                        } catch (JavaModelException e) {
2885                            // ignore
2886
}
2887                        if (nonJavaResources != null) {
2888                            addNonJavaResources(nonJavaResources, container, rootPathSegmentCounts, collector);
2889                        }
2890                    }
2891                    break;
2892                case IJavaElement.PACKAGE_FRAGMENT_ROOT :
2893                    // collect all the .class files generated when all the units in this package were built
2894
IPackageFragmentRoot fragmentRoot = (IPackageFragmentRoot) element;
2895                    if (fragmentRoot.isArchive()) continue;
2896                    IJavaElement[] children = null;
2897                    try {
2898                        children = fragmentRoot.getChildren();
2899                    } catch (JavaModelException e) {
2900                        // ignore
2901
}
2902                    if (children == null) continue;
2903                    for (int j = 0, max2 = children.length; j < max2; j++) {
2904                        fragment = (IPackageFragment) children[j];
2905                        ICompilationUnit[] units = null;
2906                        try {
2907                            units = fragment.getCompilationUnits();
2908                        } catch (JavaModelException e) {
2909                            // ignore
2910
}
2911                        if (units == null) continue;
2912                        for (int n = 0, max3 = units.length; n < max3; n++) {
2913                            getGeneratedResource(units[n], container, state, rootPathSegmentCounts, collector);
2914                        }
2915                        if (includesNonJavaResources) {
2916                            // retrieve all non-java resources from the output location using the package fragment path
2917
Object JavaDoc[] nonJavaResources = null;
2918                            try {
2919                                nonJavaResources = fragment.getNonJavaResources();
2920                            } catch (JavaModelException e) {
2921                                // ignore
2922
}
2923                            if (nonJavaResources != null) {
2924                                addNonJavaResources(nonJavaResources, container, rootPathSegmentCounts, collector);
2925                            }
2926                        }
2927                    }
2928                    break;
2929            }
2930        }
2931        int size = collector.size();
2932        if (size != 0) {
2933            IResource[] result = new IResource[size];
2934            collector.toArray(result);
2935            return result;
2936        }
2937        return NO_GENERATED_RESOURCES;
2938    }
2939
2940    private static void getGeneratedResource(ICompilationUnit unit,
2941            IContainer container,
2942            State state,
2943            int rootPathSegmentCounts,
2944            ArrayList JavaDoc collector) {
2945        IResource resource = unit.getResource();
2946        char[][] typeNames = state.getDefinedTypeNamesFor(resource.getProjectRelativePath().toString());
2947        if (typeNames != null) {
2948            IPath path = unit.getPath().removeFirstSegments(rootPathSegmentCounts).removeLastSegments(1);
2949            for (int j = 0, max2 = typeNames.length; j < max2; j++) {
2950                IPath localPath = path.append(new String JavaDoc(typeNames[j]) + ".class"); //$NON-NLS-1$
2951
IResource member = container.findMember(localPath);
2952                if (member != null && member.exists()) {
2953                    collector.add(member);
2954                }
2955            }
2956        } else {
2957            IPath path = unit.getPath().removeFirstSegments(rootPathSegmentCounts).removeLastSegments(1);
2958            path = path.append(Util.getNameWithoutJavaLikeExtension(unit.getElementName()) + ".class"); //$NON-NLS-1$
2959
IResource member = container.findMember(path);
2960            if (member != null && member.exists()) {
2961                collector.add(member);
2962            }
2963        }
2964    }
2965
2966    /**
2967     * Returns the single instance of the Java core plug-in runtime class.
2968     * Equivalent to <code>(JavaCore) getPlugin()</code>.
2969     *
2970     * @return the single instance of the Java core plug-in runtime class
2971     */

2972    public static JavaCore getJavaCore() {
2973        return (JavaCore) getPlugin();
2974    }
2975
2976    /**
2977     * Returns the list of known Java-like extensions.
2978     * Java like extension are defined in the {@link org.eclipse.core.runtime.Platform#getContentTypeManager()
2979     * content type manager} for the {@link #JAVA_SOURCE_CONTENT_TYPE}.
2980     * Note that a Java-like extension doesn't include the leading dot ('.').
2981     * Also note that the "java" extension is always defined as a Java-like extension.
2982     *
2983     * @return the list of known Java-like extensions.
2984     * @since 3.2
2985     */

2986    public static String JavaDoc[] getJavaLikeExtensions() {
2987        return CharOperation.toStrings(Util.getJavaLikeExtensions());
2988    }
2989
2990    /**
2991     * Helper method for returning one option value only. Equivalent to <code>(String)JavaCore.getOptions().get(optionName)</code>
2992     * Note that it may answer <code>null</code> if this option does not exist.
2993     * <p>
2994     * For a complete description of the configurable options, see <code>getDefaultOptions</code>.
2995     * </p>
2996     *
2997     * @param optionName the name of an option
2998     * @return the String value of a given option
2999     * @see JavaCore#getDefaultOptions()
3000     * @see JavaCorePreferenceInitializer for changing default settings
3001     * @since 2.0
3002     */

3003    public static String JavaDoc getOption(String JavaDoc optionName) {
3004        return JavaModelManager.getJavaModelManager().getOption(optionName);
3005    }
3006
3007    /**
3008     * Returns the table of the current options. Initially, all options have their default values,
3009     * and this method returns a table that includes all known options.
3010     * <p>For a complete description of the configurable options, see <code>getDefaultOptions</code>.</p>
3011     * <p>Returns a default set of options even if the platform is not running.</p>
3012     *
3013     * @return table of current settings of all options
3014     * (key type: <code>String</code>; value type: <code>String</code>)
3015     * @see #getDefaultOptions()
3016     * @see JavaCorePreferenceInitializer for changing default settings
3017     */

3018    public static Hashtable JavaDoc getOptions() {
3019        return JavaModelManager.getJavaModelManager().getOptions();
3020    }
3021
3022    /**
3023     * Returns the single instance of the Java core plug-in runtime class.
3024     *
3025     * @return the single instance of the Java core plug-in runtime class
3026     */

3027    public static Plugin getPlugin() {
3028        return JAVA_CORE_PLUGIN;
3029    }
3030
3031    /**
3032     * This is a helper method, which returns the resolved classpath entry denoted
3033     * by a given entry (if it is a variable entry). It is obtained by resolving the variable
3034     * reference in the first segment. Returns <code>null</code> if unable to resolve using
3035     * the following algorithm:
3036     * <ul>
3037     * <li> if variable segment cannot be resolved, returns <code>null</code></li>
3038     * <li> finds a project, JAR or binary folder in the workspace at the resolved path location</li>
3039     * <li> if none finds an external JAR file or folder outside the workspace at the resolved path location </li>
3040     * <li> if none returns <code>null</code></li>
3041     * </ul>
3042     * <p>
3043     * Variable source attachment path and root path are also resolved and recorded in the resulting classpath entry.
3044     * <p>
3045     * NOTE: This helper method does not handle classpath containers, for which should rather be used
3046     * <code>JavaCore#getClasspathContainer(IPath, IJavaProject)</code>.
3047     * <p>
3048     *
3049     * @param entry the given variable entry
3050     * @return the resolved library or project classpath entry, or <code>null</code>
3051     * if the given variable entry could not be resolved to a valid classpath entry
3052     */

3053    public static IClasspathEntry getResolvedClasspathEntry(IClasspathEntry entry) {
3054
3055        if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE)
3056            return entry;
3057
3058        IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
3059        IPath resolvedPath = JavaCore.getResolvedVariablePath(entry.getPath());
3060        if (resolvedPath == null)
3061            return null;
3062
3063        Object JavaDoc target = JavaModel.getTarget(workspaceRoot, resolvedPath, false);
3064        if (target == null)
3065            return null;
3066
3067        // inside the workspace
3068
if (target instanceof IResource) {
3069            IResource resolvedResource = (IResource) target;
3070            switch (resolvedResource.getType()) {
3071
3072                case IResource.PROJECT :
3073                    // internal project
3074
return JavaCore.newProjectEntry(
3075                            resolvedPath,
3076                            entry.getAccessRules(),
3077                            entry.combineAccessRules(),
3078                            entry.getExtraAttributes(),
3079                            entry.isExported());
3080                case IResource.FILE :
3081                    if (org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(resolvedResource.getName())) {
3082                        // internal binary archive
3083
return JavaCore.newLibraryEntry(
3084                                resolvedPath,
3085                                getResolvedVariablePath(entry.getSourceAttachmentPath()),
3086                                getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
3087                                entry.getAccessRules(),
3088                                entry.getExtraAttributes(),
3089                                entry.isExported());
3090                    }
3091                    break;
3092
3093                case IResource.FOLDER :
3094                    // internal binary folder
3095
return JavaCore.newLibraryEntry(
3096                            resolvedPath,
3097                            getResolvedVariablePath(entry.getSourceAttachmentPath()),
3098                            getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
3099                            entry.getAccessRules(),
3100                            entry.getExtraAttributes(),
3101                            entry.isExported());
3102            }
3103        }
3104        // outside the workspace
3105
if (target instanceof File JavaDoc) {
3106            File JavaDoc externalFile = JavaModel.getFile(target);
3107            if (externalFile != null) {
3108                String JavaDoc fileName = externalFile.getName().toLowerCase();
3109                if (fileName.endsWith(SuffixConstants.SUFFIX_STRING_jar) || fileName.endsWith(SuffixConstants.SUFFIX_STRING_zip)) {
3110                    // external binary archive
3111
return JavaCore.newLibraryEntry(
3112                            resolvedPath,
3113                            getResolvedVariablePath(entry.getSourceAttachmentPath()),
3114                            getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
3115                            entry.getAccessRules(),
3116                            entry.getExtraAttributes(),
3117                            entry.isExported());
3118                }
3119            } else { // external binary folder
3120
if (resolvedPath.isAbsolute()){
3121                    return JavaCore.newLibraryEntry(
3122                            resolvedPath,
3123                            getResolvedVariablePath(entry.getSourceAttachmentPath()),
3124                            getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
3125                            entry.getAccessRules(),
3126                            entry.getExtraAttributes(),
3127                            entry.isExported());
3128                }
3129            }
3130        }
3131        return null;
3132    }
3133
3134
3135    /**
3136     * Resolve a variable path (helper method).
3137     *
3138     * @param variablePath the given variable path
3139     * @return the resolved variable path or <code>null</code> if none
3140     */

3141    public static IPath getResolvedVariablePath(IPath variablePath) {
3142
3143        if (variablePath == null)
3144            return null;
3145        int count = variablePath.segmentCount();
3146        if (count == 0)
3147            return null;
3148
3149        // lookup variable
3150
String JavaDoc variableName = variablePath.segment(0);
3151        IPath resolvedPath = JavaCore.getClasspathVariable(variableName);
3152        if (resolvedPath == null)
3153            return null;
3154
3155        // append path suffix
3156
if (count > 1) {
3157            resolvedPath = resolvedPath.append(variablePath.removeFirstSegments(1));
3158        }
3159        return resolvedPath;
3160    }
3161
3162    /**
3163     * Answers the shared working copies currently registered for this buffer factory.
3164     * Working copies can be shared by several clients using the same buffer factory,see
3165     * <code>IWorkingCopy.getSharedWorkingCopy</code>.
3166     *
3167     * @param factory the given buffer factory
3168     * @return the list of shared working copies for a given buffer factory
3169     * @since 2.0
3170     * @deprecated Use {@link #getWorkingCopies(WorkingCopyOwner)} instead
3171     */

3172    public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory){
3173
3174        // if factory is null, default factory must be used
3175
if (factory == null) factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory();
3176
3177        return getWorkingCopies(BufferFactoryWrapper.create(factory));
3178    }
3179
3180    /**
3181     * Returns the names of all defined user libraries. The corresponding classpath container path
3182     * is the name appended to the USER_LIBRARY_CONTAINER_ID.
3183     * @return Return an array containing the names of all known user defined.
3184     * @since 3.0
3185     */

3186    public static String JavaDoc[] getUserLibraryNames() {
3187         return JavaModelManager.getUserLibraryManager().getUserLibraryNames();
3188    }
3189
3190    /**
3191     * Returns the working copies that have the given owner.
3192     * Only compilation units in working copy mode are returned.
3193     * If the owner is <code>null</code>, primary working copies are returned.
3194     *
3195     * @param owner the given working copy owner or <code>null</code> for primary working copy owner
3196     * @return the list of working copies for a given owner
3197     * @since 3.0
3198     */

3199    public static ICompilationUnit[] getWorkingCopies(WorkingCopyOwner owner){
3200
3201        JavaModelManager manager = JavaModelManager.getJavaModelManager();
3202        if (owner == null) owner = DefaultWorkingCopyOwner.PRIMARY;
3203        ICompilationUnit[] result = manager.getWorkingCopies(owner, false/*don't add primary WCs*/);
3204        if (result == null) return JavaModelManager.NO_WORKING_COPY;
3205        return result;
3206    }
3207
3208    /**
3209     * Initializes JavaCore internal structures to allow subsequent operations (such
3210     * as the ones that need a resolved classpath) to run full speed. A client may
3211     * choose to call this method in a background thread early after the workspace
3212     * has started so that the initialization is transparent to the user.
3213     * <p>
3214     * However calling this method is optional. Services will lazily perform
3215     * initialization when invoked. This is only a way to reduce initialization
3216     * overhead on user actions, if it can be performed before at some
3217     * appropriate moment.
3218     * </p><p>
3219     * This initialization runs accross all Java projects in the workspace. Thus the
3220     * workspace root scheduling rule is used during this operation.
3221     * </p><p>
3222     * This method may return before the initialization is complete. The
3223     * initialization will then continue in a background thread.
3224     * </p><p>
3225     * This method can be called concurrently.
3226     * </p>
3227     *
3228     * @param monitor a progress monitor, or <code>null</code> if progress
3229     * reporting and cancellation are not desired
3230     * @exception CoreException if the initialization fails,
3231     * the status of the exception indicates the reason of the failure
3232     * @since 3.1
3233     */

3234    public static void initializeAfterLoad(IProgressMonitor monitor) throws CoreException {
3235        try {
3236            if (monitor != null) monitor.beginTask(Messages.javamodel_initialization, 100);
3237
3238            // initialize all containers and variables
3239
JavaModelManager manager = JavaModelManager.getJavaModelManager();
3240            try {
3241                if (monitor != null) {
3242                    monitor.subTask(Messages.javamodel_configuring_classpath_containers);
3243                    manager.batchContainerInitializationsProgress.set(new SubProgressMonitor(monitor, 50)); // 50% of the time is spent in initializing containers and variables
3244
}
3245                
3246                // all classpaths in the workspace are going to be resolved, ensure that containers are initialized in one batch
3247
manager.batchContainerInitializations = true;
3248                
3249                // avoid leaking source attachment properties (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=183413)
3250
IJavaProject[] projects = manager.getJavaModel().getJavaProjects();
3251                for (int i = 0, length = projects.length; i < length; i++) {
3252                    IClasspathEntry[] classpath;
3253                    try {
3254                        classpath = ((JavaProject) projects[i]).getResolvedClasspath();
3255                    } catch (JavaModelException e) {
3256                        // project no longer exist: ignore
3257
continue;
3258                    }
3259                    if (classpath != null) {
3260                        for (int j = 0, length2 = classpath.length; j < length2; j++) {
3261                            IClasspathEntry entry = classpath[j];
3262                            if (entry.getSourceAttachmentPath() != null)
3263                                Util.setSourceAttachmentProperty(entry.getPath(), null);
3264                            // else source might have been attached by IPackageFragmentRoot#attachSource(...), we keep it
3265
}
3266                    }
3267                }
3268                
3269                // initialize delta state
3270
manager.deltaState.rootsAreStale = true; // in case it was already initialized before we cleaned up the source attachment proprties
3271
manager.deltaState.initializeRoots();
3272            } finally {
3273                manager.batchContainerInitializationsProgress.set(null);
3274            }
3275
3276            // dummy query for waiting until the indexes are ready
3277
SearchEngine engine = new SearchEngine();
3278            IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
3279            try {
3280                if (monitor != null)
3281                    monitor.subTask(Messages.javamodel_configuring_searchengine);
3282                engine.searchAllTypeNames(
3283                    null,
3284                    SearchPattern.R_EXACT_MATCH,
3285                    "!@$#!@".toCharArray(), //$NON-NLS-1$
3286
SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE,
3287                    IJavaSearchConstants.CLASS,
3288                    scope,
3289                    new TypeNameRequestor() {
3290                        public void acceptType(
3291                            int modifiers,
3292                            char[] packageName,
3293                            char[] simpleTypeName,
3294                            char[][] enclosingTypeNames,
3295                            String JavaDoc path) {
3296                            // no type to accept
3297
}
3298                    },
3299                    // will not activate index query caches if indexes are not ready, since it would take to long
3300
// to wait until indexes are fully rebuild
3301
IJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH,
3302                    monitor == null ? null : new SubProgressMonitor(monitor, 49) // 49% of the time is spent in the dummy search
3303
);
3304            } catch (JavaModelException e) {
3305                // /search failed: ignore
3306
} catch (OperationCanceledException e) {
3307                if (monitor != null && monitor.isCanceled())
3308                    throw e;
3309                // else indexes were not ready: catch the exception so that jars are still refreshed
3310
}
3311
3312            // check if the build state version number has changed since last session
3313
// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=98969)
3314
if (monitor != null)
3315                monitor.subTask(Messages.javamodel_getting_build_state_number);
3316            QualifiedName qName = new QualifiedName(JavaCore.PLUGIN_ID, "stateVersionNumber"); //$NON-NLS-1$
3317
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
3318            String JavaDoc versionNumber = null;
3319            try {
3320                versionNumber = root.getPersistentProperty(qName);
3321            } catch (CoreException e) {
3322                // could not read version number: consider it is new
3323
}
3324            final JavaModel model = manager.getJavaModel();
3325            String JavaDoc newVersionNumber = Byte.toString(State.VERSION);
3326            if (!newVersionNumber.equals(versionNumber)) {
3327                // build state version number has changed: touch every projects to force a rebuild
3328
if (JavaBuilder.DEBUG)
3329                    System.out.println("Build state version number has changed"); //$NON-NLS-1$
3330
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
3331                    public void run(IProgressMonitor progressMonitor2) throws CoreException {
3332                        IJavaProject[] projects = null;
3333                        try {
3334                            projects = model.getJavaProjects();
3335                        } catch (JavaModelException e) {
3336                            // could not get Java projects: ignore
3337
}
3338                        if (projects != null) {
3339                            for (int i = 0, length = projects.length; i < length; i++) {
3340                                IJavaProject project = projects[i];
3341                                try {
3342                                    if (JavaBuilder.DEBUG)
3343                                        System.out.println("Touching " + project.getElementName()); //$NON-NLS-1$
3344
project.getProject().touch(progressMonitor2);
3345                                } catch (CoreException e) {
3346                                    // could not touch this project: ignore
3347
}
3348                            }
3349                        }
3350                    }
3351                };
3352                if (monitor != null)
3353                    monitor.subTask(Messages.javamodel_building_after_upgrade);
3354                try {
3355                    ResourcesPlugin.getWorkspace().run(runnable, monitor);
3356                } catch (CoreException e) {
3357                    // could not touch all projects
3358
}
3359                try {
3360                    root.setPersistentProperty(qName, newVersionNumber);
3361                } catch (CoreException e) {
3362                    Util.log(e, "Could not persist build state version number"); //$NON-NLS-1$
3363
}
3364            }
3365
3366            // ensure external jars are refreshed (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=93668)
3367
try {
3368                if (monitor != null)
3369                    monitor.subTask(Messages.javamodel_refreshing_external_jars);
3370                model.refreshExternalArchives(
3371                    null/*refresh all projects*/,
3372                    monitor == null ? null : new SubProgressMonitor(monitor, 1) // 1% of the time is spent in jar refresh
3373
);
3374            } catch (JavaModelException e) {
3375                // refreshing failed: ignore
3376
}
3377            
3378        } finally {
3379            if (monitor != null) monitor.done();
3380        }
3381    }
3382
3383    /**
3384     * Returns whether a given classpath variable is read-only or not.
3385     *
3386     * @param variableName
3387     * @return <code>true</code> if the classpath variable is read-only,
3388     * <code>false</code> otherwise.
3389     * @since 3.3
3390     */

3391    public static boolean isClasspathVariableReadOnly(String JavaDoc variableName) {
3392        return JavaModelManager.getJavaModelManager().readOnlyVariables.contains(variableName);
3393    }
3394
3395    /**
3396     * Returns whether the given file name's extension is a Java-like extension.
3397     *
3398     * @return whether the given file name's extension is a Java-like extension
3399     * @see #getJavaLikeExtensions()
3400     * @since 3.2
3401     */

3402    public static boolean isJavaLikeFileName(String JavaDoc fileName) {
3403        return Util.isJavaLikeFileName(fileName);
3404    }
3405
3406    /**
3407     * Returns whether the given marker references the given Java element.
3408     * Used for markers, which denote a Java element rather than a resource.
3409     *
3410     * @param element the element
3411     * @param marker the marker
3412     * @return <code>true</code> if the marker references the element, false otherwise
3413     * @exception CoreException if the <code>IMarker.getAttribute</code> on the marker fails
3414     */

3415    public static boolean isReferencedBy(IJavaElement element, IMarker marker) throws CoreException {
3416
3417        // only match units or classfiles
3418
if (element instanceof IMember){
3419            IMember member = (IMember) element;
3420            if (member.isBinary()){
3421                element = member.getClassFile();
3422            } else {
3423                element = member.getCompilationUnit();
3424            }
3425        }
3426        if (element == null) return false;
3427        if (marker == null) return false;
3428
3429        String JavaDoc markerHandleId = (String JavaDoc)marker.getAttribute(ATT_HANDLE_ID);
3430        if (markerHandleId == null) return false;
3431
3432        IJavaElement markerElement = JavaCore.create(markerHandleId);
3433        while (true){
3434            if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs.
3435

3436            // cycle through enclosing types in case marker is associated with a classfile (15568)
3437
if (markerElement instanceof IClassFile){
3438                IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType();
3439                if (enclosingType != null){
3440                    markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile
3441
continue;
3442                }
3443            }
3444            break;
3445        }
3446        return false;
3447    }
3448
3449    /**
3450     * Returns whether the given marker delta references the given Java element.
3451     * Used for markers deltas, which denote a Java element rather than a resource.
3452     *
3453     * @param element the element
3454     * @param markerDelta the marker delta
3455     * @return <code>true</code> if the marker delta references the element
3456     * @exception CoreException if the <code>IMarkerDelta.getAttribute</code> on the marker delta fails
3457     */

3458    public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException {
3459
3460        // only match units or classfiles
3461
if (element instanceof IMember){
3462            IMember member = (IMember) element;
3463            if (member.isBinary()){
3464                element = member.getClassFile();
3465            } else {
3466                element = member.getCompilationUnit();
3467            }
3468        }
3469        if (element == null) return false;
3470        if (markerDelta == null) return false;
3471
3472        String JavaDoc markerDeltarHandleId = (String JavaDoc)markerDelta.getAttribute(ATT_HANDLE_ID);
3473        if (markerDeltarHandleId == null) return false;
3474
3475        IJavaElement markerElement = JavaCore.create(markerDeltarHandleId);
3476        while (true){
3477            if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs.
3478

3479            // cycle through enclosing types in case marker is associated with a classfile (15568)
3480
if (markerElement instanceof IClassFile){
3481                IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType();
3482                if (enclosingType != null){
3483                    markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile
3484
continue;
3485                }
3486            }
3487            break;
3488        }
3489        return false;
3490    }
3491
3492    /**
3493     * Creates and returns a new access rule with the given file pattern and kind.
3494     * <p>
3495     * The rule kind is one of {@link IAccessRule#K_ACCESSIBLE}, {@link IAccessRule#K_DISCOURAGED},
3496     * or {@link IAccessRule#K_NON_ACCESSIBLE}, optionally combined with {@link IAccessRule#IGNORE_IF_BETTER},
3497     * e..g. <code>IAccessRule.K_NON_ACCESSIBLE | IAccessRule.IGNORE_IF_BETTER</code>.
3498     * </p>
3499     *
3500     * @param filePattern the file pattern this access rule should match
3501     * @param kind one of {@link IAccessRule#K_ACCESSIBLE}, {@link IAccessRule#K_DISCOURAGED},
3502     * or {@link IAccessRule#K_NON_ACCESSIBLE}, optionally combined with
3503     * {@link IAccessRule#IGNORE_IF_BETTER}
3504     * @return a new access rule
3505     * @since 3.1
3506     */

3507    public static IAccessRule newAccessRule(IPath filePattern, int kind) {
3508        return new ClasspathAccessRule(filePattern, kind);
3509    }
3510
3511    /**
3512     * Creates and returns a new classpath attribute with the given name and the given value.
3513     *
3514     * @return a new classpath attribute
3515     * @since 3.1
3516     */

3517    public static IClasspathAttribute newClasspathAttribute(String JavaDoc name, String JavaDoc value) {
3518        return new ClasspathAttribute(name, value);
3519    }
3520
3521    /**
3522     * Creates and returns a new classpath entry of kind <code>CPE_CONTAINER</code>
3523     * for the given path. This method is fully equivalent to calling
3524     * {@link #newContainerEntry(IPath, IAccessRule[], IClasspathAttribute[], boolean)
3525     * newContainerEntry(containerPath, new IAccessRule[0], new IClasspathAttribute[0], false)}.
3526     * <p>
3527     * @param containerPath the path identifying the container, it must be formed of two
3528     * segments
3529     * @return a new container classpath entry
3530     *
3531     * @see JavaCore#getClasspathContainer(IPath, IJavaProject)
3532     * @since 2.0
3533     */

3534    public static IClasspathEntry newContainerEntry(IPath containerPath) {
3535        return newContainerEntry(
3536        containerPath,
3537        ClasspathEntry.NO_ACCESS_RULES,
3538        ClasspathEntry.NO_EXTRA_ATTRIBUTES,
3539        false/*not exported*/);
3540    }
3541
3542    /**
3543     * Creates and returns a new classpath entry of kind <code>CPE_CONTAINER</code>
3544     * for the given path. This method is fully equivalent to calling
3545     * {@link #newContainerEntry(IPath, IAccessRule[], IClasspathAttribute[], boolean)
3546     * newContainerEntry(containerPath, new IAccessRule[0], new IClasspathAttribute[0], isExported)}.
3547     *
3548     * @param containerPath the path identifying the container, it must be formed of at least
3549     * one segment (ID+hints)
3550     * @param isExported a boolean indicating whether this entry is contributed to dependent
3551     * projects in addition to the output location
3552     * @return a new container classpath entry
3553     *
3554     * @see JavaCore#getClasspathContainer(IPath, IJavaProject)
3555     * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor)
3556     * @since 2.0
3557     */

3558    public static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported) {
3559        return newContainerEntry(
3560            containerPath,
3561            ClasspathEntry.NO_ACCESS_RULES,
3562            ClasspathEntry.NO_EXTRA_ATTRIBUTES,
3563            isExported);
3564    }
3565
3566    /**
3567     * Creates and returns a new classpath entry of kind <code>CPE_CONTAINER</code>
3568     * for the given path. The path of the container will be used during resolution so as to map this
3569     * container entry to a set of other classpath entries the container is acting for.
3570     * <p>
3571     * A container entry allows to express indirect references to a set of libraries, projects and variable entries,
3572     * which can be interpreted differently for each Java project where it is used.
3573     * A classpath container entry can be resolved using <code>JavaCore.getResolvedClasspathContainer</code>,
3574     * and updated with <code>JavaCore.classpathContainerChanged</code>
3575     * <p>
3576     * A container is exclusively resolved by a <code>ClasspathContainerInitializer</code> registered onto the
3577     * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
3578     * <p>
3579     * A container path must be formed of at least one segment, where: <ul>
3580     * <li> the first segment is a unique ID identifying the target container, there must be a container initializer registered
3581     * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer". </li>
3582     * <li> the remaining segments will be passed onto the initializer, and can be used as additional
3583     * hints during the initialization phase. </li>
3584     * </ul>
3585     * <p>
3586     * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container:
3587     * <pre>
3588     * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default"));
3589     *
3590     * &lt;extension
3591     * point="org.eclipse.jdt.core.classpathContainerInitializer"&gt;
3592     * &lt;containerInitializer
3593     * id="MyProvidedJDK"
3594     * class="com.example.MyInitializer"/&gt;
3595     * </pre>
3596     * <p>
3597     * The access rules determine the set of accessible source and class files
3598     * in the container. If the list of access rules is empty, then all files
3599     * in this container are accessible.
3600     * See {@link IAccessRule} for a detailed description of access
3601     * rules. Note that if an entry defined by the container defines access rules,
3602     * then these access rules are combined with the given access rules.
3603     * The given access rules are considered first, then the entry's access rules are
3604     * considered.
3605     * </p>
3606     * <p>
3607     * The <code>extraAttributes</code> list contains name/value pairs that must be persisted with
3608     * this entry. If no extra attributes are provided, an empty array must be passed in.<br>
3609     * Note that this list should not contain any duplicate name.
3610     * </p>
3611     * <p>
3612     * The <code>isExported</code> flag indicates whether this entry is contributed to dependent
3613     * projects. If not exported, dependent projects will not see any of the classes from this entry.
3614     * If exported, dependent projects will concatenate the accessible files patterns of this entry with the
3615     * accessible files patterns of the projects, and they will concatenate the non accessible files patterns of this entry
3616     * with the non accessible files patterns of the project.
3617     * </p>
3618     * <p>
3619     * Note that this operation does not attempt to validate classpath containers
3620     * or access the resources at the given paths.
3621     * </p>
3622     *
3623     * @param containerPath the path identifying the container, it must be formed of at least
3624     * one segment (ID+hints)
3625     * @param accessRules the possibly empty list of access rules for this entry
3626     * @param extraAttributes the possibly empty list of extra attributes to persist with this entry
3627     * @param isExported a boolean indicating whether this entry is contributed to dependent
3628     * projects in addition to the output location
3629     * @return a new container classpath entry
3630     *
3631     * @see JavaCore#getClasspathContainer(IPath, IJavaProject)
3632     * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor)
3633     * @see JavaCore#newContainerEntry(IPath, boolean)
3634     * @see JavaCore#newAccessRule(IPath, int)
3635     * @since 3.1
3636     */

3637    public static IClasspathEntry newContainerEntry(
3638            IPath containerPath,
3639            IAccessRule[] accessRules,
3640            IClasspathAttribute[] extraAttributes,
3641            boolean isExported) {
3642
3643        if (containerPath == null) {
3644            Assert.isTrue(false, "Container path cannot be null"); //$NON-NLS-1$
3645
} else if (containerPath.segmentCount() < 1) {
3646            Assert.isTrue(
3647                false,
3648                "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$
3649
}
3650        return new ClasspathEntry(
3651            IPackageFragmentRoot.K_SOURCE,
3652            IClasspathEntry.CPE_CONTAINER,
3653            containerPath,
3654            ClasspathEntry.INCLUDE_ALL, // inclusion patterns
3655
ClasspathEntry.EXCLUDE_NONE, // exclusion patterns
3656
null, // source attachment
3657
null, // source attachment root
3658
null, // specific output folder
3659
isExported,
3660            accessRules,
3661            true, // combine access rules
3662
extraAttributes);
3663    }
3664
3665    /**
3666     * Creates and returns a type hierarchy for all types in the given
3667     * region, considering subtypes within that region and considering types in the
3668     * working copies with the given owner.
3669     * In other words, the owner's working copies will take
3670     * precedence over their original compilation units in the workspace.
3671     * <p>
3672     * Note that if a working copy is empty, it will be as if the original compilation
3673     * unit had been deleted.
3674     * <p>
3675     *
3676     * @param monitor the given progress monitor
3677     * @param region the given region
3678     * @param owner the owner of working copies that take precedence over their original compilation units,
3679     * or <code>null</code> if the primary working copy owner should be used
3680     * @exception JavaModelException if an element in the region does not exist or if an
3681     * exception occurs while accessing its corresponding resource
3682     * @exception IllegalArgumentException if region is <code>null</code>
3683     * @return a type hierarchy for all types in the given
3684     * region, considering subtypes within that region
3685     * @since 3.1
3686     */

3687    public static ITypeHierarchy newTypeHierarchy(IRegion region, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException {
3688        if (region == null) {
3689            throw new IllegalArgumentException JavaDoc(Messages.hierarchy_nullRegion);
3690        }
3691        ICompilationUnit[] workingCopies = JavaModelManager.getJavaModelManager().getWorkingCopies(owner, true/*add primary working copies*/);
3692        CreateTypeHierarchyOperation op =
3693            new CreateTypeHierarchyOperation(region, workingCopies, null, true/*compute subtypes*/);
3694        op.runOperation(monitor);
3695        return op.getResult();
3696    }
3697
3698    /**
3699     * Creates and returns a new non-exported classpath entry of kind <code>CPE_LIBRARY</code> for the
3700     * JAR or folder identified by the given absolute path. This specifies that all package fragments
3701     * within the root will have children of type <code>IClassFile</code>.
3702     * This method is fully equivalent to calling
3703     * {@link #newLibraryEntry(IPath, IPath, IPath, IAccessRule[], IClasspathAttribute[], boolean)
3704     * newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, new IAccessRule[0], new IClasspathAttribute[0], false)}.
3705     *
3706     * @param path the absolute path of the binary archive
3707     * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
3708     * or <code>null</code> if none. Note, since 3.0, an empty path is allowed to denote no source attachment.
3709     * and will be automatically converted to <code>null</code>.
3710     * @param sourceAttachmentRootPath the location of the root of the source files within the source archive or folder
3711     * or <code>null</code> if this location should be automatically detected.
3712     * @return a new library classpath entry
3713     */

3714    public static IClasspathEntry newLibraryEntry(
3715        IPath path,
3716        IPath sourceAttachmentPath,
3717        IPath sourceAttachmentRootPath) {
3718
3719        return newLibraryEntry(
3720            path,
3721            sourceAttachmentPath,
3722            sourceAttachmentRootPath,
3723            ClasspathEntry.NO_ACCESS_RULES,
3724            ClasspathEntry.NO_EXTRA_ATTRIBUTES,
3725            false/*not exported*/);
3726    }
3727
3728    /**
3729     * Creates and returns a new classpath entry of kind <code>CPE_LIBRARY</code> for the JAR or folder
3730     * identified by the given absolute path. This specifies that all package fragments within the root
3731     * will have children of type <code>IClassFile</code>.
3732     * This method is fully equivalent to calling
3733     * {@link #newLibraryEntry(IPath, IPath, IPath, IAccessRule[], IClasspathAttribute[], boolean)
3734     * newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, new IAccessRule[0], new IClasspathAttribute[0], isExported)}.
3735     *
3736     * @param path the absolute path of the binary archive
3737     * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
3738     * or <code>null</code> if none. Note, since 3.0, an empty path is allowed to denote no source attachment.
3739     * and will be automatically converted to <code>null</code>.
3740     * @param sourceAttachmentRootPath the location of the root of the source files within the source archive or folder
3741     * or <code>null</code> if this location should be automatically detected.
3742     * @param isExported indicates whether this entry is contributed to dependent
3743     * projects in addition to the output location
3744     * @return a new library classpath entry
3745     * @since 2.0
3746     */

3747    public static IClasspathEntry newLibraryEntry(
3748        IPath path,
3749        IPath sourceAttachmentPath,
3750        IPath sourceAttachmentRootPath,
3751        boolean isExported) {
3752
3753        return newLibraryEntry(
3754            path,
3755            sourceAttachmentPath,
3756            sourceAttachmentRootPath,
3757            ClasspathEntry.NO_ACCESS_RULES,
3758            ClasspathEntry.NO_EXTRA_ATTRIBUTES,
3759            isExported);
3760    }
3761
3762    /**
3763     * Creates and returns a new classpath entry of kind <code>CPE_LIBRARY</code> for the JAR or folder
3764     * identified by the given absolute path. This specifies that all package fragments within the root
3765     * will have children of type <code>IClassFile</code>.
3766     * <p>
3767     * A library entry is used to denote a prerequisite JAR or root folder containing binaries.
3768     * The target JAR can either be defined internally to the workspace (absolute path relative
3769     * to the workspace root) or externally to the workspace (absolute path in the file system).
3770     * The target root folder can only be defined internally to the workspace (absolute path relative
3771     * to the workspace root). To use a binary folder external to the workspace, it must first be
3772     * linked (see IFolder#createLink(...)).
3773     * <p>
3774     * e.g. Here are some examples of binary path usage<ul>
3775     * <li><code> "c:\jdk1.2.2\jre\lib\rt.jar" </code> - reference to an external JAR on Windows</li>
3776     * <li><code> "/Project/someLib.jar" </code> - reference to an internal JAR on Windows or Linux</li>
3777     * <li><code> "/Project/classes/" </code> - reference to an internal binary folder on Windows or Linux</li>
3778     * </ul>
3779     * Note that on non-Windows platform, a path <code>"/some/lib.jar"</code> is ambiguous.
3780     * It can be a path to an external JAR (its file system path being <code>"/some/lib.jar"</code>)
3781     * or it can be a path to an internal JAR (<code>"some"</code> being a project in the workspace).
3782     * Such an ambiguity is solved when the classpath entry is used (e.g. in {@link IJavaProject#getPackageFragmentRoots()}).
3783     * If the resource <code>"lib.jar"</code> exists in project <code>"some"</code>, then it is considered an
3784     * internal JAR. Otherwise it is an external JAR.
3785     * <p>Also note that this operation does not attempt to validate or access the
3786     * resources at the given paths.
3787     * </p><p>
3788     * The access rules determine the set of accessible class files
3789     * in the library. If the list of access rules is empty then all files
3790     * in this library are accessible.
3791     * See {@link IAccessRule} for a detailed description of access
3792     * rules.
3793     * </p>
3794     * <p>
3795     * The <code>extraAttributes</code> list contains name/value pairs that must be persisted with
3796     * this entry. If no extra attributes are provided, an empty array must be passed in.<br>
3797     * Note that this list should not contain any duplicate name.
3798     * </p>
3799     * <p>
3800     * The <code>isExported</code> flag indicates whether this entry is contributed to dependent
3801     * projects. If not exported, dependent projects will not see any of the classes from this entry.
3802     * If exported, dependent projects will concatenate the accessible files patterns of this entry with the
3803     * accessible files patterns of the projects, and they will concatenate the non accessible files patterns of this entry
3804     * with the non accessible files patterns of the project.
3805     * </p>
3806     *
3807     * @param path the absolute path of the binary archive
3808     * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
3809     * or <code>null</code> if none. Note, since 3.0, an empty path is allowed to denote no source attachment.
3810     * and will be automatically converted to <code>null</code>.
3811     * @param sourceAttachmentRootPath the location of the root of the source files within the source archive or folder
3812     * or <code>null</code> if this location should be automatically detected.
3813     * @param accessRules the possibly empty list of access rules for this entry
3814     * @param extraAttributes the possibly empty list of extra attributes to persist with this entry
3815     * @param isExported indicates whether this entry is contributed to dependent
3816     * projects in addition to the output location
3817     * @return a new library classpath entry
3818     * @since 3.1
3819     */

3820    public static IClasspathEntry newLibraryEntry(
3821            IPath path,
3822            IPath sourceAttachmentPath,
3823            IPath sourceAttachmentRootPath,
3824            IAccessRule[] accessRules,
3825            IClasspathAttribute[] extraAttributes,
3826            boolean isExported) {
3827
3828        if (path == null) Assert.isTrue(false, "Library path cannot be null"); //$NON-NLS-1$
3829
if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
3830
if (sourceAttachmentPath != null) {
3831            if (sourceAttachmentPath.isEmpty()) {
3832                sourceAttachmentPath = null; // treat empty path as none
3833
} else if (!sourceAttachmentPath.isAbsolute()) {
3834                Assert.isTrue(false, "Source attachment path '" //$NON-NLS-1$
3835
+ sourceAttachmentPath
3836                        + "' for IClasspathEntry must be absolute"); //$NON-NLS-1$
3837
}
3838        }
3839        return new ClasspathEntry(
3840            IPackageFragmentRoot.K_BINARY,
3841            IClasspathEntry.CPE_LIBRARY,
3842            JavaProject.canonicalizedPath(path),
3843            ClasspathEntry.INCLUDE_ALL, // inclusion patterns
3844
ClasspathEntry.EXCLUDE_NONE, // exclusion patterns
3845
sourceAttachmentPath,
3846            sourceAttachmentRootPath,
3847            null, // specific output folder
3848
isExported,
3849            accessRules,
3850            false, // no access rules to combine
3851
extraAttributes);
3852    }
3853
3854    /**
3855     * Creates and returns a new non-exported classpath entry of kind <code>CPE_PROJECT</code>
3856     * for the project identified by the given absolute path.
3857     * This method is fully equivalent to calling
3858     * {@link #newProjectEntry(IPath, IAccessRule[], boolean, IClasspathAttribute[], boolean)
3859     * newProjectEntry(path, new IAccessRule[0], true, new IClasspathAttribute[0], false)}.
3860     *
3861     * @param path the absolute path of the binary archive
3862     * @return a new project classpath entry
3863     */

3864    public static IClasspathEntry newProjectEntry(IPath path) {
3865        return newProjectEntry(path, false);
3866    }
3867
3868    /**
3869     * Creates and returns a new classpath entry of kind <code>CPE_PROJECT</code>
3870     * for the project identified by the given absolute path.
3871     * This method is fully equivalent to calling
3872     * {@link #newProjectEntry(IPath, IAccessRule[], boolean, IClasspathAttribute[], boolean)
3873     * newProjectEntry(path, new IAccessRule[0], true, new IClasspathAttribute[0], isExported)}.
3874     *
3875     * @param path the absolute path of the prerequisite project
3876     * @param isExported indicates whether this entry is contributed to dependent
3877     * projects in addition to the output location
3878     * @return a new project classpath entry
3879     * @since 2.0
3880     */

3881    public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) {
3882
3883        if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
3884

3885        return newProjectEntry(
3886            path,
3887            ClasspathEntry.NO_ACCESS_RULES,
3888            true,
3889            ClasspathEntry.NO_EXTRA_ATTRIBUTES,
3890            isExported);
3891    }
3892
3893    /**
3894     * Creates and returns a new classpath entry of kind <code>CPE_PROJECT</code>
3895     * for the project identified by the given absolute path.
3896     * <p>
3897     * A project entry is used to denote a prerequisite project on a classpath.
3898     * The referenced project will be contributed as a whole, either as sources (in the Java Model, it
3899     * contributes all its package fragment roots) or as binaries (when building, it contributes its
3900     * whole output location).
3901     * </p>
3902     * <p>
3903     * A project reference allows to indirect through another project, independently from its internal layout.
3904     * </p><p>
3905     * The prerequisite project is referred to using an absolute path relative to the workspace root.
3906     * </p>
3907     * <p>
3908     * The access rules determine the set of accessible class files
3909     * in the project. If the list of access rules is empty then all files
3910     * in this project are accessible.
3911     * See {@link IAccessRule} for a detailed description of access rules.
3912     * </p>
3913     * <p>
3914     * The <code>combineAccessRules</code> flag indicates whether access rules of one (or more)
3915     * exported entry of the project should be combined with the given access rules. If they should
3916     * be combined, the given access rules are considered first, then the entry's access rules are
3917     * considered.
3918     * </p>
3919     * <p>
3920     * The <code>extraAttributes</code> list contains name/value pairs that must be persisted with
3921     * this entry. If no extra attributes are provided, an empty array must be passed in.<br>
3922     * Note that this list should not contain any duplicate name.
3923     * </p>
3924     * <p>
3925     * The <code>isExported</code> flag indicates whether this entry is contributed to dependent
3926     * projects. If not exported, dependent projects will not see any of the classes from this entry.
3927     * If exported, dependent projects will concatenate the accessible files patterns of this entry with the
3928     * accessible files patterns of the projects, and they will concatenate the non accessible files patterns of this entry
3929     * with the non accessible files patterns of the project.
3930     * </p>
3931     *
3932     * @param path the absolute path of the prerequisite project
3933     * @param accessRules the possibly empty list of access rules for this entry
3934     * @param combineAccessRules whether the access rules of the project's exported entries should be combined with the given access rules
3935     * @param extraAttributes the possibly empty list of extra attributes to persist with this entry
3936     * @param isExported indicates whether this entry is contributed to dependent
3937     * projects in addition to the output location
3938     * @return a new project classpath entry
3939     * @since 3.1
3940     */

3941    public static IClasspathEntry newProjectEntry(
3942            IPath path,
3943            IAccessRule[] accessRules,
3944            boolean combineAccessRules,
3945            IClasspathAttribute[] extraAttributes,
3946            boolean isExported) {
3947
3948        if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
3949

3950        return new ClasspathEntry(
3951            IPackageFragmentRoot.K_SOURCE,
3952            IClasspathEntry.CPE_PROJECT,
3953            path,
3954            ClasspathEntry.INCLUDE_ALL, // inclusion patterns
3955
ClasspathEntry.EXCLUDE_NONE, // exclusion patterns
3956
null, // source attachment
3957
null, // source attachment root
3958
null, // specific output folder
3959
isExported,
3960            accessRules,
3961            combineAccessRules,
3962            extraAttributes);
3963    }
3964
3965    /**
3966     * Returns a new empty region.
3967     *
3968     * @return a new empty region
3969     */

3970    public static IRegion newRegion() {
3971        return new Region();
3972    }
3973
3974    /**
3975     * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
3976     * for all files in the project's source folder identified by the given
3977     * absolute workspace-relative path.
3978     * <p>
3979     * The convenience method is fully equivalent to:
3980     * <pre>
3981     * newSourceEntry(path, new IPath[] {}, new IPath[] {}, null);
3982     * </pre>
3983     * </p>
3984     *
3985     * @param path the absolute workspace-relative path of a source folder
3986     * @return a new source classpath entry
3987     * @see #newSourceEntry(IPath, IPath[], IPath[], IPath)
3988     */

3989    public static IClasspathEntry newSourceEntry(IPath path) {
3990
3991        return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null /*output location*/);
3992    }
3993
3994    /**
3995     * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
3996     * for the project's source folder identified by the given absolute
3997     * workspace-relative path but excluding all source files with paths
3998     * matching any of the given patterns.
3999     * <p>
4000     * The convenience method is fully equivalent to:
4001     * <pre>
4002     * newSourceEntry(path, new IPath[] {}, exclusionPatterns, null);
4003     * </pre>
4004     * </p>
4005     *
4006     * @param path the absolute workspace-relative path of a source folder
4007     * @param exclusionPatterns the possibly empty list of exclusion patterns
4008     * represented as relative paths
4009     * @return a new source classpath entry
4010     * @see #newSourceEntry(IPath, IPath[], IPath[], IPath)
4011     * @since 2.1
4012     */

4013    public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) {
4014
4015        return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, exclusionPatterns, null /*output location*/);
4016    }
4017
4018    /**
4019     * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
4020     * for the project's source folder identified by the given absolute
4021     * workspace-relative path but excluding all source files with paths
4022     * matching any of the given patterns, and associated with a specific output location
4023     * (that is, ".class" files are not going to the project default output location).
4024     * <p>
4025     * The convenience method is fully equivalent to:
4026     * <pre>
4027     * newSourceEntry(path, new IPath[] {}, exclusionPatterns, specificOutputLocation);
4028     * </pre>
4029     * </p>
4030     *
4031     * @param path the absolute workspace-relative path of a source folder
4032     * @param exclusionPatterns the possibly empty list of exclusion patterns
4033     * represented as relative paths
4034     * @param specificOutputLocation the specific output location for this source entry (<code>null</code> if using project default ouput location)
4035     * @return a new source classpath entry
4036     * @see #newSourceEntry(IPath, IPath[], IPath[], IPath)
4037     * @since 2.1
4038     */

4039    public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns, IPath specificOutputLocation) {
4040
4041        return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, exclusionPatterns, specificOutputLocation);
4042    }
4043
4044    /**
4045     * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
4046     * for the project's source folder identified by the given absolute
4047     * workspace-relative path but excluding all source files with paths
4048     * matching any of the given patterns, and associated with a specific output location
4049     * (that is, ".class" files are not going to the project default output location).
4050     * <p>
4051     * The convenience method is fully equivalent to:
4052     * <pre>
4053     * newSourceEntry(path, new IPath[] {}, exclusionPatterns, specificOutputLocation, new IClasspathAttribute[] {});
4054     * </pre>
4055     * </p>
4056     *
4057     * @param path the absolute workspace-relative path of a source folder
4058     * @param inclusionPatterns the possibly empty list of inclusion patterns
4059     * represented as relative paths
4060     * @param exclusionPatterns the possibly empty list of exclusion patterns
4061     * represented as relative paths
4062     * @param specificOutputLocation the specific output location for this source entry (<code>null</code> if using project default ouput location)
4063     * @return a new source classpath entry
4064     * @see #newSourceEntry(IPath, IPath[], IPath[], IPath, IClasspathAttribute[])
4065     * @since 3.0
4066     */

4067    public static IClasspathEntry newSourceEntry(IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns, IPath specificOutputLocation) {
4068        return newSourceEntry(path, inclusionPatterns, exclusionPatterns, specificOutputLocation, ClasspathEntry.NO_EXTRA_ATTRIBUTES);
4069    }
4070
4071    /**
4072     * Creates and returns a new classpath entry of kind <code>CPE_SOURCE</code>
4073     * for the project's source folder identified by the given absolute
4074     * workspace-relative path using the given inclusion and exclusion patterns
4075     * to determine which source files are included, and the given output path
4076     * to control the output location of generated files.
4077     * <p>
4078     * The source folder is referred to using an absolute path relative to the
4079     * workspace root, e.g. <code>/Project/src</code>. A project's source
4080     * folders are located with that project. That is, a source classpath
4081     * entry specifying the path <code>/P1/src</code> is only usable for
4082     * project <code>P1</code>.
4083     * </p>
4084     * <p>
4085     * The inclusion patterns determines the initial set of source files that
4086     * are to be included; the exclusion patterns are then used to reduce this
4087     * set. When no inclusion patterns are specified, the initial file set
4088     * includes all relevent files in the resource tree rooted at the source
4089     * entry's path. On the other hand, specifying one or more inclusion
4090     * patterns means that all <b>and only</b> files matching at least one of
4091     * the specified patterns are to be included. If exclusion patterns are
4092     * specified, the initial set of files is then reduced by eliminating files
4093     * matched by at least one of the exclusion patterns. Inclusion and
4094     * exclusion patterns look like relative file paths with wildcards and are
4095     * interpreted relative to the source entry's path. File patterns are
4096     * case-sensitive can contain '**', '*' or '?' wildcards (see
4097     * {@link IClasspathEntry#getExclusionPatterns()} for the full description
4098     * of their syntax and semantics). The resulting set of files are included
4099     * in the corresponding package fragment root; all package fragments within
4100     * the root will have children of type <code>ICompilationUnit</code>.
4101     * </p>
4102     * <p>
4103     * For example, if the source folder path is
4104     * <code>/Project/src</code>, there are no inclusion filters, and the
4105     * exclusion pattern is
4106     * <code>com/xyz/tests/&#42;&#42;</code>, then source files
4107     * like <code>/Project/src/com/xyz/Foo.java</code>
4108     * and <code>/Project/src/com/xyz/utils/Bar.java</code> would be included,
4109     * whereas <code>/Project/src/com/xyz/tests/T1.java</code>
4110     * and <code>/Project/src/com/xyz/tests/quick/T2.java</code> would be
4111     * excluded.
4112     * </p>
4113     * <p>
4114     * Additionally, a source entry can be associated with a specific output location.
4115     * By doing so, the Java builder will ensure that the generated ".class" files will
4116     * be issued inside this output location, as opposed to be generated into the
4117     * project default output location (when output location is <code>null</code>).
4118     * Note that multiple source entries may target the same output location.
4119     * The output location is referred to using an absolute path relative to the
4120     * workspace root, e.g. <code>"/Project/bin"</code>, it must be located inside
4121     * the same project as the source folder.
4122     * </p>
4123     * <p>
4124     * Also note that all sources/binaries inside a project are contributed as
4125     * a whole through a project entry
4126     * (see <code>JavaCore.newProjectEntry</code>). Particular source entries
4127     * cannot be selectively exported.
4128     * </p>
4129     * <p>
4130     * The <code>extraAttributes</code> list contains name/value pairs that must be persisted with
4131     * this entry. If no extra attributes are provided, an empty array must be passed in.<br>
4132     * Note that this list should not contain any duplicate name.
4133     * </p>
4134     *
4135     * @param path the absolute workspace-relative path of a source folder
4136     * @param inclusionPatterns the possibly empty list of inclusion patterns
4137     * represented as relative paths
4138     * @param exclusionPatterns the possibly empty list of exclusion patterns
4139     * represented as relative paths
4140     * @param specificOutputLocation the specific output location for this source entry (<code>null</code> if using project default ouput location)
4141     * @param extraAttributes the possibly empty list of extra attributes to persist with this entry
4142     * @return a new source classpath entry with the given exclusion patterns
4143     * @see IClasspathEntry#getInclusionPatterns()
4144     * @see IClasspathEntry#getExclusionPatterns()
4145     * @see IClasspathEntry#getOutputLocation()
4146     * @since 3.1
4147     */

4148    public static IClasspathEntry newSourceEntry(IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns, IPath specificOutputLocation, IClasspathAttribute[] extraAttributes) {
4149
4150        if (path == null) Assert.isTrue(false, "Source path cannot be null"); //$NON-NLS-1$
4151
if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
4152
if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$
4153
if (inclusionPatterns == null) Assert.isTrue(false, "Inclusion pattern set cannot be null"); //$NON-NLS-1$
4154

4155        return new ClasspathEntry(
4156            IPackageFragmentRoot.K_SOURCE,
4157            IClasspathEntry.CPE_SOURCE,
4158            path,
4159            inclusionPatterns,
4160            exclusionPatterns,
4161            null, // source attachment
4162
null, // source attachment root
4163
specificOutputLocation, // custom output location
4164
false,
4165            null,
4166            false, // no access rules to combine
4167
extraAttributes);
4168    }
4169
4170    /**
4171     * Creates and returns a new non-exported classpath entry of kind <code>CPE_VARIABLE</code>
4172     * for the given path. This method is fully equivalent to calling
4173     * {@link #newVariableEntry(IPath, IPath, IPath, IAccessRule[], IClasspathAttribute[], boolean)
4174     * newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, new IAccessRule[0], new IClasspathAttribute[0], false)}.
4175     *
4176     * @param variablePath the path of the binary archive; first segment is the
4177     * name of a classpath variable
4178     * @param variableSourceAttachmentPath the path of the corresponding source archive,
4179     * or <code>null</code> if none; if present, the first segment is the
4180     * name of a classpath variable (not necessarily the same variable
4181     * as the one that begins <code>variablePath</code>)
4182     * @param sourceAttachmentRootPath the location of the root of the source files within the source archive
4183     * or <code>null</code> if <code>variableSourceAttachmentPath</code> is also <code>null</code>
4184     * @return a new library classpath entry
4185     */

4186    public static IClasspathEntry newVariableEntry(
4187        IPath variablePath,
4188        IPath variableSourceAttachmentPath,
4189        IPath sourceAttachmentRootPath) {
4190
4191        return newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, false);
4192    }
4193
4194    /**
4195     * Creates and returns a new classpath entry of kind <code>CPE_VARIABLE</code>
4196     * for the given path. This method is fully equivalent to calling
4197     * {@link #newVariableEntry(IPath, IPath, IPath, IAccessRule[], IClasspathAttribute[], boolean)
4198     * newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, new IAccessRule[0], new IClasspathAttribute[0], isExported)}.
4199     *
4200     * @param variablePath the path of the binary archive; first segment is the
4201     * name of a classpath variable
4202     * @param variableSourceAttachmentPath the path of the corresponding source archive,
4203     * or <code>null</code> if none; if present, the first segment is the
4204     * name of a classpath variable (not necessarily the same variable
4205     * as the one that begins <code>variablePath</code>)
4206     * @param variableSourceAttachmentRootPath the location of the root of the source files within the source archive
4207     * or <code>null</code> if <code>variableSourceAttachmentPath</code> is also <code>null</code>
4208     * @param isExported indicates whether this entry is contributed to dependent
4209     * projects in addition to the output location
4210     * @return a new variable classpath entry
4211     * @since 2.0
4212     */

4213    public static IClasspathEntry newVariableEntry(
4214            IPath variablePath,
4215            IPath variableSourceAttachmentPath,
4216            IPath variableSourceAttachmentRootPath,
4217            boolean isExported) {
4218
4219        return newVariableEntry(
4220            variablePath,
4221            variableSourceAttachmentPath,
4222            variableSourceAttachmentRootPath,
4223            ClasspathEntry.NO_ACCESS_RULES,
4224            ClasspathEntry.NO_EXTRA_ATTRIBUTES,
4225            isExported);
4226    }
4227
4228    /**
4229     * Creates and returns a new classpath entry of kind <code>CPE_VARIABLE</code>
4230     * for the given path. The first segment of the path is the name of a classpath variable.
4231     * The trailing segments of the path will be appended to resolved variable path.
4232     * <p>
4233     * A variable entry allows to express indirect references on a classpath to other projects or libraries,
4234     * depending on what the classpath variable is referring.
4235     * <p>
4236     * It is possible to register an automatic initializer (<code>ClasspathVariableInitializer</code>),
4237     * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
4238     * After resolution, a classpath variable entry may either correspond to a project or a library entry.
4239     * <p>
4240     * e.g. Here are some examples of variable path usage<ul>
4241     * <li> "JDTCORE" where variable <code>JDTCORE</code> is
4242     * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"</li>
4243     * <li> "JDTCORE" where variable <code>JDTCORE</code> is
4244     * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"</li>
4245     * <li> "PLUGINS/com.example/example.jar" where variable <code>PLUGINS</code>
4246     * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:\eclipse\plugins\com.example\example.jar"</li>
4247     * </ul>
4248     * <p>
4249     * The access rules determine the set of accessible class files
4250     * in the project or library. If the list of access rules is empty then all files
4251     * in this project or library are accessible.
4252     * See {@link IAccessRule} for a detailed description of access rules.
4253     * </p>
4254     * <p>
4255     * The <code>extraAttributes</code> list contains name/value pairs that must be persisted with
4256     * this entry. If no extra attributes are provided, an empty array must be passed in.<br>
4257     * Note that this list should not contain any duplicate name.
4258     * </p>
4259     * <p>
4260     * The <code>isExported</code> flag indicates whether this entry is contributed to dependent
4261     * projects. If not exported, dependent projects will not see any of the classes from this entry.
4262     * If exported, dependent projects will concatenate the accessible files patterns of this entry with the
4263     * accessible files patterns of the projects, and they will concatenate the non accessible files patterns of this entry
4264     * with the non accessible files patterns of the project.
4265     * </p>
4266     * <p>
4267     * Note that this operation does not attempt to validate classpath variables
4268     * or access the resources at the given paths.
4269     * </p>
4270     *
4271     * @param variablePath the path of the binary archive; first segment is the
4272     * name of a classpath variable
4273     * @param variableSourceAttachmentPath the path of the corresponding source archive,
4274     * or <code>null</code> if none; if present, the first segment is the
4275     * name of a classpath variable (not necessarily the same variable
4276     * as the one that begins <code>variablePath</code>)
4277     * @param variableSourceAttachmentRootPath the location of the root of the source files within the source archive
4278     * or <code>null</code> if <code>variableSourceAttachmentPath</code> is also <code>null</code>
4279     * @param accessRules the possibly empty list of access rules for this entry
4280     * @param extraAttributes the possibly empty list of extra attributes to persist with this entry
4281     * @param isExported indicates whether this entry is contributed to dependent
4282     * projects in addition to the output location
4283     * @return a new variable classpath entry
4284     * @since 3.1
4285     */

4286    public static IClasspathEntry newVariableEntry(
4287            IPath variablePath,
4288            IPath variableSourceAttachmentPath,
4289            IPath variableSourceAttachmentRootPath,
4290            IAccessRule[] accessRules,
4291            IClasspathAttribute[] extraAttributes,
4292            boolean isExported) {
4293
4294        if (variablePath == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$
4295
if (variablePath.segmentCount() < 1) {
4296            Assert.isTrue(
4297                false,
4298                "Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$
4299
}
4300
4301        return new ClasspathEntry(
4302            IPackageFragmentRoot.K_SOURCE,
4303            IClasspathEntry.CPE_VARIABLE,
4304            variablePath,
4305            ClasspathEntry.INCLUDE_ALL, // inclusion patterns
4306
ClasspathEntry.EXCLUDE_NONE, // exclusion patterns
4307
variableSourceAttachmentPath, // source attachment
4308
variableSourceAttachmentRootPath, // source attachment root
4309
null, // specific output folder
4310
isExported,
4311            accessRules,
4312            false, // no access rules to combine
4313
extraAttributes);
4314    }
4315    /**
4316     * Removed the given classpath variable. Does nothing if no value was
4317     * set for this classpath variable.
4318     * <p>
4319     * This functionality cannot be used while the resource tree is locked.
4320     * <p>
4321     * Classpath variable values are persisted locally to the workspace, and
4322     * are preserved from session to session.
4323     * <p>
4324     *
4325     * @param variableName the name of the classpath variable
4326     * @see #setClasspathVariable(String, IPath)
4327     *
4328     * @deprecated Use {@link #removeClasspathVariable(String, IProgressMonitor)} instead
4329     */

4330    public static void removeClasspathVariable(String JavaDoc variableName) {
4331        removeClasspathVariable(variableName, null);
4332    }
4333
4334    /**
4335     * Removed the given classpath variable. Does nothing if no value was
4336     * set for this classpath variable.
4337     * <p>
4338     * This functionality cannot be used while the resource tree is locked.
4339     * <p>
4340     * Classpath variable values are persisted locally to the workspace, and
4341     * are preserved from session to session.
4342     * <p>
4343     *
4344     * @param variableName the name of the classpath variable
4345     * @param monitor the progress monitor to report progress
4346     * @see #setClasspathVariable(String, IPath)
4347     */

4348    public static void removeClasspathVariable(String JavaDoc variableName, IProgressMonitor monitor) {
4349        try {
4350            SetVariablesOperation operation = new SetVariablesOperation(new String JavaDoc[]{ variableName}, new IPath[]{ null }, true/*update preferences*/);
4351            operation.runOperation(monitor);
4352        } catch (JavaModelException e) {
4353            Util.log(e, "Exception while removing variable " + variableName); //$NON-NLS-1$
4354
}
4355    }
4356
4357    /**
4358     * Removes the given element changed listener.
4359     * Has no affect if an identical listener is not registered.
4360     *
4361     * @param listener the listener
4362     */

4363    public static void removeElementChangedListener(IElementChangedListener listener) {
4364        JavaModelManager.getJavaModelManager().deltaState.removeElementChangedListener(listener);
4365    }
4366
4367    /**
4368     * Removes the file extension from the given file name, if it has a Java-like file
4369     * extension. Otherwise the file name itself is returned.
4370     * Note this removes the dot ('.') before the extension as well.
4371     *
4372     * @param fileName the name of a file
4373     * @return the fileName without the Java-like extension
4374     * @since 3.2
4375     */

4376    public static String JavaDoc removeJavaLikeExtension(String JavaDoc fileName) {
4377        return Util.getNameWithoutJavaLikeExtension(fileName);
4378    }
4379
4380    /**
4381     * Removes the given pre-processing resource changed listener.
4382     * <p>
4383     * Has no affect if an identical listener is not registered.
4384     *
4385     * @param listener the listener
4386     * @since 3.0
4387     */

4388    public static void removePreProcessingResourceChangedListener(IResourceChangeListener listener) {
4389        JavaModelManager.getJavaModelManager().deltaState.removePreResourceChangedListener(listener);
4390    }
4391
4392
4393
4394    /**
4395     * Runs the given action as an atomic Java model operation.
4396     * <p>
4397     * After running a method that modifies java elements,
4398     * registered listeners receive after-the-fact notification of
4399     * what just transpired, in the form of a element changed event.
4400     * This method allows clients to call a number of
4401     * methods that modify java elements and only have element
4402     * changed event notifications reported at the end of the entire
4403     * batch.
4404     * </p>
4405     * <p>
4406     * If this method is called outside the dynamic scope of another such
4407     * call, this method runs the action and then reports a single
4408     * element changed event describing the net effect of all changes
4409     * done to java elements by the action.
4410     * </p>
4411     * <p>
4412     * If this method is called in the dynamic scope of another such
4413     * call, this method simply runs the action.
4414     * </p>
4415     *
4416     * @param action the action to perform
4417     * @param monitor a progress monitor, or <code>null</code> if progress
4418     * reporting and cancellation are not desired
4419     * @exception CoreException if the operation failed.
4420     * @since 2.1
4421     */

4422    public static void run(IWorkspaceRunnable action, IProgressMonitor monitor) throws CoreException {
4423        run(action, ResourcesPlugin.getWorkspace().getRoot(), monitor);
4424    }
4425    /**
4426     * Runs the given action as an atomic Java model operation.
4427     * <p>
4428     * After running a method that modifies java elements,
4429     * registered listeners receive after-the-fact notification of
4430     * what just transpired, in the form of a element changed event.
4431     * This method allows clients to call a number of
4432     * methods that modify java elements and only have element
4433     * changed event notifications reported at the end of the entire
4434     * batch.
4435     * </p>
4436     * <p>
4437     * If this method is called outside the dynamic scope of another such
4438     * call, this method runs the action and then reports a single
4439     * element changed event describing the net effect of all changes
4440     * done to java elements by the action.
4441     * </p>
4442     * <p>
4443     * If this method is called in the dynamic scope of another such
4444     * call, this method simply runs the action.
4445     * </p>
4446     * <p>
4447     * The supplied scheduling rule is used to determine whether this operation can be
4448     * run simultaneously with workspace changes in other threads. See
4449     * <code>IWorkspace.run(...)</code> for more details.
4450     * </p>
4451     *
4452     * @param action the action to perform
4453     * @param rule the scheduling rule to use when running this operation, or
4454     * <code>null</code> if there are no scheduling restrictions for this operation.
4455     * @param monitor a progress monitor, or <code>null</code> if progress
4456     * reporting and cancellation are not desired
4457     * @exception CoreException if the operation failed.
4458     * @since 3.0
4459     */

4460    public static void run(IWorkspaceRunnable action, ISchedulingRule rule, IProgressMonitor monitor) throws CoreException {
4461        IWorkspace workspace = ResourcesPlugin.getWorkspace();
4462        if (workspace.isTreeLocked()) {
4463            new BatchOperation(action).run(monitor);
4464        } else {
4465            // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode
4466
workspace.run(new BatchOperation(action), rule, IWorkspace.AVOID_UPDATE, monitor);
4467        }
4468    }
4469    /**
4470     * Bind a container reference path to some actual containers (<code>IClasspathContainer</code>).
4471     * This API must be invoked whenever changes in container need to be reflected onto the JavaModel.
4472     * Containers can have distinct values in different projects, therefore this API considers a
4473     * set of projects with their respective containers.
4474     * <p>
4475     * <code>containerPath</code> is the path under which these values can be referenced through
4476     * container classpath entries (<code>IClasspathEntry#CPE_CONTAINER</code>). A container path
4477     * is formed by a first ID segment followed with extra segments, which can be used as additional hints
4478     * for the resolution. The container ID is used to identify a <code>ClasspathContainerInitializer</code>
4479     * registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
4480     * <p>
4481     * There is no assumption that each individual container value passed in argument
4482     * (<code>respectiveContainers</code>) must answer the exact same path when requested
4483     * <code>IClasspathContainer#getPath</code>.
4484     * Indeed, the containerPath is just an indication for resolving it to an actual container object. It can be
4485     * delegated to a <code>ClasspathContainerInitializer</code>, which can be activated through the extension
4486     * point "org.eclipse.jdt.core.ClasspathContainerInitializer").
4487     * <p>
4488     * In reaction to changing container values, the JavaModel will be updated to reflect the new
4489     * state of the updated container. A combined Java element delta will be notified to describe the corresponding
4490     * classpath changes resulting from the container update. This operation is batched, and automatically eliminates
4491     * unnecessary updates (new container is same as old one). This operation acquires a lock on the workspace's root.
4492     * <p>
4493     * This functionality cannot be used while the workspace is locked, since
4494     * it may create/remove some resource markers.
4495     * <p>
4496     * Classpath container values are persisted locally to the workspace, but
4497     * are not preserved from a session to another. It is thus highly recommended to register a
4498     * <code>ClasspathContainerInitializer</code> for each referenced container
4499     * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer").
4500     * <p>
4501     * Note: setting a container to <code>null</code> will cause it to be lazily resolved again whenever
4502     * its value is required. In particular, this will cause a registered initializer to be invoked
4503     * again.
4504     * <p>
4505     * @param containerPath - the name of the container reference, which is being updated
4506     * @param affectedProjects - the set of projects for which this container is being bound
4507     * @param respectiveContainers - the set of respective containers for the affected projects
4508     * @param monitor a monitor to report progress
4509     * @throws JavaModelException
4510     * @see ClasspathContainerInitializer
4511     * @see #getClasspathContainer(IPath, IJavaProject)
4512     * @see IClasspathContainer
4513     * @since 2.0
4514     */

4515    public static void setClasspathContainer(IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException {
4516        if (affectedProjects.length != respectiveContainers.length)
4517            Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$
4518
SetContainerOperation operation = new SetContainerOperation(containerPath, affectedProjects, respectiveContainers);
4519        operation.runOperation(monitor);
4520    }
4521
4522    /**
4523     * Sets the value of the given classpath variable.
4524     * The path must have at least one segment.
4525     * <p>
4526     * This functionality cannot be used while the resource tree is locked.
4527     * <p>
4528     * Classpath variable values are persisted locally to the workspace, and
4529     * are preserved from session to session.
4530     * <p>
4531     *
4532     * @param variableName the name of the classpath variable
4533     * @param path the path
4534     * @throws JavaModelException
4535     * @see #getClasspathVariable(String)
4536     *
4537     * @deprecated Use {@link #setClasspathVariable(String, IPath, IProgressMonitor)} instead
4538     */

4539    public static void setClasspathVariable(String JavaDoc variableName, IPath path)
4540        throws JavaModelException {
4541
4542        setClasspathVariable(variableName, path, null);
4543    }
4544
4545    /**
4546     * Sets the value of the given classpath variable.
4547     * The path must not be null.
4548     * <p>
4549     * This functionality cannot be used while the resource tree is locked.
4550     * <p>
4551     * Classpath variable values are persisted locally to the workspace, and
4552     * are preserved from session to session.
4553     * <p>
4554     * Updating a variable with the same value has no effect.
4555     *
4556     * @param variableName the name of the classpath variable
4557     * @param path the path
4558     * @param monitor a monitor to report progress
4559     * @throws JavaModelException
4560     * @see #getClasspathVariable(String)
4561     */

4562    public static void setClasspathVariable(
4563        String JavaDoc variableName,
4564        IPath path,
4565        IProgressMonitor monitor)
4566        throws JavaModelException {
4567
4568        if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$
4569
setClasspathVariables(new String JavaDoc[]{variableName}, new IPath[]{ path }, monitor);
4570    }
4571
4572    /**
4573     * Sets the values of all the given classpath variables at once.
4574     * Null paths can be used to request corresponding variable removal.
4575     * <p>
4576     * A combined Java element delta will be notified to describe the corresponding
4577     * classpath changes resulting from the variables update. This operation is batched,
4578     * and automatically eliminates unnecessary updates (new variable is same as old one).
4579     * This operation acquires a lock on the workspace's root.
4580     * <p>
4581     * This functionality cannot be used while the workspace is locked, since
4582     * it may create/remove some resource markers.
4583     * <p>
4584     * Classpath variable values are persisted locally to the workspace, and
4585     * are preserved from session to session.
4586     * <p>
4587     * Updating a variable with the same value has no effect.
4588     *
4589     * @param variableNames an array of names for the updated classpath variables
4590     * @param paths an array of path updates for the modified classpath variables (null
4591     * meaning that the corresponding value will be removed
4592     * @param monitor a monitor to report progress
4593     * @throws JavaModelException
4594     * @see #getClasspathVariable(String)
4595     * @since 2.0
4596     */

4597    public static void setClasspathVariables(
4598        String JavaDoc[] variableNames,
4599        IPath[] paths,
4600        IProgressMonitor monitor)
4601        throws JavaModelException {
4602
4603        if (variableNames.length != paths.length) Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$
4604
SetVariablesOperation operation = new SetVariablesOperation(variableNames, paths, true/*update preferences*/);
4605        operation.runOperation(monitor);
4606    }
4607
4608    /**
4609     * Sets the default's compiler options inside the given options map according
4610     * to the given compliance.
4611     *
4612     * <p>The given compliance must be one of the compliance supported by the compiler.
4613     * See {@link #getDefaultOptions()} for a list of compliance values.</p>
4614     *
4615     * <p>The list of modified options is:</p>
4616     * <ul>
4617     * <li>{@link #COMPILER_CODEGEN_TARGET_PLATFORM}</li>
4618     * <li>{@link #COMPILER_SOURCE}</li>
4619     * <li>{@link #COMPILER_COMPLIANCE}</li>
4620     * <li>{@link #COMPILER_PB_ASSERT_IDENTIFIER}</li>
4621     * <li>{@link #COMPILER_PB_ENUM_IDENTIFIER}</li>
4622     * </ul>
4623     *
4624     * <p>If the given compliance is unknown, the given map is unmodified.</p>
4625     *
4626     * @param compliance the given compliance
4627     * @param options the given options map
4628     * @since 3.3
4629     */

4630    public static void setComplianceOptions(String JavaDoc compliance, Map JavaDoc options) {
4631        switch((int) (CompilerOptions.versionToJdkLevel(compliance) >>> 16)) {
4632            case ClassFileConstants.MAJOR_VERSION_1_3:
4633                options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_3);
4634                options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
4635                options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_1);
4636                options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.IGNORE);
4637                options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.IGNORE);
4638                break;
4639            case ClassFileConstants.MAJOR_VERSION_1_4:
4640                options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
4641                options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
4642                options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
4643                options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.WARNING);
4644                options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING);
4645                break;
4646            case ClassFileConstants.MAJOR_VERSION_1_5:
4647                options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
4648                options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
4649                options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
4650                options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
4651                options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR);
4652                options.put(JavaCore.COMPILER_CODEGEN_INLINE_JSR_BYTECODE, JavaCore.ENABLED);
4653                break;
4654            case ClassFileConstants.MAJOR_VERSION_1_6:
4655                options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_6);
4656                options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_6);
4657                options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_6);
4658                options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
4659                options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR);
4660                options.put(JavaCore.COMPILER_CODEGEN_INLINE_JSR_BYTECODE, JavaCore.ENABLED);
4661                break;
4662            case ClassFileConstants.MAJOR_VERSION_1_7:
4663                options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_7);
4664                options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_7);
4665                options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_7);
4666                options.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
4667                options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR);
4668                options.put(JavaCore.COMPILER_CODEGEN_INLINE_JSR_BYTECODE, JavaCore.ENABLED);
4669        }
4670    }
4671
4672    /**
4673     * Sets the current table of options. All and only the options explicitly
4674     * included in the given table are remembered; all previous option settings
4675     * are forgotten, including ones not explicitly mentioned.
4676     * <p>
4677     * For a complete description of the configurable options, see
4678     * <code>getDefaultOptions</code>.
4679     * </p>
4680     *
4681     * @param newOptions
4682     * the new options (key type: <code>String</code>; value type:
4683     * <code>String</code>), or <code>null</code> to reset all
4684     * options to their default values
4685     * @see JavaCore#getDefaultOptions()
4686     * @see JavaCorePreferenceInitializer for changing default settings
4687     */

4688    public static void setOptions(Hashtable JavaDoc newOptions) {
4689        JavaModelManager.getJavaModelManager().setOptions(newOptions);
4690    }
4691
4692    /* (non-Javadoc)
4693     * Shutdown the JavaCore plug-in.
4694     * <p>
4695     * De-registers the JavaModelManager as a resource changed listener and save participant.
4696     * <p>
4697     * @see org.eclipse.core.runtime.Plugin#stop(BundleContext)
4698     */

4699    public void stop(BundleContext context) throws Exception JavaDoc {
4700        try {
4701            JavaModelManager.getJavaModelManager().shutdown();
4702        } finally {
4703            // ensure we call super.stop as the last thing
4704
super.stop(context);
4705        }
4706    }
4707
4708    /* (non-Javadoc)
4709     * Startup the JavaCore plug-in.
4710     * <p>
4711     * Registers the JavaModelManager as a resource changed listener and save participant.
4712     * Starts the background indexing, and restore saved classpath variable values.
4713     * <p>
4714     * @throws Exception
4715     * @see org.eclipse.core.runtime.Plugin#start(BundleContext)
4716     */

4717    public void start(BundleContext context) throws Exception JavaDoc {
4718        super.start(context);
4719        JavaModelManager.getJavaModelManager().startup();
4720    }
4721}
Popular Tags