### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java,v retrieving revision 1.127 diff -u -r1.127 JavaBuilder.java --- model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java 31 Jan 2007 07:47:25 -0000 1.127 +++ model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java 12 Mar 2007 18:05:08 -0000 @@ -31,7 +31,7 @@ CompilationParticipant[] participants; NameEnvironment nameEnvironment; SimpleLookupTable binaryLocationsPerProject; // maps a project to its binary resources (output folders, class folders, zip/jar files) -State lastState; +public State lastState; BuildNotifier notifier; char[][] extraResourceFileFilters; String[] extraResourceFolderFilters; @@ -103,7 +103,7 @@ try { if (resource != null && resource.exists()) { resource.deleteMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE); - + // delete managed markers Set markerTypes = JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes(); if (markerTypes.size() == 0) return; @@ -130,7 +130,7 @@ if (resource != null && resource.exists()) { resource.deleteMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE); resource.deleteMarkers(IJavaModelMarker.TASK_MARKER, false, IResource.DEPTH_INFINITE); - + // delete managed markers Set markerTypes = JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes(); if (markerTypes.size() == 0) return; @@ -201,24 +201,24 @@ } catch (CoreException e) { Util.log(e, "JavaBuilder handling CoreException while building: " + currentProject.getName()); //$NON-NLS-1$ IMarker marker = currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); - marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_inconsistentProject, e.getLocalizedMessage())); + marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_inconsistentProject, e.getLocalizedMessage())); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH); marker.setAttribute(IMarker.SOURCE_ID, JavaBuilder.SOURCE_ID); } catch (ImageBuilderInternalException e) { Util.log(e.getThrowable(), "JavaBuilder handling ImageBuilderInternalException while building: " + currentProject.getName()); //$NON-NLS-1$ IMarker marker = currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); - marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_inconsistentProject, e.getLocalizedMessage())); + marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_inconsistentProject, e.getLocalizedMessage())); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH); marker.setAttribute(IMarker.SOURCE_ID, JavaBuilder.SOURCE_ID); } catch (MissingSourceFileException e) { // do not log this exception since its thrown to handle aborted compiles because of missing source files if (DEBUG) - System.out.println(Messages.bind(Messages.build_missingSourceFile, e.missingSourceFile)); + System.out.println(Messages.bind(Messages.build_missingSourceFile, e.missingSourceFile)); removeProblemsAndTasksFor(currentProject); // make this the only problem for this project IMarker marker = currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); - marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_missingSourceFile, e.missingSourceFile)); + marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_missingSourceFile, e.missingSourceFile)); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); marker.setAttribute(IMarker.SOURCE_ID, JavaBuilder.SOURCE_ID); } finally { @@ -237,7 +237,7 @@ private void buildAll() { notifier.checkCancel(); - notifier.subTask(Messages.bind(Messages.build_preparingBuild, this.currentProject.getName())); + notifier.subTask(Messages.bind(Messages.build_preparingBuild, this.currentProject.getName())); if (DEBUG && lastState != null) System.out.println("Clearing last state : " + lastState); //$NON-NLS-1$ clearLastState(); @@ -248,7 +248,7 @@ private void buildDeltas(SimpleLookupTable deltas) { notifier.checkCancel(); - notifier.subTask(Messages.bind(Messages.build_preparingBuild, this.currentProject.getName())); + notifier.subTask(Messages.bind(Messages.build_preparingBuild, this.currentProject.getName())); if (DEBUG && lastState != null) System.out.println("Clearing last state : " + lastState); //$NON-NLS-1$ clearLastState(); // clear the previously built state so if the build fails, a full build will occur next time @@ -280,7 +280,7 @@ } catch (CoreException e) { Util.log(e, "JavaBuilder handling CoreException while cleaning: " + currentProject.getName()); //$NON-NLS-1$ IMarker marker = currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); - marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_inconsistentProject, e.getLocalizedMessage())); + marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_inconsistentProject, e.getLocalizedMessage())); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); marker.setAttribute(IMarker.SOURCE_ID, JavaBuilder.SOURCE_ID); } finally { @@ -328,7 +328,7 @@ } private SimpleLookupTable findDeltas() { - notifier.subTask(Messages.bind(Messages.build_readingDelta, currentProject.getName())); + notifier.subTask(Messages.bind(Messages.build_readingDelta, currentProject.getName())); IResourceDelta delta = getDelta(currentProject); SimpleLookupTable deltas = new SimpleLookupTable(3); if (delta != null) { @@ -364,7 +364,7 @@ if (canSkip) continue nextProject; // project has no structural changes in its output folders } - notifier.subTask(Messages.bind(Messages.build_readingDelta, p.getName())); + notifier.subTask(Messages.bind(Messages.build_readingDelta, p.getName())); delta = getDelta(p); if (delta != null) { if (delta.getKind() != IResourceDelta.NO_CHANGE) { @@ -389,7 +389,7 @@ } /* Return the list of projects for which it requires a resource delta. This builder's project -* is implicitly included and need not be specified. Builders must re-specify the list +* is implicitly included and need not be specified. Builders must re-specify the list * of interesting projects every time they are run as this is not carried forward * beyond the next build. Missing projects should be specified but will be ignored until * they are added to the workspace. @@ -544,7 +544,7 @@ for (int i = 0, l = this.participants.length; i < l; i++) if (this.participants[i].aboutToBuild(this.javaProject) == CompilationParticipant.NEEDS_FULL_BUILD) kind = FULL_BUILD; - + // Flush the existing external files cache if this is the beginning of a build cycle String projectName = currentProject.getName(); if (builtProjects == null || builtProjects.contains(projectName)) { @@ -608,7 +608,7 @@ removeProblemsAndTasksFor(currentProject); // remove all compilation problems IMarker marker = currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); - marker.setAttribute(IMarker.MESSAGE, Messages.build_abortDueToClasspathProblems); + marker.setAttribute(IMarker.MESSAGE, Messages.build_abortDueToClasspathProblems); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH); marker.setAttribute(IMarker.SOURCE_ID, JavaBuilder.SOURCE_ID); @@ -646,8 +646,8 @@ IMarker marker = currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); marker.setAttribute(IMarker.MESSAGE, isClasspathBroken(prereq.getRawClasspath(), p) - ? Messages.bind(Messages.build_prereqProjectHasClasspathProblems, p.getName()) - : Messages.bind(Messages.build_prereqProjectMustBeRebuilt, p.getName())); + ? Messages.bind(Messages.build_prereqProjectHasClasspathProblems, p.getName()) + : Messages.bind(Messages.build_prereqProjectMustBeRebuilt, p.getName())); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH); marker.setAttribute(IMarker.SOURCE_ID, JavaBuilder.SOURCE_ID); @@ -671,7 +671,7 @@ if (participantPath != currentPath) { IProject project = workspaceRoot.getProject(participantPath.segment(0)); if (hasBeenBuilt(project)) { - if (DEBUG) + if (DEBUG) System.out.println("Requesting another build iteration since cycle participant " + project.getName() //$NON-NLS-1$ + " has not yet seen some structural changes"); //$NON-NLS-1$ needRebuild(); Index: model/org/eclipse/jdt/internal/core/builder/State.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/State.java,v retrieving revision 1.58 diff -u -r1.58 State.java --- model/org/eclipse/jdt/internal/core/builder/State.java 29 Mar 2006 03:08:49 -0000 1.58 +++ model/org/eclipse/jdt/internal/core/builder/State.java 12 Mar 2007 18:05:08 -0000 @@ -32,7 +32,7 @@ // keyed by the project relative path of the type (ie. "src1/p1/p2/A.java"), value is a ReferenceCollection or an AdditionalTypeCollection SimpleLookupTable references; // keyed by qualified type name "p1/p2/A", value is the project relative path which defines this type "src1/p1/p2/A.java" -SimpleLookupTable typeLocators; +public SimpleLookupTable typeLocators; int buildNumber; long lastStructuralBuildTime; @@ -97,8 +97,7 @@ this.typeLocators.put(keyTable[i], valueTable[i]); } } - -char[][] getDefinedTypeNamesFor(String typeLocator) { +public char[][] getDefinedTypeNamesFor(String typeLocator) { Object c = references.get(typeLocator); if (c instanceof AdditionalTypeCollection) return ((AdditionalTypeCollection) c).definedTypeNames; @@ -321,7 +320,7 @@ private static char[][] readNames(DataInputStream in) throws IOException { int length = in.readInt(); char[][] names = new char[length][]; - for (int i = 0; i < length; i++) + for (int i = 0; i < length; i++) names[i] = readName(in); return names; } @@ -627,7 +626,7 @@ AccessRule[] accessRules = accessRuleSet.getAccessRules(); int length = accessRules.length; out.writeInt(length); - if (length != 0) { + if (length != 0) { for (int i = 0; i < length; i++) { AccessRule accessRule = accessRules[i]; writeName(accessRule.pattern, out); Index: model/org/eclipse/jdt/core/JavaCore.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v retrieving revision 1.565 diff -u -r1.565 JavaCore.java --- model/org/eclipse/jdt/core/JavaCore.java 7 Mar 2007 16:09:14 -0000 1.565 +++ model/org/eclipse/jdt/core/JavaCore.java 12 Mar 2007 18:05:08 -0000 @@ -70,6 +70,7 @@ package org.eclipse.jdt.core; import java.io.File; +import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; @@ -128,14 +129,16 @@ *
*
* The single instance of this class can be accessed from any plug-in declaring
- * the Java model plug-in as a prerequisite via
+ * the Java model plug-in as a prerequisite via
* JavaCore.getJavaCore()
. The Java model plug-in will be activated
* automatically if not already active.
*
"org.eclipse.jdt.core"
).
@@ -157,7 +160,7 @@
/**
* The identifier for the Java nature
* (value "org.eclipse.jdt.core.javanature"
).
- * The presence of this nature on a project indicates that it is
+ * The presence of this nature on a project indicates that it is
* Java-capable.
*
* @see org.eclipse.core.resources.IProject#hasNature(java.lang.String)
@@ -175,7 +178,7 @@
* @since 3.0
*/
public static final String USER_LIBRARY_CONTAINER_ID= "org.eclipse.jdt.USER_LIBRARY"; //$NON-NLS-1$
-
+
// *************** Possible IDs for configurable options. ********************
/**
@@ -592,7 +595,7 @@
* @see #getDefaultOptions()
* @since 3.2
*/
- public static final String COMPILER_PB_FATAL_OPTIONAL_ERROR = PLUGIN_ID + ".compiler.problem.fatalOptionalError"; //$NON-NLS-1$
+ public static final String COMPILER_PB_FATAL_OPTIONAL_ERROR = PLUGIN_ID + ".compiler.problem.fatalOptionalError"; //$NON-NLS-1$
/**
* Possible configurable option ID.
* @see #getDefaultOptions()
@@ -646,7 +649,7 @@
* @see #getDefaultOptions()
* @since 3.0
*/
- public static final String COMPILER_TASK_CASE_SENSITIVE = PLUGIN_ID + ".compiler.taskCaseSensitive"; //$NON-NLS-1$
+ public static final String COMPILER_TASK_CASE_SENSITIVE = PLUGIN_ID + ".compiler.taskCaseSensitive"; //$NON-NLS-1$
/**
* Possible configurable option ID.
* @see #getDefaultOptions()
@@ -717,13 +720,13 @@
* @see #getDefaultOptions()
* @since 2.1
*/
- public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.cleanOutputFolder"; //$NON-NLS-1$
+ public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.cleanOutputFolder"; //$NON-NLS-1$
/**
* Possible configurable option ID.
* @see #getDefaultOptions()
* @since 3.2
*/
- public static final String CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.recreateModifiedClassFileInOutputFolder"; //$NON-NLS-1$
+ public static final String CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.recreateModifiedClassFileInOutputFolder"; //$NON-NLS-1$
/**
* Possible configurable option ID.
* @see #getDefaultOptions()
@@ -757,7 +760,7 @@
/**
* Possible configurable option ID.
* @see #getDefaultOptions()
- * @since 2.1
+ * @since 2.1
*/
public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + ".classpath.exclusionPatterns"; //$NON-NLS-1$
/**
@@ -768,13 +771,13 @@
public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + ".classpath.multipleOutputLocations"; //$NON-NLS-1$
/**
* Default task tag
- * @deprecated Use {@link #DEFAULT_TASK_TAGS} instead
+ * @deprecated Use {@link #DEFAULT_TASK_TAGS} instead
* @since 2.1
*/
public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$
/**
* Default task priority
- * @deprecated Use {@link #DEFAULT_TASK_PRIORITIES} instead
+ * @deprecated Use {@link #DEFAULT_TASK_PRIORITIES} instead
* @since 2.1
*/
public static final String DEFAULT_TASK_PRIORITY = "NORMAL"; //$NON-NLS-1$
@@ -962,7 +965,7 @@
* @since 3.2
*/
public static final String TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC = PLUGIN_ID + ".timeoutForParameterNameFromAttachedJavadoc"; //$NON-NLS-1$
-
+
/**
* Possible configurable option value.
* @see #getDefaultOptions()
@@ -1149,7 +1152,7 @@
/**
* Value of the content-type for Java source files. Use this value to retrieve the Java content type
* from the content type manager, and to add new Java-like extensions to this content type.
- *
+ *
* @see org.eclipse.core.runtime.content.IContentTypeManager#getContentType(String)
* @see #getJavaLikeExtensions()
* @since 3.2
@@ -1159,10 +1162,10 @@
/**
* Creates the Java core plug-in.
* - * The plug-in instance is created automatically by the + * The plug-in instance is created automatically by the * Eclipse platform. Clients must not call. *
- * + * * @since 3.0 */ public JavaCore() { @@ -1178,7 +1181,7 @@ * and any reconcile operation (POST_RECONCILE). * For finer control of the notification, useaddElementChangedListener(IElementChangedListener,int)
,
* which allows to specify a different eventMask.
- *
+ *
* @param listener the listener
* @see ElementChangedEvent
*/
@@ -1191,20 +1194,20 @@
* Has no effect if an identical listener is already registered.
* After completion of this method, the given listener will be registered for exactly
* the specified events. If they were previously registered for other events, they
- * will be deregistered.
+ * will be deregistered.
* * Once registered, a listener starts receiving notification of changes to - * java elements in the model. The listener continues to receive - * notifications until it is replaced or removed. + * java elements in the model. The listener continues to receive + * notifications until it is replaced or removed. *
*
* Listeners can listen for several types of event as defined in ElementChangeEvent
.
* Clients are free to register for any number of event types however if they register
* for more than one, it is their responsibility to ensure they correctly handle the
- * case where the same java element change shows up in multiple notifications.
+ * case where the same java element change shows up in multiple notifications.
* Clients are guaranteed to receive only the events for which they are registered.
*
* Has no effect if an identical listener is already registered. *
- * + * * @param listener the listener * @see #removePreProcessingResourceChangedListener(IResourceChangeListener) * @since 3.0 @@ -1249,13 +1252,13 @@ public static void addPreProcessingResourceChangedListener(IResourceChangeListener listener) { addPreProcessingResourceChangedListener(listener, IResourceChangeEvent.POST_CHANGE); } - + /** - * Adds the given listener for resource change events of the given types to the Java core. + * Adds the given listener for resource change events of the given types to the Java core. * The listener is guaranteed to be notified of the resource change event before * the Java core starts processing the resource change event itself. *- * If an identical listener is already registered, the given event types are added to the event types + * If an identical listener is already registered, the given event types are added to the event types * of interest to the listener. *
*@@ -1269,7 +1272,7 @@ * * This list may increase in the future. *
- * + * * @param listener the listener * @param eventMask the bit-wise OR of all event types of interest to the * listener @@ -1280,7 +1283,7 @@ public static void addPreProcessingResourceChangedListener(IResourceChangeListener listener, int eventMask) { JavaModelManager.getJavaModelManager().deltaState.addPreResourceChangedListener(listener, eventMask); } - + /** * Configures the given marker for the given Java element. * Used for markers, which denote a Java element rather than a resource. @@ -1296,12 +1299,12 @@ if (marker != null && element != null) marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); } - + /** * Returns the Java model element corresponding to the given handle identifier * generated byIJavaElement.getHandleIdentifier()
, or
* null
if unable to create the associated element.
- *
+ *
* @param handleIdentifier the given handle identifier
* @return the Java element corresponding to the handle identifier
*/
@@ -1314,9 +1317,9 @@
* generated by IJavaElement.getHandleIdentifier()
, or
* null
if unable to create the associated element.
* If the returned Java element is an ICompilationUnit
, its owner
- * is the given owner if such a working copy exists, otherwise the compilation unit
+ * is the given owner if such a working copy exists, otherwise the compilation unit
* is a primary compilation unit.
- *
+ *
* @param handleIdentifier the given handle identifier
* @param owner the owner of the returned compilation unit, ignored if the returned
* element is not a compilation unit
@@ -1331,14 +1334,14 @@
JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
return model.getHandleFromMemento(memento, owner);
}
-
+
/**
* Returns the Java element corresponding to the given file, or
* null
if unable to associate the given file
* with a Java element.
*
* The file must be one of:
ICompilationUnit
.class
file - the element returned is the corresponding IClassFile
.jar
file - the element returned is the corresponding IPackageFragmentRoot
* Creating a Java element has the side effect of creating and opening all of the
* element's parents if they are not yet open.
- *
+ *
* @param file the given file
* @return the Java element corresponding to the given file, or
* null
if unable to associate the given file
@@ -1363,7 +1366,7 @@
*
* Creating a Java element has the side effect of creating and opening all of the
* element's parents if they are not yet open.
- *
+ *
* @param folder the given folder
* @return the package fragment or package fragment root corresponding to the given folder, or
* null
if unable to associate the given folder with a Java element
@@ -1378,7 +1381,7 @@
* project's parents if they are not yet open.
*
* Note that no check is done at this time on the existence or the java nature of this project. - * + * * @param project the given project * @return the Java project corresponding to the given project, null if the given project is null */ @@ -1396,7 +1399,7 @@ *
* The resource must be one of:
IJavaProject
ICompilationUnit
.class
file - the element returned is the corresponding IClassFile
.jar
file - the element returned is the corresponding IPackageFragmentRoot
* Creating a Java element has the side effect of creating and opening all of the
* element's parents if they are not yet open.
- *
+ *
* @param resource the given resource
* @return the Java element corresponding to the given resource, or
* null
if unable to associate the given resource
@@ -1423,7 +1426,7 @@
*
* The resource must be one of:
IJavaProject
ICompilationUnit
.class
file - the element returned is the corresponding IClassFile
.jar
file - the element returned is the corresponding IPackageFragmentRoot
* Creating a Java element has the side effect of creating and opening all of the
* element's parents if they are not yet open.
- *
+ *
* @param resource the given resource
* @return the Java element corresponding to the given file, or
* null
if unable to associate the given file
@@ -1446,7 +1449,7 @@
}
/**
* Returns the Java model.
- *
+ *
* @param root the given root
* @return the Java model, or null
if the root is null
*/
@@ -1460,7 +1463,7 @@
* Creates and returns a class file element for
* the given .class
file. Returns null
if unable
* to recognize the class file.
- *
+ *
* @param file the given .class
file
* @return a class file element for the given .class
file, or null
if unable
* to recognize the class file
@@ -1470,10 +1473,10 @@
}
/**
* Creates and returns a compilation unit element for
- * the given source file (i.e. a file with one of the {@link JavaCore#getJavaLikeExtensions()
+ * the given source file (i.e. a file with one of the {@link JavaCore#getJavaLikeExtensions()
* Java-like extensions}). Returns null
if unable
* to recognize the compilation unit.
- *
+ *
* @param file the given source file
* @return a compilation unit element for the given source file, or null
if unable
* to recognize the compilation unit
@@ -1484,8 +1487,8 @@
/**
* Creates and returns a handle for the given JAR file.
* The Java model associated with the JAR's project may be
- * created as a side effect.
- *
+ * created as a side effect.
+ *
* @param file the given JAR file
* @return a handle for the given JAR file, or null
if unable to create a JAR package fragment root.
* (for example, if the JAR file represents a non-Java resource)
@@ -1494,33 +1497,33 @@
return JavaModelManager.createJarPackageFragmentRootFrom(file, null/*unknown java project*/);
}
- /**
+ /**
* Answers the project specific value for a given classpath container.
* In case this container path could not be resolved, then will answer null
.
* Both the container path and the project context are supposed to be non-null.
*
- * The containerPath is a formed by a first ID segment followed with extra segments, which can be
- * used as additional hints for resolution. If no container was ever recorded for this container path
- * onto this project (using setClasspathContainer
, then a
- * ClasspathContainerInitializer
will be activated if any was registered for this container
+ * The containerPath is a formed by a first ID segment followed with extra segments, which can be
+ * used as additional hints for resolution. If no container was ever recorded for this container path
+ * onto this project (using setClasspathContainer
, then a
+ * ClasspathContainerInitializer
will be activated if any was registered for this container
* ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
*
* There is no assumption that the returned container must answer the exact same containerPath
- * when requested IClasspathContainer#getPath
.
+ * when requested IClasspathContainer#getPath
.
* Indeed, the containerPath is just an indication for resolving it to an actual container object.
*
- * Classpath container values are persisted locally to the workspace, but
- * are not preserved from a session to another. It is thus highly recommended to register a
- * ClasspathContainerInitializer
for each referenced container
+ * Classpath container values are persisted locally to the workspace, but
+ * are not preserved from a session to another. It is thus highly recommended to register a
+ * ClasspathContainerInitializer
for each referenced container
* (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer").
*
* @param containerPath the name of the container, which needs to be resolved
* @param project a specific project in which the container is being resolved
* @return the corresponding classpath container or null
if unable to find one.
- *
+ *
* @exception JavaModelException if an exception occurred while resolving the container, or if the resolved container
- * contains illegal entries (contains CPE_CONTAINER entries or null entries).
- *
+ * contains illegal entries (contains CPE_CONTAINER entries or null entries).
+ *
* @see ClasspathContainerInitializer
* @see IClasspathContainer
* @see #setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor)
@@ -1533,18 +1536,18 @@
if (container == JavaModelManager.CONTAINER_INITIALIZATION_IN_PROGRESS) {
return manager.getPreviousSessionContainer(containerPath, project);
}
- return container;
+ return container;
}
/**
- * Helper method finding the classpath container initializer registered for a given classpath container ID
+ * Helper method finding the classpath container initializer registered for a given classpath container ID
* or null
if none was found while iterating over the contributions to extension point to
* the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
*
* A containerID is the first segment of any container path, used to identify the registered container initializer. *
* @param containerID - a containerID identifying a registered initializer
- * @return ClasspathContainerInitializer - the registered classpath container initializer or null
if
+ * @return ClasspathContainerInitializer - the registered classpath container initializer or null
if
* none was found.
* @since 2.1
*/
@@ -1577,7 +1580,7 @@
"CPContainer INIT - found initializer\n" + //$NON-NLS-1$
" container ID: " + containerID + '\n' + //$NON-NLS-1$
" class: " + configElements[j].getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
try {
Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
if (execExt instanceof ClasspathContainerInitializer){
@@ -1590,13 +1593,13 @@
"CPContainer INIT - failed to instanciate initializer\n" + //$NON-NLS-1$
" container ID: " + containerID + '\n' + //$NON-NLS-1$
" class: " + configElements[j].getAttribute("class"), //$NON-NLS-1$ //$NON-NLS-2$
- System.err);
+ System.err);
e.printStackTrace();
- }
+ }
}
}
}
- }
+ }
}
return null;
}
@@ -1605,7 +1608,7 @@
* Returns the path held in the given classpath variable.
* Returns null
if unable to bind.
*
- * Classpath variable values are persisted locally to the workspace, and + * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. *
* Note that classpath variables can be contributed registered initializers for,
@@ -1615,7 +1618,7 @@
* each session.
*
* @param variableName the name of the classpath variable
- * @return the path, or null
if none
+ * @return the path, or null
if none
* @see #setClasspathVariable(String, IPath)
*/
public static IPath getClasspathVariable(final String variableName) {
@@ -1625,7 +1628,7 @@
if (variablePath == JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS){
return manager.getPreviousSessionVariable(variableName);
}
-
+
if (variablePath != null) {
if (variablePath == JavaModelManager.CP_ENTRY_IGNORE_PATH)
return null;
@@ -1649,7 +1652,7 @@
// let OperationCanceledException go through
// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59363)
initializer.initialize(variableName);
-
+
variablePath = manager.variableGet(variableName); // initializer should have performed side-effect
if (variablePath == JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS) return null; // break cycle (initializer did not init or reentering call)
if (JavaModelManager.CP_RESOLVE_VERBOSE){
@@ -1695,17 +1698,17 @@
}
/**
- * Helper method finding the classpath variable initializer registered for a given classpath variable name
+ * Helper method finding the classpath variable initializer registered for a given classpath variable name
* or null
if none was found while iterating over the contributions to extension point to
* the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
*
* @param variable the given variable
- * @return ClasspathVariableInitializer - the registered classpath variable initializer or null
if
+ * @return ClasspathVariableInitializer - the registered classpath variable initializer or null
if
* none was found.
* @since 2.1
*/
public static ClasspathVariableInitializer getClasspathVariableInitializer(String variable){
-
+
Plugin jdtCorePlugin = JavaCore.getPlugin();
if (jdtCorePlugin == null) return null;
@@ -1724,7 +1727,7 @@
"CPVariable INIT - found initializer\n" + //$NON-NLS-1$
" variable: " + variable + '\n' + //$NON-NLS-1$
" class: " + configElements[j].getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
if (execExt instanceof ClasspathVariableInitializer){
ClasspathVariableInitializer initializer = (ClasspathVariableInitializer)execExt;
@@ -1746,20 +1749,20 @@
"CPContainer INIT - failed to instanciate initializer\n" + //$NON-NLS-1$
" variable: " + variable + '\n' + //$NON-NLS-1$
" class: " + configElements[j].getAttribute("class"), //$NON-NLS-1$ //$NON-NLS-2$
- System.err);
+ System.err);
e.printStackTrace();
- }
+ }
}
}
- }
+ }
}
return null;
- }
-
+ }
+
/**
* Returns the names of all known classpath variables.
*
- * Classpath variable values are persisted locally to the workspace, and + * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. *
*
@@ -1775,21 +1778,21 @@
* These options allow to configure the behaviour of the underlying components.
* The client may safely use the result as a template that they can modify and
* then pass to setOptions
.
- *
- * Helper constants have been defined on JavaCore for each of the option ID and
+ *
+ * Helper constants have been defined on JavaCore for each of the option ID and
* their possible constant values.
- *
+ *
* Note: more options might be added in further releases.
*
* RECOGNIZED OPTIONS: - * + * * COMPILER / Setting Compliance Level * Select the compliance level for the compiler. In "1.3" mode, source and target settings * should not go beyond "1.3" level. * - option id: "org.eclipse.jdt.core.compiler.compliance" * - possible values: { "1.3", "1.4", "1.5", "1.6", "1.7" } * - default: "1.4" - * + * * COMPILER / Setting Source Compatibility Mode * Specify whether which source level compatibility is used. From 1.4 on, 'assert' is a keyword * reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM @@ -1799,12 +1802,12 @@ * and the compliance mode should be "1.5". * Source level 1.6 is necessary to enable the computation of stack map tables. Once toggled, the target * VM level should be set to "1.6" and the compliance mode should be "1.6". - * Once the source level 1.7 is toggled, the target VM level should be set to "1.7" and the compliance mode + * Once the source level 1.7 is toggled, the target VM level should be set to "1.7" and the compliance mode * should be "1.7". * - option id: "org.eclipse.jdt.core.compiler.source" * - possible values: { "1.3", "1.4", "1.5", "1.6", "1.7" } * - default: "1.3" - * + * * COMPILER / Defining Target Java Platform * For binary compatibility reason, .class files can be tagged to with certain VM versions and later. * Note that "1.4" target requires to toggle compliance mode to "1.4", "1.5" target requires @@ -1815,45 +1818,45 @@ * - default: "1.2" * * COMPILER / Generating Local Variable Debug Attribute - * When generated, this attribute will enable local variable names - * to be displayed in debugger, only in place where variables are + * When generated, this attribute will enable local variable names + * to be displayed in debugger, only in place where variables are * definitely assigned (.class file is then bigger) * - option id: "org.eclipse.jdt.core.compiler.debug.localVariable" * - possible values: { "generate", "do not generate" } * - default: "generate" * - * COMPILER / Generating Line Number Debug Attribute - * When generated, this attribute will enable source code highlighting in debugger + * COMPILER / Generating Line Number Debug Attribute + * When generated, this attribute will enable source code highlighting in debugger * (.class file is then bigger). * - option id: "org.eclipse.jdt.core.compiler.debug.lineNumber" * - possible values: { "generate", "do not generate" } * - default: "generate" - * - * COMPILER / Generating Source Debug Attribute - * When generated, this attribute will enable the debugger to present the + * + * COMPILER / Generating Source Debug Attribute + * When generated, this attribute will enable the debugger to present the * corresponding source code. * - option id: "org.eclipse.jdt.core.compiler.debug.sourceFile" * - possible values: { "generate", "do not generate" } * - default: "generate" - * + * * COMPILER / Preserving Unused Local Variables - * Unless requested to preserve unused local variables (that is, never read), the + * Unless requested to preserve unused local variables (that is, never read), the * compiler will optimize them out, potentially altering debugging * - option id: "org.eclipse.jdt.core.compiler.codegen.unusedLocal" * - possible values: { "preserve", "optimize out" } * - default: "preserve" - * + * * COMPILER / Inline JSR Bytecode Instruction * When enabled, the compiler will no longer generate JSR instructions, but rather inline corresponding * subroutine code sequences (mostly corresponding to try finally blocks). The generated code will thus - * get bigger, but will load faster on virtual machines since the verification process is then much simpler. + * get bigger, but will load faster on virtual machines since the verification process is then much simpler. * This mode is anticipating support for the Java Specification Request 202. * Note that JSR inlining is optional only for target platform lesser than 1.5. From 1.5 on, the JSR * inlining is mandatory (also see related setting "org.eclipse.jdt.core.compiler.codegen.targetPlatform"). * - option id: "org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * COMPILER / Javadoc Comment Support * When this support is disabled, the compiler will ignore all javadoc problems options settings * and will not report any javadoc problem. It will also not find any reference in javadoc comment and @@ -1863,23 +1866,23 @@ * - default: "enabled" * * COMPILER / Reporting Attempt to Override Package-Default Method - * A package default method is not visible in a different package, and thus - * cannot be overridden. When enabling this option, the compiler will signal + * A package default method is not visible in a different package, and thus + * cannot be overridden. When enabling this option, the compiler will signal * such scenarii either as an error or a warning. * - option id: "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting Method With Constructor Name - * Naming a method with a constructor name is generally considered poor - * style programming. When enabling this option, the compiler will signal such + * Naming a method with a constructor name is generally considered poor + * style programming. When enabling this option, the compiler will signal such * scenarii either as an error or a warning. * - option id: "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting Deprecation - * When enabled, the compiler will signal use of deprecated API either as an + * When enabled, the compiler will signal use of deprecated API either as an * error or a warning. * - option id: "org.eclipse.jdt.core.compiler.problem.deprecation" * - possible values: { "error", "warning", "ignore" } @@ -1903,22 +1906,22 @@ * Locally to a try statement, some catch blocks may hide others . For example, * try { throw new java.io.CharConversionException(); * } catch (java.io.CharConversionException e) { - * } catch (java.io.IOException e) {}. - * When enabling this option, the compiler will issue an error or a warning for hidden + * } catch (java.io.IOException e) {}. + * When enabling this option, the compiler will issue an error or a warning for hidden * catch blocks corresponding to checked exceptions * - option id: "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting Unused Local - * When enabled, the compiler will issue an error or a warning for unused local + * When enabled, the compiler will issue an error or a warning for unused local * variables (that is, variables never read from) * - option id: "org.eclipse.jdt.core.compiler.problem.unusedLocal" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" * * COMPILER / Reporting Unused Parameter - * When enabled, the compiler will issue an error or a warning for unused method + * When enabled, the compiler will issue an error or a warning for unused method * parameters (that is, parameters never read from) * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameter" * - possible values: { "error", "warning", "ignore" } @@ -1939,14 +1942,14 @@ * - default: "disabled" * * COMPILER / Reporting Unused Import - * When enabled, the compiler will issue an error or a warning for unused import - * reference + * When enabled, the compiler will issue an error or a warning for unused import + * reference * - option id: "org.eclipse.jdt.core.compiler.problem.unusedImport" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting Unused Private Members - * When enabled, the compiler will issue an error or a warning whenever a private + * When enabled, the compiler will issue an error or a warning whenever a private * method or field is declared but never used within the same unit. * - option id: "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember" * - possible values: { "error", "warning", "ignore" } @@ -1958,30 +1961,30 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.noEffectAssignment" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting Empty Statements and Unnecessary Semicolons * When enabled, the compiler will issue an error or a warning if an empty statement or a * unnecessary semicolon is encountered. * - option id: "org.eclipse.jdt.core.compiler.problem.emptyStatement" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Unnecessary Type Check - * When enabled, the compiler will issue an error or a warning when a cast or an instanceof operation + * When enabled, the compiler will issue an error or a warning when a cast or an instanceof operation * is unnecessary. * - option id: "org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Unnecessary Else * When enabled, the compiler will issue an error or a warning when a statement is unnecessarily * nested within an else clause (in situation where then clause is not completing normally). * - option id: "org.eclipse.jdt.core.compiler.problem.unnecessaryElse" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Synthetic Access Emulation - * When enabled, the compiler will issue an error or a warning whenever it emulates + * When enabled, the compiler will issue an error or a warning whenever it emulates * access to a non-accessible member of an enclosing type. Such access can have * performance implications. * - option id: "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation" @@ -1989,26 +1992,26 @@ * - default: "ignore" * * COMPILER / Reporting Non-Externalized String Literal - * When enabled, the compiler will issue an error or a warning for non externalized - * String literal (that is, not tagged with //$NON-NLS-<n>$). + * When enabled, the compiler will issue an error or a warning for non externalized + * String literal (that is, not tagged with //$NON-NLS-<n>$). * - option id: "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Usage of 'assert' Identifier - * When enabled, the compiler will issue an error or a warning whenever 'assert' is + * When enabled, the compiler will issue an error or a warning whenever 'assert' is * used as an identifier (reserved keyword in 1.4) * - option id: "org.eclipse.jdt.core.compiler.problem.assertIdentifier" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting Usage of 'enum' Identifier - * When enabled, the compiler will issue an error or a warning whenever 'enum' is + * When enabled, the compiler will issue an error or a warning whenever 'enum' is * used as an identifier (reserved keyword in 1.5) * - option id: "org.eclipse.jdt.core.compiler.problem.enumIdentifier" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting Non-Static Reference to a Static Member * When enabled, the compiler will issue an error or a warning whenever a static field * or method is accessed with an expression receiver. A reference to a static member should @@ -2016,7 +2019,7 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting Indirect Reference to a Static Member * When enabled, the compiler will issue an error or a warning whenever a static field * or method is accessed in an indirect way. A reference to a static member should @@ -2024,18 +2027,18 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.indirectStaticAccess" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods * When enabled, the compiler will issue an error or a warning whenever an interface * defines a method incompatible with a non-inherited Object method. Until this conflict - * is resolved, such an interface cannot be implemented, For example, - * interface I { + * is resolved, such an interface cannot be implemented, For example, + * interface I { * int clone(); - * } + * } * - option id: "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting Usage of char[] Expressions in String Concatenations * When enabled, the compiler will issue an error or a warning whenever a char[] expression * is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}). @@ -2058,13 +2061,13 @@ * - default: "ignore" * * COMPILER / Reporting Special Parameter Hiding another Field - * When enabled, the compiler will signal cases where a constructor or setter method parameter declaration + * When enabled, the compiler will signal cases where a constructor or setter method parameter declaration * is hiding some field (either locally, inherited or defined in enclosing type). * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.localVariableHiding". * - option id: "org.eclipse.jdt.core.compiler.problem.specialParameterHidingField" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * COMPILER / Reporting Type Declaration Hiding another Type * When enabled, the compiler will issue an error or a warning in situations where a type parameter * declaration is hiding some type, when a nested type is hiding some type parameter, or when @@ -2079,7 +2082,7 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Undocumented Empty Block * When enabled, the compiler will issue an error or a warning when an empty block is detected and it is not * documented with any comment. @@ -2108,7 +2111,7 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * COMPILER / Reporting Unqualified Access to Field * When enabled, the compiler will issue an error or a warning when a field is access without any qualification. * In order to improve code readability, it should be qualified, e.g. 'x' should rather be written 'this.x'. @@ -2122,101 +2125,101 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting Raw Type Reference - * When enabled, the compiler will issue an error or a warning when detecting references to raw types. Raw types are - * discouraged, and are intended to help interfacing with legacy code. In the future, the language specification may + * When enabled, the compiler will issue an error or a warning when detecting references to raw types. Raw types are + * discouraged, and are intended to help interfacing with legacy code. In the future, the language specification may * reject raw references to generic types. * - option id: "org.eclipse.jdt.core.compiler.problem.rawTypeReference" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting final Bound for Type Parameter - * When enabled, the compiler will issue an error or a warning whenever a generic type parameter is associated with a + * When enabled, the compiler will issue an error or a warning whenever a generic type parameter is associated with a * bound corresponding to a final type; since final types cannot be further extended, the parameter is pretty useless. * - option id: "org.eclipse.jdt.core.compiler.problem.finalParameterBound" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting Missing Declaration of serialVersionUID Field on Serializable Class - * When enabled, the compiler will issue an error or a warning whenever a serializable class is missing a local declaration + * When enabled, the compiler will issue an error or a warning whenever a serializable class is missing a local declaration * of a serialVersionUID field. This field must be declared as static final and be of type long. * - option id: "org.eclipse.jdt.core.compiler.problem.missingSerialVersion" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting Varargs Argument Needing a Cast in Method/Constructor Invocation * When enabled, the compiler will issue an error or a warning whenever a varargs arguments should be cast - * when passed to a method/constructor invocation. (e.g. Class.getMethod(String name, Class ... args ) + * when passed to a method/constructor invocation. (e.g. Class.getMethod(String name, Class ... args ) * invoked with arguments ("foo", null)). * - option id: "org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting Null Dereference * When enabled, the compiler will issue an error or a warning whenever a * variable that is statically known to hold a null value is used to * access a field or method. - * + * * - option id: "org.eclipse.jdt.core.compiler.problem.nullReference" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Potential Null Dereference * When enabled, the compiler will issue an error or a warning whenever a - * variable that has formerly been tested against null but is not (no more) - * statically known to hold a non-null value is used to access a field or + * variable that has formerly been tested against null but is not (no more) + * statically known to hold a non-null value is used to access a field or * method. - * + * * - option id: "org.eclipse.jdt.core.compiler.problem.potentialNullReference" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Redundant Null Check * When enabled, the compiler will issue an error or a warning whenever a - * variable that is statically known to hold a null or a non-null value + * variable that is statically known to hold a null or a non-null value * is tested against null. - * + * * - option id: "org.eclipse.jdt.core.compiler.problem.redundantNullCheck" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Use of Annotation Type as Super Interface * When enabled, the compiler will issue an error or a warning whenever an annotation type is used * as a super-interface. Though legal, this is discouraged. * - option id: "org.eclipse.jdt.core.compiler.problem.annotationSuperInterface" * - possible values: { "error", "warning", "ignore" } * - default: "warning" - * + * * COMPILER / Reporting Missing @Override Annotation * When enabled, the compiler will issue an error or a warning whenever encountering a method * declaration which overrides a superclass method but has no @Override annotation. * - option id: "org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation" * - possible values: { "error", "warning", "ignore" } - * - default: "ignore" - * + * - default: "ignore" + * * COMPILER / Reporting Missing @Deprecated Annotation * When enabled, the compiler will issue an error or a warning whenever encountering a declaration * carrying a @deprecated doc tag but having no corresponding @Deprecated annotation. * - option id: "org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation" * - possible values: { "error", "warning", "ignore" } - * - default: "ignore" - * + * - default: "ignore" + * * COMPILER / Reporting Incomplete Enum Switch * When enabled, the compiler will issue an error or a warning whenever - * an enum constant has no corresponding case label in an enum switch + * an enum constant has no corresponding case label in an enum switch * statement. * - option id: "org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch" * - possible values: { "error", "warning", "ignore" } - * - default: "ignore" - * + * - default: "ignore" + * * COMPILER / Reporting Boxing/Unboxing Conversion * When enabled, the compiler will issue an error or a warning whenever a boxing or an unboxing * conversion is performed. * - option id: "org.eclipse.jdt.core.compiler.problem.autoboxing" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Invalid Javadoc Comment * This is the generic control for the severity of Javadoc problems. * When enabled, the compiler will issue an error or a warning for a problem in Javadoc. @@ -2229,7 +2232,7 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility" * - possible values: { "public", "protected", "default", "private" } * - default: "public" - * + * * COMPILER / Reporting Invalid Javadoc Tags * When enabled, the compiler will signal unbound or unexpected reference tags in Javadoc. * A 'throws' tag referencing an undeclared exception would be considered as unexpected. @@ -2240,7 +2243,7 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTags" * - possible values: { "disabled", "enabled" } * - default: "disabled" - * + * * COMPILER / Reporting Invalid Javadoc Tags with Deprecated References * Specify whether the compiler will report deprecated references used in Javadoc tags. *
Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc; @@ -2248,7 +2251,7 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * COMPILER / Reporting Invalid Javadoc Tags with Not Visible References * Specify whether the compiler will report non-visible references used in Javadoc tags. *
Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc; @@ -2256,7 +2259,7 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * COMPILER / Reporting Missing Javadoc Tags * This is the generic control for the severity of Javadoc missing tag problems. * When enabled, the compiler will issue an error or a warning when tags are missing in Javadoc comments. @@ -2266,19 +2269,19 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTags" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Visibility Level For Missing Javadoc Tags * Set the minimum visibility level for Javadoc missing tag problems. Below this level problems will be ignored. * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility" * - possible values: { "public", "protected", "default", "private" } * - default: "public" - * + * * COMPILER / Reporting Missing Javadoc Tags on Overriding Methods * Specify whether the compiler will verify overriding methods in order to report Javadoc missing tag problems. * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * COMPILER / Reporting Missing Javadoc Comments * This is the generic control for the severity of missing Javadoc comment problems. * When enabled, the compiler will issue an error or a warning when Javadoc comments are missing. @@ -2288,25 +2291,25 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocComments" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Visibility Level For Missing Javadoc Comments * Set the minimum visibility level for missing Javadoc problems. Below this level problems will be ignored. * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility" * - possible values: { "public", "protected", "default", "private" } * - default: "public" - * + * * COMPILER / Reporting Missing Javadoc Comments on Overriding Methods * Specify whether the compiler will verify overriding methods in order to report missing Javadoc comment problems. * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * COMPILER / Maximum Number of Problems Reported per Compilation Unit * Specify the maximum number of problems reported on each compilation unit. * - option id: "org.eclipse.jdt.core.compiler.maxProblemPerUnit" * - possible values: "<n>" where <n> is zero or a positive integer (if zero then all problems are reported). * - default: "100" - * + * * COMPILER / Treating Optional Error as Fatal * When enabled, optional errors (i.e. optional problems which severity is set to "error") will be treated as standard * compiler errors, yielding problem methods/types preventing from running offending code until the issue got resolved. @@ -2315,14 +2318,14 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.fatalOptionalError" * - possible values: { "enabled", "disabled" } * - default: "enabled" - * + * * COMPILER / Defining the Automatic Task Tags * When the tag list is not empty, the compiler will issue a task marker whenever it encounters * one of the corresponding tags inside any comment in Java source code. - * Generated task messages will start with the tag, and range until the next line separator, + * Generated task messages will start with the tag, and range until the next line separator, * comment ending, or tag. * When a given line of code bears multiple tags, each tag will be reported separately. - * Moreover, a tag immediately followed by another tag will be reported using the contents of the + * Moreover, a tag immediately followed by another tag will be reported using the contents of the * next non-empty tag of the line, if any. * Note that tasks messages are trimmed. If a tag is starting with a letter or digit, then it cannot be leaded by * another letter or digit to be recognized ("fooToDo" will not be recognized as a task for tag "ToDo", but "foo#ToDo" @@ -2330,9 +2333,9 @@ * by a letter or digit to be recognized ("ToDofoo" will not be recognized as a task for tag "ToDo", but "ToDo:foo" will * be detected either for tag "ToDo" or "ToDo:"). * - option id: "org.eclipse.jdt.core.compiler.taskTags" - * - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces + * - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces * - default: "TODO,FIXME,XXX" - * + * * COMPILER / Defining the Automatic Task Priorities * In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low) * of the task markers issued by the compiler. @@ -2340,7 +2343,7 @@ * - option id: "org.eclipse.jdt.core.compiler.taskPriorities" * - possible values: { "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW" * - default: "NORMAL,HIGH,NORMAL" - * + * * COMPILER / Determining whether task tags are case-sensitive * When enabled, task tags are considered in a case-sensitive way. * - option id: "org.eclipse.jdt.core.compiler.taskCaseSensitive" @@ -2362,7 +2365,7 @@ * - default: "warning" * * COMPILER / Determining Effect of @SuppressWarnings - * When enabled, the @SuppressWarnings annotation can be used to suppress some compiler warnings. + * When enabled, the @SuppressWarnings annotation can be used to suppress some compiler warnings. * When disabled, all @SupressWarnings annotations are ignored; i.e., warnings are reported. * - option id: "org.eclipse.jdt.core.compiler.problem.suppressWarnings" * - possible values: { "enabled", "disabled" } @@ -2389,41 +2392,41 @@ * - option id: "org.eclipse.jdt.core.compiler.problem.parameterAssignment" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Switch Fall-Through Case * When enabled, the compiler will issue an error or a warning if a case may be * entered by falling through previous case. Empty cases are allowed. * - option id: "org.eclipse.jdt.core.compiler.problem.fallthroughCase" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * COMPILER / Reporting Overriding method that doesn't call the super method invocation * When enabled, the compiler will issue an error or a warning if a method is overriding a method without calling * the super invocation. * - option id: "org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * BUILDER / Specifying Filters for Resource Copying Control * Allow to specify some filters to control the resource copy process. * - option id: "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter" * - possible values: { "<name>[,<name>]* } where <name> is a file name pattern (* and ? wild-cards allowed) * or the name of a folder which ends with '/' * - default: "" - * + * * BUILDER / Abort if Invalid Classpath * Allow to toggle the builder to abort if the classpath is invalid * - option id: "org.eclipse.jdt.core.builder.invalidClasspath" * - possible values: { "abort", "ignore" } * - default: "abort" - * + * * BUILDER / Cleaning Output Folder(s) * Indicate whether the JavaBuilder is allowed to clean the output folders * when performing full build operations. * - option id: "org.eclipse.jdt.core.builder.cleanOutputFolder" * - possible values: { "clean", "ignore" } * - default: "clean" - * + * * BUILDER / Recreate Modified class files in Output Folder * Indicate whether the JavaBuilder should check for any changes to .class files * in the output folders while performing incremental build operations. If changes @@ -2433,235 +2436,235 @@ * - option id: "org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder" * - possible values: { "enabled", "ignore" } * - default: "ignore" - * + * * BUILDER / Reporting Duplicate Resources * Indicate the severity of the problem reported when more than one occurrence * of a resource is to be copied into the output location. * - option id: "org.eclipse.jdt.core.builder.duplicateResourceTask" * - possible values: { "error", "warning" } * - default: "warning" - * + * * JAVACORE / Computing Project Build Order * Indicate whether JavaCore should enforce the project build order to be based on * the classpath prerequisite chain. When requesting to compute, this takes over * the platform default order (based on project references). * - option id: "org.eclipse.jdt.core.computeJavaBuildOrder" * - possible values: { "compute", "ignore" } - * - default: "ignore" - * + * - default: "ignore" + * * JAVACORE / Default Source Encoding Format * Get the default encoding format of source files. This value is - * immutable and preset to the result of ResourcesPlugin.getEncoding(). + * immutable and preset to the result of ResourcesPlugin.getEncoding(). * It is offered as a convenience shortcut only. * - option id: "org.eclipse.jdt.core.encoding" * - value: <immutable, platform default value> - * + * * JAVACORE / Reporting Incomplete Classpath - * Indicate the severity of the problem reported when an entry on the classpath does not exist, + * Indicate the severity of the problem reported when an entry on the classpath does not exist, * is not legite or is not visible (for example, a referenced project is closed). * - option id: "org.eclipse.jdt.core.incompleteClasspath" * - possible values: { "error", "warning"} * - default: "error" - * + * * JAVACORE / Reporting Classpath Cycle * Indicate the severity of the problem reported when a project is involved in a cycle. * - option id: "org.eclipse.jdt.core.circularClasspath" * - possible values: { "error", "warning" } * - default: "error" - * + * * JAVACORE / Reporting Incompatible JDK Level for Required Binaries - * Indicate the severity of the problem reported when a project prerequisites another project + * Indicate the severity of the problem reported when a project prerequisites another project * or library with an incompatible target JDK level (e.g. project targeting 1.1 vm, but compiled against 1.4 libraries). * - option id: "org.eclipse.jdt.core.incompatibleJDKLevel" * - possible values: { "error", "warning", "ignore" } * - default: "ignore" - * + * * JAVACORE / Enabling Usage of Classpath Exclusion Patterns * When disabled, no entry on a project classpath can be associated with * an exclusion pattern. * - option id: "org.eclipse.jdt.core.classpath.exclusionPatterns" * - possible values: { "enabled", "disabled" } * - default: "enabled" - * + * * JAVACORE / Enabling Usage of Classpath Multiple Output Locations * When disabled, no entry on a project classpath can be associated with * a specific output location, preventing thus usage of multiple output locations. * - option id: "org.eclipse.jdt.core.classpath.multipleOutputLocations" * - possible values: { "enabled", "disabled" } * - default: "enabled" - * + * * JAVACORE / Set the timeout value for retrieving the method's parameter names from javadoc * Timeout in milliseconds to retrieve the method's parameter names from javadoc. * If the value is 0, the parameter names are not fetched and the raw names are returned. * - option id: "org.eclipse.jdt.core.timeoutForParameterNameFromAttachedJavadoc" * - possible values: "<n>", where n is an integer greater than or equal to 0 * - default: "50" - * + * * DEPRECATED SEE DefaultCodeFormatterOptions: FORMATTER / Inserting New Line Before Opening Brace * When Insert, a new line is inserted before an opening brace, otherwise nothing * is inserted * - option id: "org.eclipse.jdt.core.formatter.newline.openingBrace" * - possible values: { "insert", "do not insert" } * - default: "do not insert" - * + * * DEPRECATED SEE DefaultCodeFormatterOptions: FORMATTER / Inserting New Line Inside Control Statement * When Insert, a new line is inserted between } and following else, catch, finally * - option id: "org.eclipse.jdt.core.formatter.newline.controlStatement" * - possible values: { "insert", "do not insert" } * - default: "do not insert" - * + * * DEPRECATED SEE DefaultCodeFormatterOptions: Clearing Blank Lines * When Clear all, all blank lines are removed. When Preserve one, only one is kept * and all others removed. * - option id: "org.eclipse.jdt.core.formatter.newline.clearAll" * - possible values: { "clear all", "preserve one" } * - default: "preserve one" - * - * DEPRECATED SEE DefaultCodeFormatterOptions: Inserting New Line Between Else/If - * When Insert, a blank line is inserted between an else and an if when they are + * + * DEPRECATED SEE DefaultCodeFormatterOptions: Inserting New Line Between Else/If + * When Insert, a blank line is inserted between an else and an if when they are * contiguous. When choosing to not insert, else-if will be kept on the same * line when possible. * - option id: "org.eclipse.jdt.core.formatter.newline.elseIf" * - possible values: { "insert", "do not insert" } * - default: "do not insert" - * + * * DEPRECATED SEE DefaultCodeFormatterOptions: Inserting New Line In Empty Block * When insert, a line break is inserted between contiguous { and }, if } is not followed * by a keyword. * - option id: "org.eclipse.jdt.core.formatter.newline.emptyBlock" * - possible values: { "insert", "do not insert" } * - default: "insert" - * + * * DEPRECATED SEE DefaultCodeFormatterOptions: Splitting Lines Exceeding Length * Enable splitting of long lines (exceeding the configurable length). Length of 0 will * disable line splitting * - option id: "org.eclipse.jdt.core.formatter.lineSplit" * - possible values: "<n>", where n is zero or a positive integer * - default: "80" - * + * * DEPRECATED SEE DefaultCodeFormatterOptions: Compacting Assignment * Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space * is inserted before the assignment operator * - option id: "org.eclipse.jdt.core.formatter.style.assignment" * - possible values: { "compact", "normal" } * - default: "normal" - * + * * DEPRECATED SEE DefaultCodeFormatterOptions: Defining Indentation Character * Either choose to indent with tab characters or spaces * - option id: "org.eclipse.jdt.core.formatter.tabulation.char" * - possible values: { "tab", "space" } * - default: "tab" - * + * * DEPRECATED SEE DefaultCodeFormatterOptions: Defining Space Indentation Length - * When using spaces, set the amount of space characters to use for each + * When using spaces, set the amount of space characters to use for each * indentation mark. * - option id: "org.eclipse.jdt.core.formatter.tabulation.size" * - possible values: "<n>", where n is a positive integer * - default: "4" - * + * * DEPRECATED SEE DefaultCodeFormatterOptions: Inserting space in cast expression * When Insert, a space is added between the type and the expression in a cast expression. * - option id: "org.eclipse.jdt.core.formatter.space.castexpression" * - possible values: { "insert", "do not insert" } * - default: "insert" - * + * * CODEASSIST / Activate Visibility Sensitive Completion * When active, completion doesn't show that you can not see * (for example, you can not see private methods of a super class). * - option id: "org.eclipse.jdt.core.codeComplete.visibilityCheck" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * CODEASSIST / Activate Deprecation Sensitive Completion * When enabled, completion doesn't propose deprecated members and types. * - option id: "org.eclipse.jdt.core.codeComplete.deprecationCheck" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * CODEASSIST / Automatic Qualification of Implicit Members * When active, completion automatically qualifies completion on implicit * field references and message expressions. * - option id: "org.eclipse.jdt.core.codeComplete.forceImplicitQualification" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * CODEASSIST / Define the Prefixes for Field Name * When the prefixes is non empty, completion for field name will begin with * one of the proposed prefixes. * - option id: "org.eclipse.jdt.core.codeComplete.fieldPrefixes" - * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card + * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card * - default: "" - * + * * CODEASSIST / Define the Prefixes for Static Field Name * When the prefixes is non empty, completion for static field name will begin with * one of the proposed prefixes. * - option id: "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes" - * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card + * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card * - default: "" - * + * * CODEASSIST / Define the Prefixes for Local Variable Name * When the prefixes is non empty, completion for local variable name will begin with * one of the proposed prefixes. * - option id: "org.eclipse.jdt.core.codeComplete.localPrefixes" - * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card + * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card * - default: "" - * + * * CODEASSIST / Define the Prefixes for Argument Name * When the prefixes is non empty, completion for argument name will begin with * one of the proposed prefixes. * - option id: "org.eclipse.jdt.core.codeComplete.argumentPrefixes" - * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card + * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card * - default: "" - * + * * CODEASSIST / Define the Suffixes for Field Name * When the suffixes is non empty, completion for field name will end with * one of the proposed suffixes. * - option id: "org.eclipse.jdt.core.codeComplete.fieldSuffixes" - * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card + * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card * - default: "" - * + * * CODEASSIST / Define the Suffixes for Static Field Name * When the suffixes is non empty, completion for static field name will end with * one of the proposed suffixes. * - option id: "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes" - * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card + * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card * - default: "" - * + * * CODEASSIST / Define the Suffixes for Local Variable Name * When the suffixes is non empty, completion for local variable name will end with * one of the proposed suffixes. * - option id: "org.eclipse.jdt.core.codeComplete.localSuffixes" - * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card + * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card * - default: "" - * + * * CODEASSIST / Define the Suffixes for Argument Name * When the suffixes is non empty, completion for argument name will end with * one of the proposed suffixes. * - option id: "org.eclipse.jdt.core.codeComplete.argumentSuffixes" - * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card + * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card * - default: "" - * + * * CODEASSIST / Activate Forbidden Reference Sensitive Completion * When enabled, completion doesn't propose elements which match a * forbidden reference rule. * - option id: "org.eclipse.jdt.core.codeComplete.forbiddenReferenceCheck" * - possible values: { "enabled", "disabled" } * - default: "enabled" - * + * * CODEASSIST / Activate Discouraged Reference Sensitive Completion * When enabled, completion doesn't propose elements which match a * discouraged reference rule. * - option id: "org.eclipse.jdt.core.codeComplete.discouragedReferenceCheck" * - possible values: { "enabled", "disabled" } * - default: "disabled" - * + * * CODEASSIST / Activate Camel Case Sensitive Completion - * When enabled, completion shows proposals whose name match the CamelCase + * When enabled, completion shows proposals whose name match the CamelCase * pattern. * - option id: "org.eclipse.jdt.core.codeComplete.camelCaseMatch" * - possible values: { "enabled", "disabled" } * - default: "enabled" - * + * * CODEASSIST / Activate Suggestion of Static Import * When enabled, completion proposals can contain static import * pattern. @@ -2676,7 +2679,7 @@ /** * Returns the workspace root default charset encoding. - * + * * @return the name of the default charset encoding for workspace root. * @see IContainer#getDefaultCharset() * @see ResourcesPlugin#getEncoding() @@ -2696,36 +2699,244 @@ } /** + * Returns an array that contains the resources generated by the Java builder when building the + * compilation units contained in the given region. + *The contents of the array is accurate only if the elements of the given region have been built.
+ * + * @param region the given region + * @param includesNonJavaResources a flag that indicates if non-java resources should be included + * + * @return an array that contains the resources generated by the Java builder when building the + * compilation units contained in the given region, an empty array if none + * @exception IllegalArgumentException if the given region isnull
+ * @since 3.3 + */ + public static IResource[] getGeneratedResources(IRegion region, boolean includesNonJavaResources) { + if (region == null) throw new IllegalArgumentException("region cannot be null"); //$NON-NLS-1$ + IJavaElement[] elements = region.getElements(); + HashMap projectsStates = new HashMap(); + ArrayList collector = new ArrayList(); + for (int i = 0, max = elements.length; i < max; i++) { + // collect all the java project + IJavaElement element = elements[i]; + IJavaProject javaProject = element.getJavaProject(); + IProject project = javaProject.getProject(); + State state = null; + State currentState = (State) projectsStates.get(project); + if (currentState != null) { + state = currentState; + } else { + state = (State) JavaModelManager.getJavaModelManager().getLastBuiltState(project, null); + if (state != null) { + projectsStates.put(project, state); + } + } + if (state == null) continue; + if (element.getElementType() == IJavaElement.JAVA_PROJECT) { + IPackageFragmentRoot[] roots = null; + try { + roots = javaProject.getAllPackageFragmentRoots(); + } catch (JavaModelException e) { + // ignore + } + if (roots == null) continue; + IRegion region2 = JavaCore.newRegion(); + for (int j = 0; j < roots.length; j++) { + region2.add(roots[j]); + } + IResource[] res = getGeneratedResources(region2, includesNonJavaResources); + for (int j = 0, max2 = res.length; j < max2; j++) { + collector.add(res[j]); + } + continue; + } + IPath outputLocation = null; + try { + outputLocation = javaProject.getOutputLocation(); + } catch (JavaModelException e) { + // ignore + } + IJavaElement root = element; + while (root != null && root.getElementType() != IJavaElement.PACKAGE_FRAGMENT_ROOT) { + root = root.getParent(); + } + if (root == null) continue; + IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) root; + int rootPathSegmentCounts = packageFragmentRoot.getPath().segmentCount(); + try { + IClasspathEntry entry = packageFragmentRoot.getRawClasspathEntry(); + IPath entryOutputLocation = entry.getOutputLocation(); + if (entryOutputLocation != null) { + outputLocation = entryOutputLocation; + } + } catch (JavaModelException e) { + e.printStackTrace(); + } + if (outputLocation == null) continue; + IContainer container = (IContainer) project.getWorkspace().getRoot().findMember(outputLocation); + switch(element.getElementType()) { + case IJavaElement.COMPILATION_UNIT : + // get the .class files generated when this element was built + ICompilationUnit unit = (ICompilationUnit) element; + getGeneratedResource(unit, container, state, rootPathSegmentCounts, collector); + break; + case IJavaElement.PACKAGE_FRAGMENT : + // collect all the .class files generated when all the units in this package were built + IPackageFragment fragment = (IPackageFragment) element; + ICompilationUnit[] compilationUnits = null; + try { + compilationUnits = fragment.getCompilationUnits(); + } catch (JavaModelException e) { + // ignore + } + if (compilationUnits == null) continue; + for (int j = 0, max2 = compilationUnits.length; j < max2; j++) { + getGeneratedResource(compilationUnits[j], container, state, rootPathSegmentCounts, collector); + } + if (includesNonJavaResources) { + // retrieve all non-java resources from the output location using the package fragment path + IPath path = fragment.getPath().removeFirstSegments(rootPathSegmentCounts); + IResource member = container.findMember(path); + if (member.getType() == IResource.FOLDER) { + IFolder folder = (IFolder) member; + IResource[] members = null; + try { + members = folder.members(); + } catch (CoreException e) { + // ignore + } + if (members != null) { + for (int j = 0, max2 = members.length; j < max2; j++) { + IResource localMember = members[j]; + if (localMember.getType() == IResource.FILE) { + String fileName = localMember.getFileExtension(); + if (!"class".equals(fileName.toLowerCase()) && localMember.exists()) { //$NON-NLS-1$ + collector.add(localMember); + } + } + } + } + } + } + break; + case IJavaElement.PACKAGE_FRAGMENT_ROOT : + // collect all the .class files generated when all the units in this package were built + IPackageFragmentRoot fragmentRoot = (IPackageFragmentRoot) element; + if (fragmentRoot.isArchive()) continue; + IJavaElement[] children = null; + try { + children = fragmentRoot.getChildren(); + } catch (JavaModelException e) { + // ignore + } + if (children == null) continue; + for (int j = 0, max2 = children.length; j < max2; j++) { + IPackageFragment packageFragment = (IPackageFragment) children[j]; + ICompilationUnit[] units = null; + try { + units = packageFragment.getCompilationUnits(); + } catch (JavaModelException e) { + // ignore + } + if (units == null) continue; + for (int n = 0, max3 = units.length; n < max3; n++) { + getGeneratedResource(units[n], container, state, rootPathSegmentCounts, collector); + } + if (includesNonJavaResources) { + // retrieve all non-java resources from the output location using the package fragment path + IPath path = packageFragment.getPath().removeFirstSegments(rootPathSegmentCounts); + IResource member = container.findMember(path); + if (member.getType() == IResource.FOLDER) { + IFolder folder = (IFolder) member; + IResource[] members = null; + try { + members = folder.members(); + } catch (CoreException e) { + // ignore + } + if (members != null) { + for (int n = 0, max3 = members.length; n < max3; n++) { + IResource localMember = members[n]; + if (localMember.getType() == IResource.FILE) { + String fileName = localMember.getFileExtension(); + if (!"class".equals(fileName.toLowerCase()) && localMember.exists()) { //$NON-NLS-1$ + collector.add(localMember); + } + } + } + } + } + } + } + break; + } + } + int size = collector.size(); + if (size != 0) { + IResource[] result = new IResource[size]; + collector.toArray(result); + return result; + } + return NO_GENERATED_RESOURCES; + } + + private static void getGeneratedResource(ICompilationUnit unit, + IContainer container, + State state, + int rootPathSegmentCounts, + ArrayList collector) { + IResource resource = unit.getResource(); + char[][] typeNames = state.getDefinedTypeNamesFor(resource.getProjectRelativePath().toString()); + if (typeNames != null) { + IPath path = unit.getPath().removeFirstSegments(rootPathSegmentCounts).removeLastSegments(1); + for (int j = 0, max2 = typeNames.length; j < max2; j++) { + IPath localPath = path.append(new String(typeNames[j]) + ".class"); //$NON-NLS-1$ + IResource member = container.findMember(localPath); + if (member != null) { + collector.add(member); + } + } + } else { + IPath path = unit.getPath().removeFirstSegments(rootPathSegmentCounts).removeLastSegments(1); + path = path.append(Util.getNameWithoutJavaLikeExtension(unit.getElementName()) + ".class"); //$NON-NLS-1$ + IResource member = container.findMember(path); + if (member != null) { + collector.add(member); + } + } + } + + /** * Returns the single instance of the Java core plug-in runtime class. * Equivalent to(JavaCore) getPlugin()
. - * + * * @return the single instance of the Java core plug-in runtime class */ public static JavaCore getJavaCore() { return (JavaCore) getPlugin(); } - + /** * Returns the list of known Java-like extensions. - * Java like extension are defined in the {@link org.eclipse.core.runtime.Platform#getContentTypeManager() + * Java like extension are defined in the {@link org.eclipse.core.runtime.Platform#getContentTypeManager() * content type manager} for the {@link #JAVA_SOURCE_CONTENT_TYPE}. * Note that a Java-like extension doesn't include the leading dot ('.'). * Also note that the "java" extension is always defined as a Java-like extension. - * + * * @return the list of known Java-like extensions. * @since 3.2 */ public static String[] getJavaLikeExtensions() { return CharOperation.toStrings(Util.getJavaLikeExtensions()); } - + /** * Helper method for returning one option value only. Equivalent to(String)JavaCore.getOptions().get(optionName)
* Note that it may answernull
if this option does not exist. ** For a complete description of the configurable options, see
- * + * * @param optionName the name of an option * @return the String value of a given option * @see JavaCore#getDefaultOptions() @@ -2735,14 +2946,14 @@ public static String getOption(String optionName) { return JavaModelManager.getJavaModelManager().getOption(optionName); } - + /** * Returns the table of the current options. Initially, all options have their default values, * and this method returns a table that includes all known options. *getDefaultOptions
. *For a complete description of the configurable options, see
*getDefaultOptions
.Returns a default set of options even if the platform is not running.
- * - * @return table of current settings of all options + * + * @return table of current settings of all options * (key type:String
; value type:String
) * @see #getDefaultOptions() * @see JavaCorePreferenceInitializer for changing default settings @@ -2753,7 +2964,7 @@ /** * Returns the single instance of the Java core plug-in runtime class. - * + * * @return the single instance of the Java core plug-in runtime class */ public static Plugin getPlugin() { @@ -2761,9 +2972,9 @@ } /** - * This is a helper method, which returns the resolved classpath entry denoted - * by a given entry (if it is a variable entry). It is obtained by resolving the variable - * reference in the first segment. Returnsnull
if unable to resolve using + * This is a helper method, which returns the resolved classpath entry denoted + * by a given entry (if it is a variable entry). It is obtained by resolving the variable + * reference in the first segment. Returnsnull
if unable to resolve using * the following algorithm: *
null
JavaCore#getClasspathContainer(IPath, IJavaProject)
.
*
- *
+ *
* @param entry the given variable entry
* @return the resolved library or project classpath entry, or null
* if the given variable entry could not be resolved to a valid classpath entry
*/
public static IClasspathEntry getResolvedClasspathEntry(IClasspathEntry entry) {
-
+
if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE)
return entry;
-
+
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IPath resolvedPath = JavaCore.getResolvedVariablePath(entry.getPath());
if (resolvedPath == null)
return null;
-
+
Object target = JavaModel.getTarget(workspaceRoot, resolvedPath, false);
if (target == null)
return null;
-
+
// inside the workspace
if (target instanceof IResource) {
IResource resolvedResource = (IResource) target;
switch (resolvedResource.getType()) {
-
- case IResource.PROJECT :
+
+ case IResource.PROJECT :
// internal project
return JavaCore.newProjectEntry(
- resolvedPath,
+ resolvedPath,
entry.getAccessRules(),
- entry.combineAccessRules(),
- entry.getExtraAttributes(),
+ entry.combineAccessRules(),
+ entry.getExtraAttributes(),
entry.isExported());
- case IResource.FILE :
+ case IResource.FILE :
if (org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(resolvedResource.getName())) {
// internal binary archive
return JavaCore.newLibraryEntry(
resolvedPath,
getResolvedVariablePath(entry.getSourceAttachmentPath()),
getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
- entry.getAccessRules(),
- entry.getExtraAttributes(),
+ entry.getAccessRules(),
+ entry.getExtraAttributes(),
entry.isExported());
}
break;
-
- case IResource.FOLDER :
+
+ case IResource.FOLDER :
// internal binary folder
return JavaCore.newLibraryEntry(
resolvedPath,
getResolvedVariablePath(entry.getSourceAttachmentPath()),
getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
- entry.getAccessRules(),
- entry.getExtraAttributes(),
+ entry.getAccessRules(),
+ entry.getExtraAttributes(),
entry.isExported());
}
}
@@ -2838,7 +3049,7 @@
File externalFile = JavaModel.getFile(target);
if (externalFile != null) {
String fileName = externalFile.getName().toLowerCase();
- if (fileName.endsWith(SuffixConstants.SUFFIX_STRING_jar) || fileName.endsWith(SuffixConstants.SUFFIX_STRING_zip)) {
+ if (fileName.endsWith(SuffixConstants.SUFFIX_STRING_jar) || fileName.endsWith(SuffixConstants.SUFFIX_STRING_zip)) {
// external binary archive
return JavaCore.newLibraryEntry(
resolvedPath,
@@ -2866,52 +3077,52 @@
/**
* Resolve a variable path (helper method).
- *
+ *
* @param variablePath the given variable path
* @return the resolved variable path or null
if none
*/
public static IPath getResolvedVariablePath(IPath variablePath) {
-
+
if (variablePath == null)
return null;
int count = variablePath.segmentCount();
if (count == 0)
return null;
-
- // lookup variable
+
+ // lookup variable
String variableName = variablePath.segment(0);
IPath resolvedPath = JavaCore.getClasspathVariable(variableName);
if (resolvedPath == null)
return null;
-
+
// append path suffix
if (count > 1) {
resolvedPath = resolvedPath.append(variablePath.removeFirstSegments(1));
}
- return resolvedPath;
+ return resolvedPath;
}
/**
- * Answers the shared working copies currently registered for this buffer factory.
- * Working copies can be shared by several clients using the same buffer factory,see
+ * Answers the shared working copies currently registered for this buffer factory.
+ * Working copies can be shared by several clients using the same buffer factory,see
* IWorkingCopy.getSharedWorkingCopy
.
- *
+ *
* @param factory the given buffer factory
* @return the list of shared working copies for a given buffer factory
* @since 2.0
* @deprecated Use {@link #getWorkingCopies(WorkingCopyOwner)} instead
*/
public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory){
-
+
// if factory is null, default factory must be used
if (factory == null) factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory();
return getWorkingCopies(BufferFactoryWrapper.create(factory));
}
-
+
/**
* Returns the names of all defined user libraries. The corresponding classpath container path
- * is the name appended to the USER_LIBRARY_CONTAINER_ID.
+ * is the name appended to the USER_LIBRARY_CONTAINER_ID.
* @return Return an array containing the names of all known user defined.
* @since 3.0
*/
@@ -2920,53 +3131,53 @@
}
/**
- * Returns the working copies that have the given owner.
+ * Returns the working copies that have the given owner.
* Only compilation units in working copy mode are returned.
* If the owner is null
, primary working copies are returned.
- *
+ *
* @param owner the given working copy owner or null
for primary working copy owner
* @return the list of working copies for a given owner
* @since 3.0
*/
public static ICompilationUnit[] getWorkingCopies(WorkingCopyOwner owner){
-
+
JavaModelManager manager = JavaModelManager.getJavaModelManager();
if (owner == null) owner = DefaultWorkingCopyOwner.PRIMARY;
ICompilationUnit[] result = manager.getWorkingCopies(owner, false/*don't add primary WCs*/);
if (result == null) return JavaModelManager.NO_WORKING_COPY;
return result;
}
-
+
/**
- * Initializes JavaCore internal structures to allow subsequent operations (such
- * as the ones that need a resolved classpath) to run full speed. A client may
- * choose to call this method in a background thread early after the workspace
+ * Initializes JavaCore internal structures to allow subsequent operations (such
+ * as the ones that need a resolved classpath) to run full speed. A client may
+ * choose to call this method in a background thread early after the workspace
* has started so that the initialization is transparent to the user.
*
- * However calling this method is optional. Services will lazily perform - * initialization when invoked. This is only a way to reduce initialization - * overhead on user actions, if it can be performed before at some + * However calling this method is optional. Services will lazily perform + * initialization when invoked. This is only a way to reduce initialization + * overhead on user actions, if it can be performed before at some * appropriate moment. *
* This initialization runs accross all Java projects in the workspace. Thus the * workspace root scheduling rule is used during this operation. *
- * This method may return before the initialization is complete. The + * This method may return before the initialization is complete. The * initialization will then continue in a background thread. *
* This method can be called concurrently. *
- * + * * @param monitor a progress monitor, ornull
if progress
* reporting and cancellation are not desired
- * @exception CoreException if the initialization fails,
+ * @exception CoreException if the initialization fails,
* the status of the exception indicates the reason of the failure
* @since 3.1
*/
public static void initializeAfterLoad(IProgressMonitor monitor) throws CoreException {
try {
if (monitor != null) monitor.beginTask(Messages.javamodel_initialization, 100);
-
+
// initialize all containers and variables
JavaModelManager manager = JavaModelManager.getJavaModelManager();
try {
@@ -2974,11 +3185,11 @@
monitor.subTask(Messages.javamodel_configuring_classpath_containers);
manager.batchContainerInitializationsProgress.set(new SubProgressMonitor(monitor, 50)); // 50% of the time is spent in initializing containers and variables
}
- manager.deltaState.initializeRoots();
+ manager.deltaState.initializeRoots();
} finally {
manager.batchContainerInitializationsProgress.set(null);
}
-
+
// dummy query for waiting until the indexes are ready
SearchEngine engine = new SearchEngine();
IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
@@ -2991,7 +3202,7 @@
"!@$#!@".toCharArray(), //$NON-NLS-1$
SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE,
IJavaSearchConstants.CLASS,
- scope,
+ scope,
new TypeNameRequestor() {
public void acceptType(
int modifiers,
@@ -3006,7 +3217,7 @@
// to wait until indexes are fully rebuild
IJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH,
monitor == null ? null : new SubProgressMonitor(monitor, 49) // 49% of the time is spent in the dummy search
- );
+ );
} catch (JavaModelException e) {
// /search failed: ignore
} catch (OperationCanceledException e) {
@@ -3014,7 +3225,7 @@
throw e;
// else indexes were not ready: catch the exception so that jars are still refreshed
}
-
+
// check if the build state version number has changed since last session
// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=98969)
if (monitor != null)
@@ -3068,13 +3279,13 @@
Util.log(e, "Could not persist build state version number"); //$NON-NLS-1$
}
}
-
+
// ensure external jars are refreshed (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=93668)
try {
if (monitor != null)
monitor.subTask(Messages.javamodel_refreshing_external_jars);
model.refreshExternalArchives(
- null/*refresh all projects*/,
+ null/*refresh all projects*/,
monitor == null ? null : new SubProgressMonitor(monitor, 1) // 1% of the time is spent in jar refresh
);
} catch (JavaModelException e) {
@@ -3099,7 +3310,7 @@
/**
* Returns whether the given file name's extension is a Java-like extension.
- *
+ *
* @return whether the given file name's extension is a Java-like extension
* @see #getJavaLikeExtensions()
* @since 3.2
@@ -3115,10 +3326,10 @@
* @param element the element
* @param marker the marker
* @return true
if the marker references the element, false otherwise
- * @exception CoreException if the IMarker.getAttribute
on the marker fails
+ * @exception CoreException if the IMarker.getAttribute
on the marker fails
*/
public static boolean isReferencedBy(IJavaElement element, IMarker marker) throws CoreException {
-
+
// only match units or classfiles
if (element instanceof IMember){
IMember member = (IMember) element;
@@ -3128,16 +3339,16 @@
element = member.getCompilationUnit();
}
}
- if (element == null) return false;
+ if (element == null) return false;
if (marker == null) return false;
String markerHandleId = (String)marker.getAttribute(ATT_HANDLE_ID);
if (markerHandleId == null) return false;
-
+
IJavaElement markerElement = JavaCore.create(markerHandleId);
while (true){
if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs.
-
+
// cycle through enclosing types in case marker is associated with a classfile (15568)
if (markerElement instanceof IClassFile){
IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType();
@@ -3158,10 +3369,10 @@
* @param element the element
* @param markerDelta the marker delta
* @return true
if the marker delta references the element
- * @exception CoreException if the IMarkerDelta.getAttribute
on the marker delta fails
+ * @exception CoreException if the IMarkerDelta.getAttribute
on the marker delta fails
*/
public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException {
-
+
// only match units or classfiles
if (element instanceof IMember){
IMember member = (IMember) element;
@@ -3171,16 +3382,16 @@
element = member.getCompilationUnit();
}
}
- if (element == null) return false;
+ if (element == null) return false;
if (markerDelta == null) return false;
String markerDeltarHandleId = (String)markerDelta.getAttribute(ATT_HANDLE_ID);
if (markerDeltarHandleId == null) return false;
-
+
IJavaElement markerElement = JavaCore.create(markerDeltarHandleId);
while (true){
if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs.
-
+
// cycle through enclosing types in case marker is associated with a classfile (15568)
if (markerElement instanceof IClassFile){
IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType();
@@ -3197,14 +3408,14 @@
/**
* Creates and returns a new access rule with the given file pattern and kind.
*
- * The rule kind is one of {@link IAccessRule#K_ACCESSIBLE}, {@link IAccessRule#K_DISCOURAGED},
+ * The rule kind is one of {@link IAccessRule#K_ACCESSIBLE}, {@link IAccessRule#K_DISCOURAGED},
* or {@link IAccessRule#K_NON_ACCESSIBLE}, optionally combined with {@link IAccessRule#IGNORE_IF_BETTER},
* e..g. IAccessRule.K_NON_ACCESSIBLE | IAccessRule.IGNORE_IF_BETTER
.
*
CPE_CONTAINER
* for the given path. This method is fully equivalent to calling
* {@link #newContainerEntry(IPath, IAccessRule[], IClasspathAttribute[], boolean)
- * newContainerEntry(containerPath, new IAccessRule[0], new IClasspathAttribute[0], isExported)}.
- *
+ * newContainerEntry(containerPath, new IAccessRule[0], new IClasspathAttribute[0], isExported)}.
+ *
* @param containerPath the path identifying the container, it must be formed of at least
* one segment (ID+hints)
* @param isExported a boolean indicating whether this entry is contributed to dependent
* projects in addition to the output location
* @return a new container classpath entry
- *
+ *
* @see JavaCore#getClasspathContainer(IPath, IJavaProject)
* @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor)
* @since 2.0
@@ -3291,12 +3502,12 @@
* Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container:
* * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); - * + * * <extension * point="org.eclipse.jdt.core.classpathContainerInitializer"> * <containerInitializer * id="MyProvidedJDK" - * class="com.example.MyInitializer"/> + * class="com.example.MyInitializer"/> **
* The access rules determine the set of accessible source and class files @@ -3305,7 +3516,7 @@ * See {@link IAccessRule} for a detailed description of access * rules. Note that if an entry defined by the container defines access rules, * then these access rules are combined with the given access rules. - * The given access rules are considered first, then the entry's access rules are + * The given access rules are considered first, then the entry's access rules are * considered. *
*@@ -3318,13 +3529,13 @@ * projects. If not exported, dependent projects will not see any of the classes from this entry. * If exported, dependent projects will concatenate the accessible files patterns of this entry with the * accessible files patterns of the projects, and they will concatenate the non accessible files patterns of this entry - * with the non accessible files patterns of the project. + * with the non accessible files patterns of the project. *
** Note that this operation does not attempt to validate classpath containers * or access the resources at the given paths. *
- * + * * @param containerPath the path identifying the container, it must be formed of at least * one segment (ID+hints) * @param accessRules the possibly empty list of access rules for this entry @@ -3332,19 +3543,19 @@ * @param isExported a boolean indicating whether this entry is contributed to dependent * projects in addition to the output location * @return a new container classpath entry - * + * * @see JavaCore#getClasspathContainer(IPath, IJavaProject) * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) * @see JavaCore#newContainerEntry(IPath, boolean) * @see JavaCore#newAccessRule(IPath, int) * @since 3.1 - */ + */ public static IClasspathEntry newContainerEntry( - IPath containerPath, - IAccessRule[] accessRules, + IPath containerPath, + IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported) { - + if (containerPath == null) { Assert.isTrue(false, "Container path cannot be null"); //$NON-NLS-1$ } else if (containerPath.segmentCount() < 1) { @@ -3365,13 +3576,13 @@ accessRules, true, // combine access rules extraAttributes); - } - + } + /** * Creates and returns a type hierarchy for all types in the given - * region, considering subtypes within that region and considering types in the - * working copies with the given owner. - * In other words, the owner's working copies will take + * region, considering subtypes within that region and considering types in the + * working copies with the given owner. + * In other words, the owner's working copies will take * precedence over their original compilation units in the workspace. *
* Note that if a working copy is empty, it will be as if the original compilation
@@ -3399,17 +3610,17 @@
op.runOperation(monitor);
return op.getResult();
}
-
+
/**
- * Creates and returns a new non-exported classpath entry of kind CPE_LIBRARY
for the
- * JAR or folder identified by the given absolute path. This specifies that all package fragments
+ * Creates and returns a new non-exported classpath entry of kind CPE_LIBRARY
for the
+ * JAR or folder identified by the given absolute path. This specifies that all package fragments
* within the root will have children of type IClassFile
.
* This method is fully equivalent to calling
* {@link #newLibraryEntry(IPath, IPath, IPath, IAccessRule[], IClasspathAttribute[], boolean)
* newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, new IAccessRule[0], new IClasspathAttribute[0], false)}.
*
* @param path the absolute path of the binary archive
- * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
+ * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
* or null
if none. Note, since 3.0, an empty path is allowed to denote no source attachment.
* and will be automatically converted to null
.
* @param sourceAttachmentRootPath the location of the root of the source files within the source archive or folder
@@ -3420,9 +3631,9 @@
IPath path,
IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath) {
-
+
return newLibraryEntry(
- path,
+ path,
sourceAttachmentPath,
sourceAttachmentRootPath,
ClasspathEntry.NO_ACCESS_RULES,
@@ -3432,14 +3643,14 @@
/**
* Creates and returns a new classpath entry of kind CPE_LIBRARY
for the JAR or folder
- * identified by the given absolute path. This specifies that all package fragments within the root
+ * identified by the given absolute path. This specifies that all package fragments within the root
* will have children of type IClassFile
.
* This method is fully equivalent to calling
* {@link #newLibraryEntry(IPath, IPath, IPath, IAccessRule[], IClasspathAttribute[], boolean)
* newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, new IAccessRule[0], new IClasspathAttribute[0], isExported)}.
- *
+ *
* @param path the absolute path of the binary archive
- * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
+ * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
* or null
if none. Note, since 3.0, an empty path is allowed to denote no source attachment.
* and will be automatically converted to null
.
* @param sourceAttachmentRootPath the location of the root of the source files within the source archive or folder
@@ -3454,9 +3665,9 @@
IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath,
boolean isExported) {
-
+
return newLibraryEntry(
- path,
+ path,
sourceAttachmentPath,
sourceAttachmentRootPath,
ClasspathEntry.NO_ACCESS_RULES,
@@ -3466,7 +3677,7 @@
/**
* Creates and returns a new classpath entry of kind CPE_LIBRARY
for the JAR or folder
- * identified by the given absolute path. This specifies that all package fragments within the root
+ * identified by the given absolute path. This specifies that all package fragments within the root
* will have children of type IClassFile
.
*
* A library entry is used to denote a prerequisite JAR or root folder containing binaries. @@ -3481,13 +3692,13 @@ *
"/Project/someLib.jar"
- reference to an internal JAR on Windows or Linux "/Project/classes/"
- reference to an internal binary folder on Windows or Linux"/some/lib.jar"
is ambiguous.
- * It can be a path to an external JAR (its file system path being "/some/lib.jar"
)
+ * Note that on non-Windows platform, a path "/some/lib.jar"
is ambiguous.
+ * It can be a path to an external JAR (its file system path being "/some/lib.jar"
)
* or it can be a path to an internal JAR ("some"
being a project in the workspace).
* Such an ambiguity is solved when the classpath entry is used (e.g. in {@link IJavaProject#getPackageFragmentRoots()}).
* If the resource "lib.jar"
exists in project "some"
, then it is considered an
* internal JAR. Otherwise it is an external JAR.
- * Also note that this operation does not attempt to validate or access the + *
Also note that this operation does not attempt to validate or access the * resources at the given paths. *
* The access rules determine the set of accessible class files @@ -3506,11 +3717,11 @@ * projects. If not exported, dependent projects will not see any of the classes from this entry. * If exported, dependent projects will concatenate the accessible files patterns of this entry with the * accessible files patterns of the projects, and they will concatenate the non accessible files patterns of this entry - * with the non accessible files patterns of the project. + * with the non accessible files patterns of the project. *
- * + * * @param path the absolute path of the binary archive - * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, + * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, * ornull
if none. Note, since 3.0, an empty path is allowed to denote no source attachment.
* and will be automatically converted to null
.
* @param sourceAttachmentRootPath the location of the root of the source files within the source archive or folder
@@ -3526,10 +3737,10 @@
IPath path,
IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath,
- IAccessRule[] accessRules,
+ IAccessRule[] accessRules,
IClasspathAttribute[] extraAttributes,
boolean isExported) {
-
+
if (path == null) Assert.isTrue(false, "Library path cannot be null"); //$NON-NLS-1$
if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
if (sourceAttachmentPath != null) {
@@ -3555,28 +3766,28 @@
false, // no access rules to combine
extraAttributes);
}
-
+
/**
* Creates and returns a new non-exported classpath entry of kind CPE_PROJECT
* for the project identified by the given absolute path.
* This method is fully equivalent to calling
* {@link #newProjectEntry(IPath, IAccessRule[], boolean, IClasspathAttribute[], boolean)
* newProjectEntry(path, new IAccessRule[0], true, new IClasspathAttribute[0], false)}.
- *
+ *
* @param path the absolute path of the binary archive
* @return a new project classpath entry
*/
public static IClasspathEntry newProjectEntry(IPath path) {
return newProjectEntry(path, false);
}
-
+
/**
* Creates and returns a new classpath entry of kind CPE_PROJECT
* for the project identified by the given absolute path.
* This method is fully equivalent to calling
* {@link #newProjectEntry(IPath, IAccessRule[], boolean, IClasspathAttribute[], boolean)
* newProjectEntry(path, new IAccessRule[0], true, new IClasspathAttribute[0], isExported)}.
- *
+ *
* @param path the absolute path of the prerequisite project
* @param isExported indicates whether this entry is contributed to dependent
* projects in addition to the output location
@@ -3584,9 +3795,9 @@
* @since 2.0
*/
public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) {
-
+
if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
-
+
return newProjectEntry(
path,
ClasspathEntry.NO_ACCESS_RULES,
@@ -3601,11 +3812,11 @@
* * A project entry is used to denote a prerequisite project on a classpath. * The referenced project will be contributed as a whole, either as sources (in the Java Model, it - * contributes all its package fragment roots) or as binaries (when building, it contributes its + * contributes all its package fragment roots) or as binaries (when building, it contributes its * whole output location). *
*- * A project reference allows to indirect through another project, independently from its internal layout. + * A project reference allows to indirect through another project, independently from its internal layout. *
* The prerequisite project is referred to using an absolute path relative to the workspace root. *
@@ -3618,7 +3829,7 @@ *
* The combineAccessRules
flag indicates whether access rules of one (or more)
* exported entry of the project should be combined with the given access rules. If they should
- * be combined, the given access rules are considered first, then the entry's access rules are
+ * be combined, the given access rules are considered first, then the entry's access rules are
* considered.
*
@@ -3631,9 +3842,9 @@ * projects. If not exported, dependent projects will not see any of the classes from this entry. * If exported, dependent projects will concatenate the accessible files patterns of this entry with the * accessible files patterns of the projects, and they will concatenate the non accessible files patterns of this entry - * with the non accessible files patterns of the project. + * with the non accessible files patterns of the project. *
- * + * * @param path the absolute path of the prerequisite project * @param accessRules the possibly empty list of access rules for this entry * @param combineAccessRules whether the access rules of the project's exported entries should be combined with the given access rules @@ -3644,14 +3855,14 @@ * @since 3.1 */ public static IClasspathEntry newProjectEntry( - IPath path, - IAccessRule[] accessRules, + IPath path, + IAccessRule[] accessRules, boolean combineAccessRules, IClasspathAttribute[] extraAttributes, boolean isExported) { - + if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ - + return new ClasspathEntry( IPackageFragmentRoot.K_SOURCE, IClasspathEntry.CPE_PROJECT, @@ -3669,7 +3880,7 @@ /** * Returns a new empty region. - * + * * @return a new empty region */ public static IRegion newRegion() { @@ -3686,7 +3897,7 @@ * newSourceEntry(path, new IPath[] {}, new IPath[] {}, null); * * - * + * * @param path the absolute workspace-relative path of a source folder * @return a new source classpath entry * @see #newSourceEntry(IPath, IPath[], IPath[], IPath) @@ -3695,10 +3906,10 @@ return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null /*output location*/); } - + /** * Creates and returns a new classpath entry of kindCPE_SOURCE
- * for the project's source folder identified by the given absolute
+ * for the project's source folder identified by the given absolute
* workspace-relative path but excluding all source files with paths
* matching any of the given patterns.
*
@@ -3717,15 +3928,15 @@
*/
public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) {
- return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, exclusionPatterns, null /*output location*/);
+ return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, exclusionPatterns, null /*output location*/);
}
/**
* Creates and returns a new classpath entry of kind CPE_SOURCE
- * for the project's source folder identified by the given absolute
+ * for the project's source folder identified by the given absolute
* workspace-relative path but excluding all source files with paths
* matching any of the given patterns, and associated with a specific output location
- * (that is, ".class" files are not going to the project default output location).
+ * (that is, ".class" files are not going to the project default output location).
*
* The convenience method is fully equivalent to: *
@@ -3745,13 +3956,13 @@ return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, exclusionPatterns, specificOutputLocation); } - + /** * Creates and returns a new classpath entry of kindCPE_SOURCE
- * for the project's source folder identified by the given absolute + * for the project's source folder identified by the given absolute * workspace-relative path but excluding all source files with paths * matching any of the given patterns, and associated with a specific output location - * (that is, ".class" files are not going to the project default output location). + * (that is, ".class" files are not going to the project default output location). ** The convenience method is fully equivalent to: *
@@ -3772,16 +3983,16 @@ public static IClasspathEntry newSourceEntry(IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns, IPath specificOutputLocation) { return newSourceEntry(path, inclusionPatterns, exclusionPatterns, specificOutputLocation, ClasspathEntry.NO_EXTRA_ATTRIBUTES); } - + /** * Creates and returns a new classpath entry of kindCPE_SOURCE
- * for the project's source folder identified by the given absolute + * for the project's source folder identified by the given absolute * workspace-relative path using the given inclusion and exclusion patterns * to determine which source files are included, and the given output path * to control the output location of generated files. ** The source folder is referred to using an absolute path relative to the - * workspace root, e.g.
*/Project/src
. A project's source + * workspace root, e.g./Project/src
. A project's source * folders are located with that project. That is, a source classpath * entry specifying the path/P1/src
is only usable for * projectP1
. @@ -3793,11 +4004,11 @@ * includes all relevent files in the resource tree rooted at the source * entry's path. On the other hand, specifying one or more inclusion * patterns means that all and only files matching at least one of - * the specified patterns are to be included. If exclusion patterns are + * the specified patterns are to be included. If exclusion patterns are * specified, the initial set of files is then reduced by eliminating files * matched by at least one of the exclusion patterns. Inclusion and * exclusion patterns look like relative file paths with wildcards and are - * interpreted relative to the source entry's path. File patterns are + * interpreted relative to the source entry's path. File patterns are * case-sensitive can contain '**', '*' or '?' wildcards (see * {@link IClasspathEntry#getExclusionPatterns()} for the full description * of their syntax and semantics). The resulting set of files are included @@ -3805,24 +4016,24 @@ * the root will have children of typeICompilationUnit
. *- * For example, if the source folder path is + * For example, if the source folder path is *
*/Project/src
, there are no inclusion filters, and the - * exclusion pattern is + * exclusion pattern is *com/xyz/tests/**
, then source files * like/Project/src/com/xyz/Foo.java
* and/Project/src/com/xyz/utils/Bar.java
would be included, * whereas/Project/src/com/xyz/tests/T1.java
* and/Project/src/com/xyz/tests/quick/T2.java
would be - * excluded. + * excluded. *- * Additionally, a source entry can be associated with a specific output location. - * By doing so, the Java builder will ensure that the generated ".class" files will - * be issued inside this output location, as opposed to be generated into the - * project default output location (when output location is
*null
). + * Additionally, a source entry can be associated with a specific output location. + * By doing so, the Java builder will ensure that the generated ".class" files will + * be issued inside this output location, as opposed to be generated into the + * project default output location (when output location isnull
). * Note that multiple source entries may target the same output location. - * The output location is referred to using an absolute path relative to the - * workspace root, e.g."/Project/bin"
, it must be located inside + * The output location is referred to using an absolute path relative to the + * workspace root, e.g."/Project/bin"
, it must be located inside * the same project as the source folder. *@@ -3869,7 +4080,7 @@ false, null, false, // no access rules to combine - extraAttributes); + extraAttributes); } /** @@ -3877,10 +4088,10 @@ * for the given path. This method is fully equivalent to calling * {@link #newVariableEntry(IPath, IPath, IPath, IAccessRule[], IClasspathAttribute[], boolean) * newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, new IAccessRule[0], new IClasspathAttribute[0], false)}. - * + * * @param variablePath the path of the binary archive; first segment is the * name of a classpath variable - * @param variableSourceAttachmentPath the path of the corresponding source archive, + * @param variableSourceAttachmentPath the path of the corresponding source archive, * or
null
if none; if present, the first segment is the * name of a classpath variable (not necessarily the same variable * as the one that beginsvariablePath
) @@ -3901,10 +4112,10 @@ * for the given path. This method is fully equivalent to calling * {@link #newVariableEntry(IPath, IPath, IPath, IAccessRule[], IClasspathAttribute[], boolean) * newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, new IAccessRule[0], new IClasspathAttribute[0], isExported)}. - * + * * @param variablePath the path of the binary archive; first segment is the * name of a classpath variable - * @param variableSourceAttachmentPath the path of the corresponding source archive, + * @param variableSourceAttachmentPath the path of the corresponding source archive, * ornull
if none; if present, the first segment is the * name of a classpath variable (not necessarily the same variable * as the one that beginsvariablePath
) @@ -3943,9 +4154,9 @@ * After resolution, a classpath variable entry may either correspond to a project or a library entry. ** e.g. Here are some examples of variable path usage
JDTCORE
is
+ * JDTCORE
is
* bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"JDTCORE
is
+ * JDTCORE
is
* bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"PLUGINS
* is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:\eclipse\plugins\com.example\example.jar"
* Note that this operation does not attempt to validate classpath variables
@@ -3975,7 +4186,7 @@
*
* @param variablePath the path of the binary archive; first segment is the
* name of a classpath variable
- * @param variableSourceAttachmentPath the path of the corresponding source archive,
+ * @param variableSourceAttachmentPath the path of the corresponding source archive,
* or null
if none; if present, the first segment is the
* name of a classpath variable (not necessarily the same variable
* as the one that begins variablePath
)
@@ -3987,12 +4198,12 @@
* projects in addition to the output location
* @return a new variable classpath entry
* @since 3.1
- */
+ */
public static IClasspathEntry newVariableEntry(
IPath variablePath,
IPath variableSourceAttachmentPath,
IPath variableSourceAttachmentRootPath,
- IAccessRule[] accessRules,
+ IAccessRule[] accessRules,
IClasspathAttribute[] extraAttributes,
boolean isExported) {
@@ -4002,7 +4213,7 @@
false,
"Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$
}
-
+
return new ClasspathEntry(
IPackageFragmentRoot.K_SOURCE,
IClasspathEntry.CPE_VARIABLE,
@@ -4010,20 +4221,20 @@
ClasspathEntry.INCLUDE_ALL, // inclusion patterns
ClasspathEntry.EXCLUDE_NONE, // exclusion patterns
variableSourceAttachmentPath, // source attachment
- variableSourceAttachmentRootPath, // source attachment root
+ variableSourceAttachmentRootPath, // source attachment root
null, // specific output folder
isExported,
accessRules,
false, // no access rules to combine
extraAttributes);
- }
+ }
/**
* Removed the given classpath variable. Does nothing if no value was
* set for this classpath variable.
*
* This functionality cannot be used while the resource tree is locked. *
- * Classpath variable values are persisted locally to the workspace, and + * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. *
* @@ -4042,7 +4253,7 @@ *
* This functionality cannot be used while the resource tree is locked. *
- * Classpath variable values are persisted locally to the workspace, and + * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. *
* @@ -4073,7 +4284,7 @@ * Removes the file extension from the given file name, if it has a Java-like file * extension. Otherwise the file name itself is returned. * Note this removes the dot ('.') before the extension as well. - * + * * @param fileName the name of a file * @return the fileName without the Java-like extension * @since 3.2 @@ -4081,7 +4292,7 @@ public static String removeJavaLikeExtension(String fileName) { return Util.getNameWithoutJavaLikeExtension(fileName); } - + /** * Removes the given pre-processing resource changed listener. *
@@ -4093,9 +4304,9 @@ public static void removePreProcessingResourceChangedListener(IResourceChangeListener listener) { JavaModelManager.getJavaModelManager().deltaState.removePreResourceChangedListener(listener); } - - + + /** * Runs the given action as an atomic Java model operation. *
@@ -4150,7 +4361,7 @@ *
*
* The supplied scheduling rule is used to determine whether this operation can be
- * run simultaneously with workspace changes in other threads. See
+ * run simultaneously with workspace changes in other threads. See
* IWorkspace.run(...)
for more details.
*
IClasspathContainer
).
* This API must be invoked whenever changes in container need to be reflected onto the JavaModel.
* Containers can have distinct values in different projects, therefore this API considers a
* set of projects with their respective containers.
*
* containerPath
is the path under which these values can be referenced through
- * container classpath entries (IClasspathEntry#CPE_CONTAINER
). A container path
+ * container classpath entries (IClasspathEntry#CPE_CONTAINER
). A container path
* is formed by a first ID segment followed with extra segments, which can be used as additional hints
- * for the resolution. The container ID is used to identify a ClasspathContainerInitializer
+ * for the resolution. The container ID is used to identify a ClasspathContainerInitializer
* registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
*
- * There is no assumption that each individual container value passed in argument
- * (respectiveContainers
) must answer the exact same path when requested
- * IClasspathContainer#getPath
.
- * Indeed, the containerPath is just an indication for resolving it to an actual container object. It can be
+ * There is no assumption that each individual container value passed in argument
+ * (respectiveContainers
) must answer the exact same path when requested
+ * IClasspathContainer#getPath
.
+ * Indeed, the containerPath is just an indication for resolving it to an actual container object. It can be
* delegated to a ClasspathContainerInitializer
, which can be activated through the extension
- * point "org.eclipse.jdt.core.ClasspathContainerInitializer").
+ * point "org.eclipse.jdt.core.ClasspathContainerInitializer").
*
* In reaction to changing container values, the JavaModel will be updated to reflect the new - * state of the updated container. A combined Java element delta will be notified to describe the corresponding + * state of the updated container. A combined Java element delta will be notified to describe the corresponding * classpath changes resulting from the container update. This operation is batched, and automatically eliminates * unnecessary updates (new container is same as old one). This operation acquires a lock on the workspace's root. *
* This functionality cannot be used while the workspace is locked, since * it may create/remove some resource markers. *
- * Classpath container values are persisted locally to the workspace, but
- * are not preserved from a session to another. It is thus highly recommended to register a
- * ClasspathContainerInitializer
for each referenced container
+ * Classpath container values are persisted locally to the workspace, but
+ * are not preserved from a session to another. It is thus highly recommended to register a
+ * ClasspathContainerInitializer
for each referenced container
* (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer").
*
* Note: setting a container to null
will cause it to be lazily resolved again whenever
@@ -4218,7 +4429,7 @@
* @since 2.0
*/
public static void setClasspathContainer(IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException {
- if (affectedProjects.length != respectiveContainers.length)
+ if (affectedProjects.length != respectiveContainers.length)
Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$
SetContainerOperation operation = new SetContainerOperation(containerPath, affectedProjects, respectiveContainers);
operation.runOperation(monitor);
@@ -4230,7 +4441,7 @@
*
* This functionality cannot be used while the resource tree is locked. *
- * Classpath variable values are persisted locally to the workspace, and + * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. *
* @@ -4253,7 +4464,7 @@ *
* This functionality cannot be used while the resource tree is locked. *
- * Classpath variable values are persisted locally to the workspace, and + * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. *
* Updating a variable with the same value has no effect. @@ -4278,19 +4489,19 @@ * Sets the values of all the given classpath variables at once. * Null paths can be used to request corresponding variable removal. *
- * A combined Java element delta will be notified to describe the corresponding - * classpath changes resulting from the variables update. This operation is batched, - * and automatically eliminates unnecessary updates (new variable is same as old one). + * A combined Java element delta will be notified to describe the corresponding + * classpath changes resulting from the variables update. This operation is batched, + * and automatically eliminates unnecessary updates (new variable is same as old one). * This operation acquires a lock on the workspace's root. *
* This functionality cannot be used while the workspace is locked, since * it may create/remove some resource markers. *
- * Classpath variable values are persisted locally to the workspace, and + * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. *
* Updating a variable with the same value has no effect. - * + * * @param variableNames an array of names for the updated classpath variables * @param paths an array of path updates for the modified classpath variables (null * meaning that the corresponding value will be removed @@ -4313,10 +4524,10 @@ /** * Sets the default's compiler options inside the given options map according * to the given compliance. - * + * *
The given compliance must be one of the compliance supported by the compiler. * See {@link #getDefaultOptions()} for a list of compliance values.
- * + * *The list of modified options is:
*getDefaultOptions
.
*
- *
+ *
* @param newOptions
* the new options (key type: String
; value type:
* String
), or null
to reset all