Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEsteban Dugueperoux2015-11-04 12:35:15 +0000
committerEsteban DUGUEPEROUX2015-11-12 09:34:44 +0000
commit175fe12b8b894e10f7834a22b55cd76d7e797ce7 (patch)
tree7d809c435b000a249acca103d5bb97edf75cf437
parentc5f1dc76d031bbc016d3b99cd941aa4ce487cea7 (diff)
downloadorg.eclipse.sirius-175fe12b8b894e10f7834a22b55cd76d7e797ce7.tar.gz
org.eclipse.sirius-175fe12b8b894e10f7834a22b55cd76d7e797ce7.tar.xz
org.eclipse.sirius-175fe12b8b894e10f7834a22b55cd76d7e797ce7.zip
[481403] Have DialectEditorCloserFilter manage DRepContainer removal
Bug: 481403 Change-Id: I2f016409e69aec81bd2732dc010000a28ff49749 Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr>
-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