Index: model/org/eclipse/jdt/internal/core/DefaultWorkingCopyOwner.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DefaultWorkingCopyOwner.java,v --- model/org/eclipse/jdt/internal/core/DefaultWorkingCopyOwner.java 10 May 2006 18:03:47 -0000 1.16 +++ model/org/eclipse/jdt/internal/core/DefaultWorkingCopyOwner.java 26 Feb 2007 15:31:28 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,9 +28,6 @@ // only one instance can be created } - /** - * @deprecated Marked deprecated as it is using deprecated code - */ public IBuffer createBuffer(ICompilationUnit workingCopy) { if (this.primaryBufferProvider != null) return this.primaryBufferProvider.createBuffer(workingCopy); return super.createBuffer(workingCopy); Index: model/org/eclipse/jdt/internal/core/CompilationUnit.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java,v --- model/org/eclipse/jdt/internal/core/CompilationUnit.java 12 Dec 2006 17:13:59 -0000 1.237 +++ model/org/eclipse/jdt/internal/core/CompilationUnit.java 26 Feb 2007 15:31:28 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -68,6 +68,13 @@ operation.runOperation(monitor); } } +/* + * @see ICompilationUnit#becomeWorkingCopy(IProgressMonitor) + */ +public void becomeWorkingCopy(IProgressMonitor monitor) throws JavaModelException { + IProblemRequestor requestor = this.owner == null ? null : this.owner.getProblemRequestor(this); + becomeWorkingCopy(requestor, monitor); +} protected boolean buildStructure(OpenableElementInfo info, final IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException { // check if this compilation unit can be opened @@ -1122,7 +1129,7 @@ throws JavaModelException { return reconcile(astLevel, forceProblemDetection, false, workingCopyOwner, monitor); } - + /** * @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, IProgressMonitor) * @since 3.0 Index: model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java,v --- model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java 6 Sep 2006 08:44:07 -0000 1.41 +++ model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java 26 Feb 2007 15:31:28 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -61,7 +61,7 @@ this.enableStatementsRecovery = enableStatementsRecovery; this.workingCopyOwner = workingCopyOwner; } - + /** * @exception JavaModelException if setting the source * of the original compilation unit fails @@ -76,6 +76,10 @@ CompilationUnit workingCopy = getWorkingCopy(); boolean wasConsistent = workingCopy.isConsistent(); IProblemRequestor problemRequestor = workingCopy.getPerWorkingCopyInfo(); + if (problemRequestor != null) { + problemRequestor = ((JavaModelManager.PerWorkingCopyInfo)problemRequestor).problemRequestor; + } + IProblemRequestor ownerProblemRequestor = this.workingCopyOwner.getProblemRequestor(workingCopy); this.resolveBindings |= problemRequestor != null && problemRequestor.isActive(); // create the delta builder (this remembers the current content of the cu) @@ -93,22 +97,11 @@ // report problems if (this.problems != null && (this.forceProblemDetection || !wasConsistent)) { - try { - problemRequestor.beginReporting(); - for (Iterator iteraror = this.problems.values().iterator(); iteraror.hasNext();) { - CategorizedProblem[] categorizedProblems = (CategorizedProblem[]) iteraror.next(); - if (categorizedProblems == null) continue; - for (int i = 0, length = categorizedProblems.length; i < length; i++) { - CategorizedProblem problem = categorizedProblems[i]; - if (JavaModelManager.VERBOSE){ - System.out.println("PROBLEM FOUND while reconciling : " + problem.getMessage());//$NON-NLS-1$ - } - if (this.progressMonitor != null && this.progressMonitor.isCanceled()) break; - problemRequestor.acceptProblem(problem); - } - } - } finally { - problemRequestor.endReporting(); + if (problemRequestor != null) { + reportProblems(workingCopy, problemRequestor); + } + if (ownerProblemRequestor != null && ownerProblemRequestor != problemRequestor) { + reportProblems(workingCopy, ownerProblemRequestor); } } @@ -122,18 +115,47 @@ if (this.progressMonitor != null) this.progressMonitor.done(); } } + + /** + * Report working copy problems to a given requestor. + * + * @param workingCopy + * @param problemRequestor + */ + private void reportProblems(CompilationUnit workingCopy, IProblemRequestor problemRequestor) { + try { + problemRequestor.beginReporting(); + for (Iterator iteraror = this.problems.values().iterator(); iteraror.hasNext();) { + CategorizedProblem[] categorizedProblems = (CategorizedProblem[]) iteraror.next(); + if (categorizedProblems == null) continue; + for (int i = 0, length = categorizedProblems.length; i < length; i++) { + CategorizedProblem problem = categorizedProblems[i]; + if (JavaModelManager.VERBOSE){ + System.out.println("PROBLEM FOUND while reconciling : " + problem.getMessage());//$NON-NLS-1$ + } + if (this.progressMonitor != null && this.progressMonitor.isCanceled()) break; + problemRequestor.acceptProblem(problem); + } + } + } finally { + problemRequestor.endReporting(); + } + } + /** * Returns the working copy this operation is working on. */ protected CompilationUnit getWorkingCopy() { return (CompilationUnit)getElementToProcess(); } - /** - * @see JavaModelOperation#isReadOnly + + /* (non-Javadoc) + * @see org.eclipse.jdt.internal.core.JavaModelOperation#isReadOnly() */ public boolean isReadOnly() { return true; } + /* * Makes the given working copy consistent, computes the delta and computes an AST if needed. * Returns the AST. @@ -232,6 +254,7 @@ }); } } + protected IJavaModelStatus verify() { IJavaModelStatus status = super.verify(); if (!status.isOK()) { @@ -244,5 +267,4 @@ return status; } - } Index: model/org/eclipse/jdt/core/WorkingCopyOwner.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/WorkingCopyOwner.java,v --- model/org/eclipse/jdt/core/WorkingCopyOwner.java 13 Jul 2006 11:23:22 -0000 1.20 +++ model/org/eclipse/jdt/core/WorkingCopyOwner.java 26 Feb 2007 15:31:28 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,7 +19,7 @@ import org.eclipse.jdt.internal.core.PackageFragment; /** - * The owner of an ICompilationUnit handle in working copy mode. + * The owner of an {@link ICompilationUnit} handle in working copy mode. * An owner is used to identify a working copy and to create its buffer. *

