This commit was manufactured by cvs2svn to create tag 'v_364'.
Sprout from master 2003-07-15 09:08:47 UTC Jerome lanneluc <jlanneluc> '*** empty log message ***'
Cherrypick from master 2003-07-16 13:35:49 UTC Philipe Mulet <pmulet> '*** empty log message ***':
org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
org.eclipse.jdt.core/buildnotes_jdt-core.html
Cherrypick from master 2003-07-16 16:12:58 UTC Jerome lanneluc <jlanneluc> '*** empty log message ***':
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyOwnerTests.java
org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyOwnerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyOwnerTests.java
index 74875ae..33a3965 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyOwnerTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/WorkingCopyOwnerTests.java
@@ -334,7 +334,7 @@
/*
* Tests that the same number of calls to discardWorkingCopy() is needed for non-primary working copy
- * to be dicsarded.
+ * to be discarded.
*/
public void testDiscardWorkingCopy3() throws CoreException {
ICompilationUnit workingCopy = null;
@@ -345,13 +345,17 @@
workingCopy = cu.getWorkingCopy(owner, null, null);
workingCopy = cu.getWorkingCopy(owner, null, null);
assertTrue("should be in working copy mode", workingCopy.isWorkingCopy());
+ assertTrue("should be opened", workingCopy.isOpen());
workingCopy.discardWorkingCopy();
- assertTrue("should still be in working copy mode", workingCopy.isWorkingCopy());
+ assertTrue("should still be in working copy mode (1)", workingCopy.isWorkingCopy());
+ assertTrue("should still be opened", workingCopy.isOpen());
workingCopy.discardWorkingCopy();
workingCopy.discardWorkingCopy();
- assertTrue("should no longer be in working copy mode", !workingCopy.isWorkingCopy());
+ assertTrue("should still be in working copy mode (2)", workingCopy.isWorkingCopy());
+ assertTrue("should no longer be opened", !workingCopy.isOpen());
+
} finally {
if (workingCopy != null) {
int max = 3;
@@ -381,7 +385,6 @@
assertTrue("should not get a JavaModelException before discarding working copy", !gotException);
workingCopy.discardWorkingCopy();
- assertTrue("should no longer be in working copy mode", !workingCopy.isWorkingCopy());
gotException = false;
try {
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index b29e140..90e3ec3 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -12,7 +12,7 @@
### compiler
compiler.name = Eclipse Java Compiler
-compiler.version = 0.363
+compiler.version = 0.364
compiler.copyright = Copyright IBM Corp 2000, 2003. All rights reserved.
### scanning
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 19cbe50..e7a0e0b 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -36,14 +36,29 @@
<p><hr><h1>
Eclipse Platform Build Notes <br>
Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 15th July 2003
-<br>Project org.eclipse.jdt.core v_363 - 3.0 MILESTONE-2
+Eclipse SDK 3.0M2 Build - 16th July 2003 - 3.0 MILESTONE-2
+<br>Project org.eclipse.jdt.core v_364
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_364">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40210">40210</a>
+ICompilationUnit#isWorkingCopy() misbehaving for discarded working copies
+
+<p><hr><h1>
+Eclipse Platform Build Notes <br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 15th July 2003
+<br>Project org.eclipse.jdt.core v_363
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_363">cvs</a>).
<h2>
What's new in this drop</h2>
<ul>
-<li>Added flag <code>IJavaElementDelta.F_PRIMARY_WORKING_COPY</code> that signals that a primary compilation unit has become a
- working copy, or that a primary working copy has become a compilation unit.
+<li>Added flag <code>IJavaElementDelta.F_PRIMARY_WORKING_COPY</code> that signals that a compilation unit has become a
+ primary working copy, or that a primary working copy has reverted to a compilation unit (i.e. primary working copies are not notified
+ as being added/removed like other working copies, since the primary unit is only changing mode, also see bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40028">40028</a>).
</li>
</ul>
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
index 26bae66..de5b8e5 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
@@ -92,7 +92,7 @@
}
// prevents reopening of non-primary working copies (they are closed when they are discarded and should not be reopened)
- if (this.owner != DefaultWorkingCopyOwner.PRIMARY && !isWorkingCopy()) {
+ if (this.owner != DefaultWorkingCopyOwner.PRIMARY && getPerWorkingCopyInfo() == null) {
throw newNotPresentException();
}
@@ -146,27 +146,27 @@
* @see Openable#canBeRemovedFromCache
*/
public boolean canBeRemovedFromCache() {
- if (isWorkingCopy()) return false; // working copies should remain in the cache until they are destroyed
+ if (getPerWorkingCopyInfo() != null) return false; // working copies should remain in the cache until they are destroyed
return super.canBeRemovedFromCache();
}
/*
* @see Openable#canBufferBeRemovedFromCache
*/
public boolean canBufferBeRemovedFromCache(IBuffer buffer) {
- if (isWorkingCopy()) return false; // working copy buffers should remain in the cache until working copy is destroyed
+ if (getPerWorkingCopyInfo() != null) return false; // working copy buffers should remain in the cache until working copy is destroyed
return super.canBufferBeRemovedFromCache(buffer);
}/*
* @see IOpenable#close
*/
public void close() throws JavaModelException {
- if (isWorkingCopy()) return; // a working copy must remain opened until it is discarded
+ if (getPerWorkingCopyInfo() != null) return; // a working copy must remain opened until it is discarded
super.close();
}
/*
* @see Openable#closing
*/
protected void closing(Object info) throws JavaModelException {
- if (!isWorkingCopy()) {
+ if (getPerWorkingCopyInfo() == null) {
super.closing(info);
} // else the buffer of a working copy must remain open for the lifetime of the working copy
}
@@ -406,7 +406,7 @@
}
public boolean exists() {
// working copy always exists in the model until it is gotten rid of
- if (isWorkingCopy()) return true;
+ if (getPerWorkingCopyInfo() != null) return true;
return super.exists();
}
@@ -880,10 +880,9 @@
* @see ICompilationUnit#isWorkingCopy()
*/
public boolean isWorkingCopy() {
- // NB: we could optimize by checking if (this.owner != DefaultWorkingCopyOwner.PRIMARY),
- // but this would return true for discarded working copies
-
- return getPerWorkingCopyInfo() != null;
+ // For backward compatibility, non primary working copies are always returning true; in removal
+ // delta, clients can still check that element was a working copy before being discarded.
+ return this.owner != DefaultWorkingCopyOwner.PRIMARY || getPerWorkingCopyInfo() != null;
}
/**
* @see IOpenable#makeConsistent(IProgressMonitor)