[209358] gmf_R2_0_maintenance crevells 071112 DiagramImpl.persistEdges does not guarantee parent hierarchy of source/target is persisted
diff --git a/org.eclipse.gmf.runtime.notation/src/org/eclipse/gmf/runtime/notation/impl/DiagramImpl.java b/org.eclipse.gmf.runtime.notation/src/org/eclipse/gmf/runtime/notation/impl/DiagramImpl.java
index 4352faa..0059512 100644
--- a/org.eclipse.gmf.runtime.notation/src/org/eclipse/gmf/runtime/notation/impl/DiagramImpl.java
+++ b/org.eclipse.gmf.runtime.notation/src/org/eclipse/gmf/runtime/notation/impl/DiagramImpl.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -527,14 +527,36 @@
View sourceView = edge.getSource();
View targetView = edge.getTarget();
if (sourceView != null)
- sourceView.persist();
+ persistCompleteHierarchy(sourceView);
if (targetView != null)
- targetView.persist();
+ persistCompleteHierarchy(targetView);
}
}
}
/**
+ * Persist the view passed in and all its parent views if they are
+ * transient.
+ *
+ * @param view
+ * the view to persist
+ */
+ private void persistCompleteHierarchy(View view) {
+ view.persist();
+ EObject container = view.eContainer();
+ while (container instanceof View) {
+ // if already persisted, quit
+ EStructuralFeature sFeature = container.eContainingFeature();
+ if (sFeature != null && !sFeature.isTransient()) {
+ break;
+ }
+
+ ((View) container).persist();
+ container = container.eContainer();
+ }
+ }
+
+ /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*/
public void removeEdge(Edge edge) {