* Clients should subclass this class to instantiate a working copy owner that is specific to their need and that @@ -71,6 +71,25 @@ return BufferManager.getDefaultBufferManager().createBuffer(workingCopy); } + + /** + * Returns the problem requestor used by a working copy of this working copy owner. + *

+ * By default, no problem requestor is configured. Clients can override this + * method to provide a requestor. + *

+ * + * @param workingCopy The problem requestor used for the given working copy. + * If null, then return the problem requestor used for all working + * copies of the working copy owner. + * @return the problem requestor to be used by working copies of this working + * copy owner or null if no problem requestor is configured. + * + * @since 3.3 + */ + public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { + return null; + } /** * Returns a new working copy with the given name using this working copy owner to @@ -81,11 +100,12 @@ * However this Java project has the given classpath that is used when resolving names * in this working copy. *

- * A DOM AST created using this working copy will have bindings resolved using the given - * classpath, and problem are reported to the given problem requestor. + * If a DOM AST is created using this working copy, then given classpath will be used + * if bindings need to be resolved and problems will be reported to the given problem requestor + * if it is not null. *

- * JavaCore#getOptions() is used to create the DOM AST as it is not - * possible to set the options on the non-existing Java project. + * Options used to create the DOM AST are got from {@link JavaCore#getOptions()} + * as it is not possible to set the options on a non-existing Java project. *

* When the working copy instance is created, an {@link IJavaElementDelta#ADDED added delta} is * reported on this working copy. @@ -111,6 +131,8 @@ * @return a new working copy * @see ICompilationUnit#becomeWorkingCopy(IProblemRequestor, IProgressMonitor) * @since 3.2 + * + * @deprecated Use {@link #newWorkingCopy(String, IClasspathEntry[], IProgressMonitor)} instead. */ public final ICompilationUnit newWorkingCopy(String name, IClasspathEntry[] classpath, IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException { ExternalJavaProject project = new ExternalJavaProject(classpath); @@ -119,5 +141,52 @@ result.becomeWorkingCopy(problemRequestor, monitor); return result; } + + /** + * Returns a new working copy with the given name using this working copy owner to + * create its buffer. + *

+ * This working copy always belongs to the default package in a package + * fragment root that corresponds to its Java project, and this Java project never exists. + * However this Java project has the given classpath that is used when resolving names + * in this working copy. + *

+ * If a DOM AST is created using this working copy, then given classpath will be used + * if bindings need to be resolved and problems will be reported to the current working copy + * owner problem requestor if it is not null. + *

+ * Options used to create the DOM AST are got from {@link JavaCore#getOptions()} + * as it is not possible to set the options on a non-existing Java project. + *

+ * When the working copy instance is created, an {@link IJavaElementDelta#ADDED added delta} is + * reported on this working copy. + *

+ * Once done with the working copy, users of this method must discard it using + * {@link ICompilationUnit#discardWorkingCopy()}. + *

+ * Note that when such working copy is committed, only its buffer is saved (see + * {@link IBuffer#save(IProgressMonitor, boolean)}) but no resource is created. + *

+ * This method is not intended to be overriden by clients. + *

+ * + * @param name the name of the working copy (e.g. "X.java") + * @param classpath the classpath used to resolve names in this working copy + * @param monitor a progress monitor used to report progress while opening the working copy + * or null if no progress should be reported + * @throws JavaModelException if the contents of this working copy can + * not be determined. + * @return a new working copy + * @see ICompilationUnit#becomeWorkingCopy(IProgressMonitor) + * + * @since 3.3 + */ + public final ICompilationUnit newWorkingCopy(String name, IClasspathEntry[] classpath, IProgressMonitor monitor) throws JavaModelException { + ExternalJavaProject project = new ExternalJavaProject(classpath); + IPackageFragment parent = project.getPackageFragmentRoot(Path.EMPTY).getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME); + CompilationUnit result = new CompilationUnit((PackageFragment) parent, name, this); + result.becomeWorkingCopy(getProblemRequestor(result), monitor); + return result; + } } Index: model/org/eclipse/jdt/core/ICompilationUnit.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java,v --- model/org/eclipse/jdt/core/ICompilationUnit.java 24 Nov 2006 13:56:36 -0000 1.59 +++ model/org/eclipse/jdt/core/ICompilationUnit.java 26 Feb 2007 15:31:27 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -70,6 +70,33 @@ */ void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException; /** + * Changes this compilation unit handle into a working copy. A new {@link IBuffer} is + * created using this compilation unit handle's owner. Uses the primary owner is none was + * specified when this compilation unit handle was created. + *

+ * When switching to working copy mode, problems are reported to the {@link IProblemRequestor + * problem requestor} of the {@link WorkingCopyOwner working copy owner}. + *

+ *

+ * Once in working copy mode, changes to this compilation unit or its children are done in memory. + * Only the new buffer is affected. Using {@link #commitWorkingCopy(boolean, IProgressMonitor)} + * will bring the underlying resource in sync with this compilation unit. + *

+ *

+ * If this compilation unit was already in working copy mode, an internal counter is incremented and no + * other action is taken on this compilation unit. To bring this compilation unit back into the original mode + * (where it reflects the underlying resource), {@link #discardWorkingCopy} must be call as many + * times as {@link #becomeWorkingCopy(IProblemRequestor, IProgressMonitor)}. + *

+ * + * @param monitor a progress monitor used to report progress while opening this compilation unit + * or null if no progress should be reported + * @throws JavaModelException if this compilation unit could not become a working copy. + * @see #discardWorkingCopy() + * @since 3.3 + */ +void becomeWorkingCopy(IProgressMonitor monitor) throws JavaModelException; +/** * Commits the contents of this working copy to its underlying resource. * *

It is possible that the contents of the original resource have changed @@ -223,10 +250,13 @@ * This has no effect if this compilation unit was not in working copy mode. *

*

- * If {@link #becomeWorkingCopy} was called several times on this + * If becomeWorkingCopy(...) methods was called several times on this * compilation unit, {@link #discardWorkingCopy} must be called as * many times before it switches back to the original mode. *

+ *

{@link #discardWorkingCopy()} also has to be called on each compilation unit returned by + * {@link #getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)}. + *

* * @throws JavaModelException if this working copy could not return in its original mode. * @see #becomeWorkingCopy(IProblemRequestor, IProgressMonitor) Index: model/org/eclipse/jdt/core/IJavaElementDelta.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaElementDelta.java,v --- model/org/eclipse/jdt/core/IJavaElementDelta.java 29 Sep 2006 17:13:57 -0000 1.34 +++ model/org/eclipse/jdt/core/IJavaElementDelta.java 26 Feb 2007 15:31:28 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,45 +19,45 @@ * changed, and any children that have changed. *

* Deltas have a different status depending on the kind of change they represent. - * The list below summarizes each status (as returned by getKind) + * The list below summarizes each status (as returned by {@link #getKind}) * and its meaning (see individual constants for a more detailled description): *

@@ -65,11 +65,11 @@ *

* Move operations are indicated by other change flags, layered on top * of the change flags described above. If element A is moved to become B, - * the delta for the change in A will have status REMOVED, - * with change flag F_MOVED_TO. In this case, - * getMovedToElement on delta A will return the handle for B. - * The delta for B will have status ADDED, with change flag - * F_MOVED_FROM, and getMovedFromElement on delta + * the delta for the change in A will have status {@link #REMOVED}, + * with change flag {@link #F_MOVED_TO}. In this case, + * {@link #getMovedToElement} on delta A will return the handle for B. + * The delta for B will have status {@link #ADDED}, with change flag + * {@link #F_MOVED_FROM}, and {@link #getMovedFromElement} on delta * B will return the handle for A. (Note, the handle to A in this case represents * an element that no longer exists). *

@@ -78,25 +78,25 @@ * do not imply anything about the parent or children of the element. *

*

- * The F_ADDED_TO_CLASSPATH, F_REMOVED_FROM_CLASSPATH and - * F_CLASSPATH_REORDER flags are triggered by changes to a project's classpath. They do not mean that + * The {@link #F_ADDED_TO_CLASSPATH}, {@link #F_REMOVED_FROM_CLASSPATH} and + * {@link #F_CLASSPATH_REORDER} flags are triggered by changes to a project's classpath. They do not mean that * the underlying resource was added, removed or changed. For example, if a project P already contains a folder src, then - * adding a classpath entry with the 'P/src' path to the project's classpath will result in an IJavaElementDelta - * with the F_ADDED_TO_CLASSPATH flag for the IPackageFragmentRoot P/src. + * adding a classpath entry with the 'P/src' path to the project's classpath will result in an {@link IJavaElementDelta} + * with the {@link #F_ADDED_TO_CLASSPATH} flag for the {@link IPackageFragmentRoot} P/src. * On the contrary, if a resource is physically added, removed or changed and this resource corresponds to a classpath - * entry of the project, then an IJavaElementDelta with the ADDED, - * REMOVED, or CHANGED kind will be fired. + * entry of the project, then an {@link IJavaElementDelta} with the {@link #ADDED}, + * {@link #REMOVED}, or {@link #CHANGED} kind will be fired. *

*

* Note that when a source attachment path or a source attachment root path is changed, then the flags of the delta contain - * both F_SOURCEATTACHED and F_SOURCEDETTACHED. + * both {@link #F_SOURCEATTACHED} and {@link #F_SOURCEDETACHED}. *

*

- * No assumptions should be made on whether the java element delta tree is rooted at the IJavaModel + * No assumptions should be made on whether the java element delta tree is rooted at the {@link IJavaModel} * level or not. *

*

- * IJavaElementDelta object are not valid outside the dynamic scope + * {@link IJavaElementDelta} object are not valid outside the dynamic scope * of the notification. *

*

@@ -133,49 +133,49 @@ /** * Change flag indicating that the modifiers of the element have changed. - * This flag is only valid if the element is an IMember. + * This flag is only valid if the element is an {@link IMember}. */ public int F_MODIFIERS = 0x000002; /** * Change flag indicating that there are changes to the children of the element. - * This flag is only valid if the element is an IParent. + * This flag is only valid if the element is an {@link IParent}. */ public int F_CHILDREN = 0x000008; /** * Change flag indicating that the element was moved from another location. - * The location of the old element can be retrieved using getMovedFromElement. + * The location of the old element can be retrieved using {@link #getMovedFromElement}. */ public int F_MOVED_FROM = 0x000010; /** * Change flag indicating that the element was moved to another location. - * The location of the new element can be retrieved using getMovedToElement. + * The location of the new element can be retrieved using {@link #getMovedToElement}. */ public int F_MOVED_TO = 0x000020; /** * Change flag indicating that a classpath entry corresponding to the element has been added to the project's classpath. - * This flag is only valid if the element is an IPackageFragmentRoot. + * This flag is only valid if the element is an {@link IPackageFragmentRoot}. */ public int F_ADDED_TO_CLASSPATH = 0x000040; /** * Change flag indicating that a classpath entry corresponding to the element has been removed from the project's - * classpath. This flag is only valid if the element is an IPackageFragmentRoot. + * classpath. This flag is only valid if the element is an {@link IPackageFragmentRoot}. */ public int F_REMOVED_FROM_CLASSPATH = 0x000080; /** * Change flag indicating that a classpath entry corresponding to the element has changed position in the project's - * classpath. This flag is only valid if the element is an IPackageFragmentRoot. + * classpath. This flag is only valid if the element is an {@link IPackageFragmentRoot}. * @deprecated Use {@link #F_REORDER} instead. */ public int F_CLASSPATH_REORDER = 0x000100; /** * Change flag indicating that the element has changed position relatively to its siblings. - * If the element is an IPackageFragmentRoot, a classpath entry corresponding + * If the element is an {@link IPackageFragmentRoot}, a classpath entry corresponding * to the element has changed position in the project's classpath. * * @since 2.1 @@ -183,19 +183,19 @@ public int F_REORDER = 0x000100; /** - * Change flag indicating that the underlying IProject has been - * opened. This flag is only valid if the element is an IJavaProject. + * Change flag indicating that the underlying {@link org.eclipse.core.resources.IProject} has been + * opened. This flag is only valid if the element is an {@link IJavaProject}. */ public int F_OPENED = 0x000200; /** - * Change flag indicating that the underlying IProject has been - * closed. This flag is only valid if the element is an IJavaProject. + * Change flag indicating that the underlying {@link org.eclipse.core.resources.IProject} has been + * closed. This flag is only valid if the element is an {@link IJavaProject}. */ public int F_CLOSED = 0x000400; /** - * Change flag indicating that one of the supertypes of an IType + * Change flag indicating that one of the supertypes of an {@link IType} * has changed. */ public int F_SUPER_TYPES = 0x000800; @@ -203,14 +203,14 @@ /** * Change flag indicating that the source attachment path or the source attachment root path of a classpath entry * corresponding to the element was added. This flag is only valid if the element is an - * IPackageFragmentRoot. + * {@link IPackageFragmentRoot}. */ public int F_SOURCEATTACHED = 0x001000; /** * Change flag indicating that the source attachment path or the source attachment root path of a classpath entry * corresponding to the element was removed. This flag is only valid if the element is an - * IPackageFragmentRoot. + * {@link IPackageFragmentRoot}. */ public int F_SOURCEDETACHED = 0x002000; @@ -220,9 +220,9 @@ * members. *

