Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Constant2019-07-09 09:02:09 -0400
committerOlivier Constant2019-07-16 09:38:17 -0400
commitf8dd6cbd83a9f55c75963c02c3c04a0e595ea121 (patch)
treee42f9c9baf01a1c2e08046af1e6c423a75e6ef71
parentcd82bef6401c91860c48219f0a243599dc55887b (diff)
downloadorg.eclipse.emf.diffmerge.core-f8dd6cbd83a9f55c75963c02c3c04a0e595ea121.tar.gz
org.eclipse.emf.diffmerge.core-f8dd6cbd83a9f55c75963c02c3c04a0e595ea121.tar.xz
org.eclipse.emf.diffmerge.core-f8dd6cbd83a9f55c75963c02c3c04a0e595ea121.zip
Bug 548907 - SiriusScope#getContainer(EObject) not able to find descriptor for representation when session closed
Change-Id: Idb65914dbff5b04619f89d4915d1be70e0b80edd Signed-off-by: Olivier Constant <olivier.constant@thalesgroup.com>
-rw-r--r--plugins/org.eclipse.emf.diffmerge.sirius/src/org/eclipse/emf/diffmerge/sirius/SiriusScope.java32
1 files changed, 21 insertions, 11 deletions
diff --git a/plugins/org.eclipse.emf.diffmerge.sirius/src/org/eclipse/emf/diffmerge/sirius/SiriusScope.java b/plugins/org.eclipse.emf.diffmerge.sirius/src/org/eclipse/emf/diffmerge/sirius/SiriusScope.java
index b3e571c7..a19e12ff 100644
--- a/plugins/org.eclipse.emf.diffmerge.sirius/src/org/eclipse/emf/diffmerge/sirius/SiriusScope.java
+++ b/plugins/org.eclipse.emf.diffmerge.sirius/src/org/eclipse/emf/diffmerge/sirius/SiriusScope.java
@@ -127,9 +127,7 @@ public class SiriusScope extends GMFScope {
}
boolean result = super.add(source_p, reference_p, value_p);
if (result && isDescriptorToRepresentation) {
- DRepresentationDescriptor descriptor = (DRepresentationDescriptor)source_p;
- String uid = getReferencedUID(descriptor);
- _idToDescriptor.put(uid, descriptor);
+ registerRepresentationDescriptor((DRepresentationDescriptor)source_p);
}
return result;
}
@@ -140,7 +138,11 @@ public class SiriusScope extends GMFScope {
@Override
public EObject getContainer(EObject element_p) {
EObject result;
- if (element_p instanceof DRepresentation && super.getContainer(element_p) == null) {
+ if (element_p instanceof DRepresentationDescriptor) {
+ registerRepresentationDescriptor((DRepresentationDescriptor)element_p);
+ }
+ EObject basicContainer = super.getContainer(element_p);
+ if (element_p instanceof DRepresentation && basicContainer == null) {
DRepresentation representation = (DRepresentation)element_p;
String repID = representation.getUid();
result = _idToDescriptor.get(repID);
@@ -148,11 +150,11 @@ public class SiriusScope extends GMFScope {
DRepresentationQuery rep2descQuery = new DRepresentationQuery((DRepresentation)element_p);
result = rep2descQuery.getRepresentationDescriptor();
if (result != null) {
- _idToDescriptor.put(repID, (DRepresentationDescriptor)result);
+ registerRepresentationDescriptor((DRepresentationDescriptor)result);
}
}
} else {
- result = super.getContainer(element_p);
+ result = basicContainer;
}
return result;
}
@@ -197,6 +199,7 @@ public class SiriusScope extends GMFScope {
List<EObject> result = super.getContents(element_p);
if (element_p instanceof DRepresentationDescriptor) {
DRepresentationDescriptor descriptor = (DRepresentationDescriptor)element_p;
+ registerRepresentationDescriptor(descriptor);
DRepresentation referenced = descriptor.getRepresentation();
if (referenced != null) {
List<EObject> originalResult = result;
@@ -345,11 +348,18 @@ public class SiriusScope extends GMFScope {
@Override
protected void notifyExplored(EObject element_p) {
if (element_p instanceof DRepresentationDescriptor) {
- DRepresentationDescriptor descriptor = (DRepresentationDescriptor)element_p;
- String uid = getReferencedUID(descriptor);
- if (uid != null) {
- _idToDescriptor.put(uid, descriptor);
- }
+ registerRepresentationDescriptor((DRepresentationDescriptor)element_p);
+ }
+ }
+
+ /**
+ * Register the given representation descriptor for (representation -> descriptor) navigation
+ * @param descriptor_p a non-null representation descriptor
+ */
+ protected void registerRepresentationDescriptor(DRepresentationDescriptor descriptor_p) {
+ String uid = getReferencedUID(descriptor_p);
+ if (uid != null) {
+ _idToDescriptor.put(uid, descriptor_p);
}
}

Back to the top