Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEsteban Dugueperoux2015-11-04 12:35:15 +0000
committerMaxime Porhel2015-11-13 09:44:04 +0000
commit635c6a6928356ce53bc5bae469f7291289362793 (patch)
treec044a52469891bef22438af06522881eeff7f396
parentb6cfe3181f46d6e0b01b91a1c307adc1526cb4ef (diff)
downloadorg.eclipse.sirius-635c6a6928356ce53bc5bae469f7291289362793.tar.gz
org.eclipse.sirius-635c6a6928356ce53bc5bae469f7291289362793.tar.xz
org.eclipse.sirius-635c6a6928356ce53bc5bae469f7291289362793.zip
[481732] Have DialectEditorCloserFilter manage DRepContainer removal
Bug: 481732 Change-Id: I2f016409e69aec81bd2732dc010000a28ff49749 Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr> (cherry picked from commit 175fe12b8b894e10f7834a22b55cd76d7e797ce7)
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/editor/DialectEditorCloserFilter.java31
1 files changed, 20 insertions, 11 deletions
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/editor/DialectEditorCloserFilter.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/editor/DialectEditorCloserFilter.java
index 960cc297f0..c645953c38 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/editor/DialectEditorCloserFilter.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/editor/DialectEditorCloserFilter.java
@@ -54,22 +54,31 @@ public class DialectEditorCloserFilter extends NotificationFilter.Custom {
private boolean isRepresentationDeletion(Notification notification) {
boolean representationDeleted = false;
- if (notification.getFeature() == ViewpointPackage.Literals.DVIEW__OWNED_REPRESENTATIONS) {
- int eventType = notification.getEventType();
- if (eventType == Notification.REMOVE || eventType == Notification.UNSET || eventType == Notification.REMOVE_MANY) {
- // If the representation eContainer is still a DView, this
- // remove notification does not indicate a delete but a move.
- // No need to close the editor.
- representationDeleted = isInOldValue(notification, dRepresentation) && !(dRepresentation.eContainer() instanceof DView);
- }
+ if (notification.getFeature() == ViewpointPackage.Literals.DVIEW__OWNED_REPRESENTATIONS && wasInOldValue(notification, dRepresentation)) {
+ // If the representation eContainer is still a DView, this
+ // remove notification does not indicate a delete but a move.
+ // No need to close the editor.
+ representationDeleted = !(dRepresentation.eContainer() instanceof DView);
+ } else if (notification.getFeature() == ViewpointPackage.Literals.DANALYSIS__OWNED_VIEWS && wasInOldValue(notification, dRepresentation.eContainer())) {
+ // If it is a undo or a rollback but not a
+ // DRepresentationContainer moved from a DAnalysis to another
+ representationDeleted = dRepresentation.eContainer() == null || !(dRepresentation.eContainer() != null && dRepresentation.eContainer().eContainer() instanceof DView);
}
-
return representationDeleted;
}
- private boolean isInOldValue(Notification notification, Object obj) {
+ private boolean wasInOldValue(Notification notification, EObject eObject) {
+ boolean isCurrentDRepresentationRemove = false;
+ int eventType = notification.getEventType();
+ if (eventType == Notification.REMOVE || eventType == Notification.UNSET || eventType == Notification.REMOVE_MANY) {
+ isCurrentDRepresentationRemove = isInOldValue(notification, eObject);
+ }
+ return isCurrentDRepresentationRemove;
+ }
+
+ private boolean isInOldValue(Notification notification, EObject obj) {
if (notification.getOldValue() instanceof Collection) {
- return ((Collection<?>) notification.getOldValue()).contains(dRepresentation);
+ return ((Collection<?>) notification.getOldValue()).contains(obj);
} else {
return notification.getOldValue() == obj;
}

Back to the top