* Clients can use this flag to find out if a compilation unit - * that have a F_CONTENT change should assume that there are - * no finer grained changes (F_FINE_GRAINED is set) or if - * finer grained changes were not considered (F_FINE_GRAINED + * that have a {@link #F_CONTENT} change should assume that there are + * no finer grained changes ({@link #F_FINE_GRAINED} is set) or if + * finer grained changes were not considered ({@link #F_FINE_GRAINED} * is not set). * * @since 2.0 @@ -231,7 +231,7 @@ /** * Change flag indicating that the element's archive content on the classpath has changed. - * This flag is only valid if the element is an IPackageFragmentRoot + * This flag is only valid if the element is an {@link IPackageFragmentRoot} * which is an archive. * * @see IPackageFragmentRoot#isArchive() @@ -242,7 +242,7 @@ /** * Change flag indicating that a compilation unit has become a primary working copy, or that a * primary working copy has reverted to a compilation unit. - * This flag is only valid if the element is an ICompilationUnit. + * This flag is only valid if the element is an {@link ICompilationUnit}. * * @since 3.0 */ @@ -250,7 +250,7 @@ /** * Change flag indicating that the raw classpath (or the output folder) of a project has changed. - * This flag is only valid if the element is an IJavaProject. + * This flag is only valid if the element is an {@link IJavaProject}. * * @since 3.0 */ @@ -258,7 +258,7 @@ /** * Change flag indicating that the resource of a primary compilation unit has changed. - * This flag is only valid if the element is a primary ICompilationUnit. + * This flag is only valid if the element is a primary {@link ICompilationUnit}. * * @since 3.0 */ @@ -267,7 +267,7 @@ /** * Change flag indicating that a reconcile operation has affected the compilation unit AST created in a * previous reconcile operation. Use {@link #getCompilationUnitAST()} to retrieve the AST (if any is available). - * This flag is only valid if the element is an ICompilationUnit in working copy mode. + * This flag is only valid if the element is an {@link ICompilationUnit} in working copy mode. * * @since 3.2 */ @@ -275,7 +275,7 @@ /** * Change flag indicating that the categories of the element have changed. - * This flag is only valid if the element is an IMember. + * This flag is only valid if the element is an {@link IMember}. * * @since 3.2 */ @@ -298,9 +298,10 @@ * This returns a non-null value if and only if: *

+ * * @return the AST created during the last reconcile operation * @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, org.eclipse.core.runtime.IProgressMonitor) * @see #F_AST_AFFECTED @@ -334,8 +335,8 @@ public int getFlags(); /** - * Returns the kind of this delta - one of ADDED, REMOVED, - * or CHANGED. + * Returns the kind of this delta - one of {@link #ADDED}, {@link #REMOVED}, + * or {@link #CHANGED}. * * @return the kind of this delta */ @@ -344,21 +345,21 @@ /** * Returns an element describing this element before it was moved * to its current location, or null if the - * F_MOVED_FROM change flag is not set. + * {@link #F_MOVED_FROM} change flag is not set. * * @return an element describing this element before it was moved * to its current location, or null if the - * F_MOVED_FROM change flag is not set + * {@link #F_MOVED_FROM} change flag is not set */ public IJavaElement getMovedFromElement(); /** * Returns an element describing this element in its new location, - * or null if the F_MOVED_TO change + * or null if the {@link #F_MOVED_TO} change * flag is not set. * * @return an element describing this element in its new location, - * or null if the F_MOVED_TO change + * or null if the {@link #F_MOVED_TO} change * flag is not set */ public IJavaElement getMovedToElement(); Index: src/org/eclipse/jdt/core/tests/model/WorkingCopyOwnerTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyOwnerTests.java,v --- src/org/eclipse/jdt/core/tests/model/WorkingCopyOwnerTests.java 28 Jun 2006 16:12:16 -0000 1.59 +++ src/org/eclipse/jdt/core/tests/model/WorkingCopyOwnerTests.java 26 Feb 2007 15:31:57 -0000 @@ -41,14 +41,12 @@ public static Test suite() { return buildModelTestSuite(WorkingCopyOwnerTests.class); } + // Use this static initializer to specify subset for tests // All specified tests which do not belong to the class are skipped... static { - // Names of tests to run: can be "testBugXXXX" or "BugXXXX") // TESTS_NAMES = new String[] { "testNewWorkingCopy03" }; - // Numbers of tests to run: "test" will be run for each number of this array // TESTS_NUMBERS = new int[] { 2, 12 }; - // Range numbers of tests to run: all tests between "test" and "test" will be run for { first, last } // TESTS_RANGE = new int[] { 16, -1 }; } @@ -1031,7 +1029,8 @@ return buffer; } }; - this.workingCopy = owner.newWorkingCopy("X.java", null/*no classpath*/, null/*no problem requestor*/, null/*no progress monitor*/); +// this.workingCopy = owner.newWorkingCopy("X.java", null/*no classpath*/, null/*no problem requestor*/, null/*no progress monitor*/); + this.workingCopy = owner.newWorkingCopy("X.java", null/*no classpath*/, null/*no progress monitor*/); this.workingCopy.commitWorkingCopy(true, null); assertFalse("Should not have unsaved changes", this.workingCopy.hasUnsavedChanges()); } Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java,v --- src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 26 Jan 2007 16:49:34 -0000 1.179 +++ src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 26 Feb 2007 15:31:56 -0000 @@ -1538,7 +1538,7 @@ } public ICompilationUnit getWorkingCopy(String path, String source) throws JavaModelException { return getWorkingCopy(path, source, false); - } + } public ICompilationUnit getWorkingCopy(String path, String source, boolean computeProblems) throws JavaModelException { if (this.wcOwner == null) this.wcOwner = new WorkingCopyOwner() {}; return getWorkingCopy(path, source, this.wcOwner, computeProblems); @@ -1632,15 +1632,21 @@ protected ICompilationUnit newExternalWorkingCopy(String name, final String contents) throws JavaModelException { return newExternalWorkingCopy(name, null/*no classpath*/, null/*no problem requestor*/, contents); } - protected ICompilationUnit newExternalWorkingCopy(String name, IClasspathEntry[] classpath, IProblemRequestor problemRequestor, final String contents) throws JavaModelException { + protected ICompilationUnit newExternalWorkingCopy(String name, IClasspathEntry[] classpath, final IProblemRequestor problemRequestor, final String contents) throws JavaModelException { WorkingCopyOwner owner = new WorkingCopyOwner() { public IBuffer createBuffer(ICompilationUnit wc) { IBuffer buffer = super.createBuffer(wc); buffer.setContents(contents); return buffer; } + + public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { + return problemRequestor; + } + }; - return owner.newWorkingCopy(name, classpath, problemRequestor, null/*no progress monitor*/); +// return owner.newWorkingCopy(name, classpath, problemRequestor, null/*no progress monitor*/); + return owner.newWorkingCopy(name, classpath, null/*no progress monitor*/); } public byte[] read(java.io.File file) throws java.io.IOException {