### Eclipse Workspace Patch 1.0
#P org.eclipse.jdt.core.tests.model
Index: src/org/eclipse/jdt/core/tests/model/ReconcilerStatementsRecoveryTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerStatementsRecoveryTests.java,v
retrieving revision 1.4
diff -u -r1.4 ReconcilerStatementsRecoveryTests.java
--- src/org/eclipse/jdt/core/tests/model/ReconcilerStatementsRecoveryTests.java 29 Mar 2006 04:03:08 -0000 1.4
+++ src/org/eclipse/jdt/core/tests/model/ReconcilerStatementsRecoveryTests.java 9 Mar 2007 21:24:02 -0000
@@ -46,7 +46,7 @@
boolean isCanceling = false;
public void acceptProblem(IProblem problem) {
- if (isCanceling) this.progressMonitor.setCanceled(true); // auto-cancel on first problem
+ if (this.isCanceling) this.progressMonitor.setCanceled(true); // auto-cancel on first problem
super.acceptProblem(problem);
}
}
@@ -121,7 +121,7 @@
public void setUp() throws Exception {
super.setUp();
this.problemRequestor = new ProblemRequestor();
- this.workingCopy = getCompilationUnit("Reconciler/src/p1/X.java").getWorkingCopy(new WorkingCopyOwner() {}, this.problemRequestor, null);
+ this.workingCopy = getCompilationUnit("Reconciler/src/p1/X.java").getWorkingCopy(newWorkingCopyOwner(this.problemRequestor), null);
this.problemRequestor.initialize(this.workingCopy.getSource().toCharArray());
startDeltas();
}
Index: src/org/eclipse/jdt/core/tests/model/InclusionPatternsTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/InclusionPatternsTests.java,v
retrieving revision 1.17
diff -u -r1.17 InclusionPatternsTests.java
--- src/org/eclipse/jdt/core/tests/model/InclusionPatternsTests.java 27 Jun 2006 09:53:21 -0000 1.17
+++ src/org/eclipse/jdt/core/tests/model/InclusionPatternsTests.java 9 Mar 2007 21:23:05 -0000
@@ -386,9 +386,10 @@
" class A",
root);
}
-/*
+/**
* Ensure that a type can be resolved if it is included but not its super packages.
* (regression test for bug 119161 classes in "deep" packages not fully recognized when using tight inclusion filters)
+ * @deprecated
*/
public void testIncludeCUOnly01() throws CoreException {
setClasspath(new String[] {"/P/src", "p1/p2/*.java|q/*.java"});
@@ -409,7 +410,38 @@
"public class Y extends X {\n" +
"}",
null/*primary owner*/,
+ problemRequestor
+ );
+ assertProblems(
+ "Unepected problems",
+ "----------\n" +
+ "----------\n",
problemRequestor);
+ } finally {
+ if (workingCopy != null)
+ workingCopy.discardWorkingCopy();
+ }
+}
+public void testIncludeCUOnly01_new() throws CoreException {
+ setClasspath(new String[] {"/P/src", "p1/p2/*.java|q/*.java"});
+ addLibraryEntry(getJavaProject("P"), getExternalJCLPathString(), false);
+ createFolder("/P/src/p1/p2");
+ createFile(
+ "/P/src/p1/p2/X.java",
+ "package p1.p2;\n" +
+ "public class X {\n" +
+ "}"
+ );
+ ICompilationUnit workingCopy = null;
+ try {
+ ProblemRequestor problemRequestor = new ProblemRequestor();
+ workingCopy = getWorkingCopy(
+ "/P/src/Y.java",
+ "import p1.p2.X;\n" +
+ "public class Y extends X {\n" +
+ "}",
+ newWorkingCopyOwner(problemRequestor)
+ );
assertProblems(
"Unepected problems",
"----------\n" +
@@ -420,9 +452,10 @@
workingCopy.discardWorkingCopy();
}
}
-/*
+/**
* Ensure that a type can be resolved if it is included but not its super packages.
* (regression test for bug 119161 classes in "deep" packages not fully recognized when using tight inclusion filters)
+ * @deprecated
*/
public void testIncludeCUOnly02() throws CoreException {
setClasspath(new String[] {"/P/src", "p1/p2/p3/*.java|q/*.java"});
@@ -443,7 +476,38 @@
"public class Y extends X {\n" +
"}",
null/*primary owner*/,
+ problemRequestor
+ );
+ assertProblems(
+ "Unepected problems",
+ "----------\n" +
+ "----------\n",
problemRequestor);
+ } finally {
+ if (workingCopy != null)
+ workingCopy.discardWorkingCopy();
+ }
+}
+public void testIncludeCUOnly02_new() throws CoreException {
+ setClasspath(new String[] {"/P/src", "p1/p2/p3/*.java|q/*.java"});
+ addLibraryEntry(getJavaProject("P"), getExternalJCLPathString(), false);
+ createFolder("/P/src/p1/p2/p3");
+ createFile(
+ "/P/src/p1/p2/p3/X.java",
+ "package p1.p2.p3;\n" +
+ "public class X {\n" +
+ "}"
+ );
+ ICompilationUnit workingCopy = null;
+ try {
+ ProblemRequestor problemRequestor = new ProblemRequestor();
+ workingCopy = getWorkingCopy(
+ "/P/src/Y.java",
+ "import p1.p2.p3.X;\n" +
+ "public class Y extends X {\n" +
+ "}",
+ newWorkingCopyOwner(problemRequestor)
+ );
assertProblems(
"Unepected problems",
"----------\n" +
@@ -466,10 +530,10 @@
"public class A {\n" +
"}"
);
- assertTrue("Resource should not be on classpath", !project.isOnClasspath(file));
+ assertTrue("Resource should not be on classpath", !this.project.isOnClasspath(file));
ICompilationUnit cu = getCompilationUnit("/P/src/p/A.java");
- assertTrue("CU should not be on classpath", !project.isOnClasspath(cu));
+ assertTrue("CU should not be on classpath", !this.project.isOnClasspath(cu));
}
/*
* Ensures that a cu that is included is on the classpath of the project.
@@ -483,10 +547,10 @@
"public class A {\n" +
"}"
);
- assertTrue("Resource should be on classpath", project.isOnClasspath(file));
+ assertTrue("Resource should be on classpath", this.project.isOnClasspath(file));
ICompilationUnit cu = getCompilationUnit("/P/src/p/A.java");
- assertTrue("CU should be on classpath", project.isOnClasspath(cu));
+ assertTrue("CU should be on classpath", this.project.isOnClasspath(cu));
}
/*
* Ensures that a non-java resource that is not included is not on the classpath of the project.
@@ -495,7 +559,7 @@
setClasspath(new String[] {"/P/src", "**/X.java"});
createFolder("/P/src/p");
IFile file = createFile("/P/src/p/readme.txt", "");
- assertTrue("Resource should not be on classpath", !project.isOnClasspath(file));
+ assertTrue("Resource should not be on classpath", !this.project.isOnClasspath(file));
}
/*
* Ensures that a non-java resource that is included is on the classpath of the project.
@@ -504,7 +568,7 @@
setClasspath(new String[] {"/P/src", "p/**"});
createFolder("/P/src/p");
IFile file = createFile("/P/src/p/readme.txt", "");
- assertTrue("Resource should be on classpath", project.isOnClasspath(file));
+ assertTrue("Resource should be on classpath", this.project.isOnClasspath(file));
}
/*
* Ensures that moving a folder that contains an included package reports the correct delta.
Index: src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java,v
retrieving revision 1.27
diff -u -r1.27 TypeHierarchyNotificationTests.java
--- src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java 6 Mar 2007 04:43:19 -0000 1.27
+++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java 9 Mar 2007 21:24:53 -0000
@@ -122,7 +122,7 @@
ICompilationUnit copy = null;
try {
copy = getCompilationUnit("TypeHierarchyNotification", "src", "p3", "A.java");
- copy.becomeWorkingCopy(null, null);
+ copy.becomeWorkingCopy(null);
IRegion region = JavaCore.newRegion();
region.add(copy.getParent());
@@ -599,7 +599,7 @@
"}"
);
workingCopy = getCompilationUnit("/P1/p/X.java");
- workingCopy.becomeWorkingCopy(null/*no pb requestor*/, null/*no progress*/);
+ workingCopy.becomeWorkingCopy(null/*no progress*/);
h = workingCopy.getType("X").newTypeHierarchy(null);
h.addTypeHierarchyChangedListener(this);
@@ -713,7 +713,7 @@
ICompilationUnit copy = null;
try {
copy = getCompilationUnit("TypeHierarchyNotification", "src", "p2", "A.java");
- copy.becomeWorkingCopy(null, null);
+ copy.becomeWorkingCopy(null);
IRegion region = JavaCore.newRegion();
region.add(copy.getParent());
@@ -754,7 +754,7 @@
ICompilationUnit copy = getCompilationUnit("TypeHierarchyNotification", "src", "p2", "B.java");
ITypeHierarchy h = null;
try {
- copy.becomeWorkingCopy(null, null);
+ copy.becomeWorkingCopy(null);
h = getCompilationUnit("TypeHierarchyNotification", "src", "p2", "A.java").getType("A").newTypeHierarchy(javaProject, null);
h.addTypeHierarchyChangedListener(this);
Index: src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java,v
retrieving revision 1.69
diff -u -r1.69 TypeHierarchyTests.java
--- src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 6 Mar 2007 04:43:20 -0000 1.69
+++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 9 Mar 2007 21:25:02 -0000
@@ -643,7 +643,7 @@
ICompilationUnit workingCopy = null;
try {
workingCopy = getCompilationUnit("/TypeHierarchy/src/q4/Y.java");
- workingCopy.becomeWorkingCopy(null, null);
+ workingCopy.becomeWorkingCopy(null);
workingCopy.getBuffer().setContents("");
workingCopy.makeConsistent(null);
Index: src/org/eclipse/jdt/core/tests/model/ResolveTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests.java,v
retrieving revision 1.71
diff -u -r1.71 ResolveTests.java
--- src/org/eclipse/jdt/core/tests/model/ResolveTests.java 7 Dec 2006 14:49:46 -0000 1.71
+++ src/org/eclipse/jdt/core/tests/model/ResolveTests.java 9 Mar 2007 21:24:23 -0000
@@ -19,7 +19,6 @@
public class ResolveTests extends AbstractJavaModelTests {
ICompilationUnit wc = null;
- WorkingCopyOwner owner = null;
static {
// TESTS_NAMES = new String[] { "testSecondaryTypes" };
@@ -32,14 +31,14 @@
super(name);
}
public ICompilationUnit getWorkingCopy(String path, String source) throws JavaModelException {
- return super.getWorkingCopy(path, source, this.owner, null);
+ return super.getWorkingCopy(path, source, this.wcOwner);
}
private IJavaElement[] select(String path, String source, String selection) throws JavaModelException {
this.wc = getWorkingCopy(path, source);
- String str = wc.getSource();
+ String str = this.wc.getSource();
int start = str.lastIndexOf(selection);
int length = selection.length();
- return wc.codeSelect(start, length, this.owner);
+ return this.wc.codeSelect(start, length, this.wcOwner);
}
public void setUpSuite() throws Exception {
super.setUpSuite();
@@ -48,8 +47,7 @@
}
protected void setUp() throws Exception {
super.setUp();
-
- this.owner = new WorkingCopyOwner(){};
+ this.wcOwner = new WorkingCopyOwner(){};
}
public void tearDownSuite() throws Exception {
@@ -92,7 +90,8 @@
"class Test1 {\n" +
"}\n" +
"class Test2 {\n" +
- "}");
+ "}"
+ );
String str = this.workingCopies[0].getSource();
int start = str.lastIndexOf("foo(o)");
Index: src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java,v
retrieving revision 1.28
diff -u -r1.28 AttachedJavadocTests.java
--- src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java 6 Mar 2007 04:43:19 -0000 1.28
+++ src/org/eclipse/jdt/core/tests/model/AttachedJavadocTests.java 9 Mar 2007 21:22:36 -0000
@@ -33,7 +33,6 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.WorkingCopyOwner;
public class AttachedJavadocTests extends ModifyingResourceTests {
static {
@@ -85,7 +84,7 @@
entries[i] = JavaCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), entry.getAccessRules(), new IClasspathAttribute[] { attribute}, entry.isExported());
}
}
- project.setRawClasspath(entries, null);
+ this.project.setRawClasspath(entries, null);
IPackageFragmentRoot[] roots = this.project.getAllPackageFragmentRoots();
int count = 0;
@@ -95,14 +94,14 @@
case IPackageFragmentRoot.K_BINARY :
if (!packageFragmentRoot.isExternal()) {
count++;
- if (root == null) {
- root = packageFragmentRoot;
+ if (this.root == null) {
+ this.root = packageFragmentRoot;
}
}
}
}
assertEquals("Wrong value", 1, count); //$NON-NLS-1$
- assertNotNull("Should not be null", root); //$NON-NLS-1$
+ assertNotNull("Should not be null", this.root); //$NON-NLS-1$
}
/**
@@ -469,8 +468,7 @@
"/AttachedJavadocProject/src/Test.java",
"import p2.Y;\n" +
"public class Test extends Y { }",
- new WorkingCopyOwner() {},
- problemRequestor
+ newWorkingCopyOwner(problemRequestor)
);
assertProblems(
"Unexpected problems",
Index: src/org/eclipse/jdt/core/tests/model/CreateImportsTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateImportsTests.java,v
retrieving revision 1.1
diff -u -r1.1 CreateImportsTests.java
--- src/org/eclipse/jdt/core/tests/model/CreateImportsTests.java 20 Jun 2006 11:33:01 -0000 1.1
+++ src/org/eclipse/jdt/core/tests/model/CreateImportsTests.java 9 Mar 2007 21:23:01 -0000
@@ -37,7 +37,7 @@
protected void setUp() throws Exception {
super.setUp();
ICompilationUnit workingCopy = getCompilationUnit("P/X.java");
- workingCopy.becomeWorkingCopy(null/*no problem requested*/, null/*no progress*/);
+ workingCopy.becomeWorkingCopy(null/*no progress*/);
this.workingCopies = new ICompilationUnit[] {workingCopy};
setContents(
"public class X {\n" +
Index: src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java,v
retrieving revision 1.39
diff -u -r1.39 SortCompilationUnitElementsTests.java
--- src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java 31 Jan 2007 20:18:08 -0000 1.39
+++ src/org/eclipse/jdt/core/tests/model/SortCompilationUnitElementsTests.java 9 Mar 2007 21:24:49 -0000
@@ -2005,7 +2005,7 @@
" A, B, C, Z;\n" +
"}";
unit = this.getCompilationUnit("/P/src/X.java");
- unit.becomeWorkingCopy(null, null);
+ unit.becomeWorkingCopy(null);
String source = unit.getSource();
Document document = new Document(source);
CompilerOptions options = new CompilerOptions(unit.getJavaProject().getOptions(true));
@@ -2058,7 +2058,7 @@
"}"
);
unit = this.getCompilationUnit("/P/src/X.java");
- unit.becomeWorkingCopy(null, null);
+ unit.becomeWorkingCopy(null);
CompilerOptions options = new CompilerOptions(unit.getJavaProject().getOptions(true));
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setCompilerOptions(options.getMap());
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
retrieving revision 1.59
diff -u -r1.59 WorkingCopyOwnerTests.java
--- 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 9 Mar 2007 21:25:11 -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
- * 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,10 @@ * @return a new working copy * @see ICompilationUnit#becomeWorkingCopy(IProblemRequestor, IProgressMonitor) * @since 3.2 + * + * @deprecated Use {@link #newWorkingCopy(String, IClasspathEntry[], IProgressMonitor)} instead. + * Note that if this deprecated method is used, problems may be reported twice + * if the given requestor is not the same as the current working copy owner one. */ public final ICompilationUnit newWorkingCopy(String name, IClasspathEntry[] classpath, IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException { ExternalJavaProject project = new ExternalJavaProject(classpath); @@ -119,5 +143,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. Problems will be reported to the problem requestor
+ * of the current working copy owner problem if it is not null
.
+ *
+ * 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 + * ornull
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
retrieving revision 1.59
diff -u -r1.59 ICompilationUnit.java
--- model/org/eclipse/jdt/core/ICompilationUnit.java 24 Nov 2006 13:56:36 -0000 1.59
+++ model/org/eclipse/jdt/core/ICompilationUnit.java 9 Mar 2007 21:25:33 -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
@@ -67,9 +67,39 @@
* @throws JavaModelException if this compilation unit could not become a working copy.
* @see #discardWorkingCopy()
* @since 3.0
+ *
+ * @deprecated Use {@link #becomeWorkingCopy(IProgressMonitor)} instead.
+ * Note that if this deprecated method is used, problems may be reported twice
+ * if the compilation unit working copy owner has a different requestor than
+ * the one given as parameter.
*/
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 + * ornull
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,9 +253,10 @@ * This has no effect if this compilation unit was not in working copy mode. *
*- * If {@link #becomeWorkingCopy} was called several times on this - * compilation unit, {@link #discardWorkingCopy} must be called as - * many times before it switches back to the original mode. + * If {@link #becomeWorkingCopy(IProgressMonitor)} method was called several + * times on this compilation unit, {@link #discardWorkingCopy()} must be called + * as many times before it switches back to the original mode. Same as + * for method {@link #getWorkingCopy(IProgressMonitor)}. *
* * @throws JavaModelException if this working copy could not return in its original mode. @@ -435,6 +466,9 @@ * @return a new working copy of this element using the given factory to create * the buffer, or this element if this element is already a working copy * @since 3.0 + * @deprecated Use {@link ITypeRoot#getWorkingCopy(WorkingCopyOwner, IProgressMonitor)} instead. + * Note that if this deprecated method is used, problems may be reported twice + * if the given working copy owner has a different requestor than the one given as parameter. */ ICompilationUnit getWorkingCopy(WorkingCopyOwner owner, IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException; /** Index: model/org/eclipse/jdt/core/IJavaElementDelta.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaElementDelta.java,v retrieving revision 1.34 diff -u -r1.34 IJavaElementDelta.java --- model/org/eclipse/jdt/core/IJavaElementDelta.java 29 Sep 2006 17:13:57 -0000 1.34 +++ model/org/eclipse/jdt/core/IJavaElementDelta.java 9 Mar 2007 21:25:33 -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):
*
ADDED
- The element described by the delta has been added.REMOVED
- The element described by the delta has been removed.CHANGED
- The element described by the delta has been changed in some way.
- * Specification of the type of change is provided by getFlags
which returns the following values:
+ * F_ADDED_TO_CLASSPATH
- A classpath entry corresponding to the element
+ * IPackageFragmentRoot
.F_ARCHIVE_CONTENT_CHANGED
- The contents of an archive
- * has changed in some way. This flag is only valid if the element is an IPackageFragmentRoot
+ * {@link IPackageFragmentRoot}.F_CHILDREN
- A child of the element has changed in some way. This flag
- * is only valid if the element is an IParent
.F_CLASSPATH_REORDER
- A classpath entry corresponding to the element
+ * IPackageFragmentRoot
.F_CLOSED
- The underlying IProject
- * has been closed. This flag is only valid if the element is an IJavaProject
.F_CONTENT
- The contents of the element have been altered. This flag
+ * {@link IPackageFragmentRoot}.F_FINE_GRAINED
- The delta is a fine-grained delta, that is, an analysis down
+ *F_MODIFIERS
- The modifiers on the element have changed in some way.
- * This flag is only valid if the element is an IMember
.F_OPENED
- The underlying IProject
- * has been opened. This flag is only valid if the element is an IJavaProject
.F_REMOVED_FROM_CLASSPATH
- A classpath entry corresponding to the element
+ * IPackageFragmentRoot
.F_SOURCEATTACHED
- The source attachment path or the source attachment root path
+ * {@link IPackageFragmentRoot}.IPackageFragmentRoot
.F_SOURCEDETACHED
- The source attachment path or the source attachment root path
+ * {@link IPackageFragmentRoot}.IPackageFragmentRoot
.F_SUPER_TYPES
- One of the supertypes of an IType
has changed
* 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).
*
- * 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:
*
ICompilationUnit
in working copy modePOST_RECONCILE
event
+ * 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: model/org/eclipse/jdt/core/ITypeRoot.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeRoot.java,v
retrieving revision 1.4
diff -u -r1.4 ITypeRoot.java
--- model/org/eclipse/jdt/core/ITypeRoot.java 6 Dec 2006 01:43:50 -0000 1.4
+++ model/org/eclipse/jdt/core/ITypeRoot.java 9 Mar 2007 21:25:33 -0000
@@ -79,7 +79,9 @@
* In particular, such a working copy can then be committed in order to create
* the corresponding compilation unit.
* - * Note that possible problems of this working copy are not reported using this method. + * Note that possible problems of this working copy are reported using this method only + * if the given working copy owner returns a problem requestor for this working copy + * (see {@link WorkingCopyOwner#getProblemRequestor(ICompilationUnit)}). *
* * @param owner the working copy owner that creates a buffer that is used to get the content Index: model/org/eclipse/jdt/core/IClassFile.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClassFile.java,v retrieving revision 1.25 diff -u -r1.25 IClassFile.java --- model/org/eclipse/jdt/core/IClassFile.java 6 Mar 2007 02:38:49 -0000 1.25 +++ model/org/eclipse/jdt/core/IClassFile.java 9 Mar 2007 21:25:31 -0000 @@ -33,7 +33,7 @@ */ public interface IClassFile extends ITypeRoot { - + /** * Changes this class file handle into a working copy. A new {@link IBuffer} is * created using the given owner. Uses the primary owner ifnull
is
@@ -76,6 +76,9 @@
* @throws JavaModelException if this compilation unit could not become a working copy.
* @see ICompilationUnit#discardWorkingCopy()
* @since 3.2
+ * @deprecated Use {@link ITypeRoot#getWorkingCopy(WorkingCopyOwner, IProgressMonitor)} instead.
+ * Note that if this deprecated method is used, problems may be reported twice
+ * if the given working copy owner has a different requestor than the one given as parameter.
*/
ICompilationUnit becomeWorkingCopy(IProblemRequestor problemRequestor, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException;
/**
#P org.eclipse.jdt.core.tests
Index: Eclipse Java Tests Runner/org/eclipse/jdt/core/tests/RunAllJDTCoreTests.java
===================================================================
RCS file: /home/cvs/numbat/org.eclipse.jdt.core.tests/Eclipse Java Tests Runner/org/eclipse/jdt/core/tests/RunAllJDTCoreTests.java,v
retrieving revision 1.4
diff -u -r1.4 RunAllJDTCoreTests.java
--- Eclipse Java Tests Runner/org/eclipse/jdt/core/tests/RunAllJDTCoreTests.java 6 Mar 2007 04:29:57 -0000 1.4
+++ Eclipse Java Tests Runner/org/eclipse/jdt/core/tests/RunAllJDTCoreTests.java 9 Mar 2007 21:13:34 -0000
@@ -18,16 +18,43 @@
* Runs all (public and private) JDT Core tests.
*/
public class RunAllJDTCoreTests extends TestCase {
+ private final static String SUITES = System.getProperty("suites");
+
public RunAllJDTCoreTests(String name) {
super(name);
}
public static Test suite() {
TestSuite suite = new TestSuite(RunAllJDTCoreTests.class.getName());
- suite.addTest(RunAllBuilderTests.suite());
- suite.addTest(RunAllCompilerTests.suite());
- suite.addTest(RunAllDOMTests.suite());
- suite.addTest(RunAllFormatterTests.suite());
- suite.addTest(RunAllModelTests.suite());
+
+ // Get test suites subset
+ if (SUITES == null) {
+ suite.addTest(RunAllBuilderTests.suite());
+ suite.addTest(RunAllCompilerTests.suite());
+ suite.addTest(RunAllDOMTests.suite());
+ suite.addTest(RunAllFormatterTests.suite());
+ suite.addTest(RunAllModelTests.suite());
+ } else {
+ int length = SUITES.length();
+ for (int i = 0; i < length; i++) {
+ switch (Character.toUpperCase(SUITES.charAt(i))) {
+ case 'B':
+ suite.addTest(RunAllBuilderTests.suite());
+ break;
+ case 'C':
+ suite.addTest(RunAllCompilerTests.suite());
+ break;
+ case 'D':
+ suite.addTest(RunAllDOMTests.suite());
+ break;
+ case 'F':
+ suite.addTest(RunAllFormatterTests.suite());
+ break;
+ case 'M':
+ suite.addTest(RunAllModelTests.suite());
+ break;
+ }
+ }
+ }
return suite;
}
}
#P org.eclipse.jdt.core.tests.performance
Index: src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java,v
retrieving revision 1.19
diff -u -r1.19 FullSourceWorkspaceModelTests.java
--- src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java 1 Mar 2007 11:08:15 -0000 1.19
+++ src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java 9 Mar 2007 21:26:21 -0000
@@ -667,7 +667,7 @@
try {
// Setup
workingCopy = (ICompilationUnit) JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/BigProject/src/org/eclipse/jdt/core/tests/BigCu.java")));
- workingCopy.becomeWorkingCopy(null, null);
+ workingCopy.becomeWorkingCopy(null);
// Warm up
if (WARMUP_COUNT > 0) {