diff options
author | kmoore | 2007-06-11 19:52:37 +0000 |
---|---|---|
committer | kmoore | 2007-06-11 19:52:37 +0000 |
commit | 269ee50eb1aacd06ff8e1f1d70b70339b670662e (patch) | |
tree | 125ad8937eb3d26dfd15673fef66d43dd08fbbab | |
parent | a420d9933a65d9dd639186baf4a6604b38cc09cc (diff) | |
download | webtools.dali-269ee50eb1aacd06ff8e1f1d70b70339b670662e.tar.gz webtools.dali-269ee50eb1aacd06ff8e1f1d70b70339b670662e.tar.xz webtools.dali-269ee50eb1aacd06ff8e1f1d70b70339b670662e.zip |
189778 - applied patch - NPE when calling setSpecifiedMappingKey() on closed Entity class
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaCompilationUnit.java | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaCompilationUnit.java index f0d19be45d..e42ed42ed6 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaCompilationUnit.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaCompilationUnit.java @@ -357,30 +357,36 @@ public class JpaCompilationUnit extends JavaEObject } private void synchWithJavaDelta(IJavaElementDelta delta) { - boolean processChildren = false; switch (delta.getElement().getElementType()) { case IJavaElement.JAVA_MODEL : case IJavaElement.JAVA_PROJECT : case IJavaElement.PACKAGE_FRAGMENT_ROOT : case IJavaElement.PACKAGE_FRAGMENT : - processChildren = true; + this.synchChildrenWithJavaDelta(delta); break; case IJavaElement.COMPILATION_UNIT : + this.synchCompilationUnitWithJavaDelta(delta); break; default : - // the event is somehow lower than a compilation unit - return; + break; // the event is somehow lower than a compilation unit } - if (processChildren) { - for (IJavaElementDelta child : delta.getAffectedChildren()) { - synchWithJavaDelta(child); - } + } + + private void synchChildrenWithJavaDelta(IJavaElementDelta delta) { + for (IJavaElementDelta child : delta.getAffectedChildren()) { + this.synchWithJavaDelta(child); // recurse } - // discard if change is not for this compilation unit - if (!delta.getElement().equals(this.compilationUnit)) { + } + + private void synchCompilationUnitWithJavaDelta(IJavaElementDelta delta) { + // ignore changes to/from primary working copy - no content has changed + if ((delta.getFlags() & IJavaElementDelta.F_PRIMARY_WORKING_COPY) != 0) { return; } - this.synchronizePersistentTypes(); + // synchronize if the change is for this compilation unit + if (delta.getElement().equals(this.compilationUnit)) { + this.synchronizePersistentTypes(); + } } private void synchronizePersistentTypes() { |