Commit 89d7d934 authored by Romain Bioteau's avatar Romain Bioteau

emf updater is broken with manyFeature type

parent 77a5a3e8
......@@ -135,27 +135,29 @@ public class EMFModelUpdater<T extends EObject> {
@SuppressWarnings("unchecked")
private void handleManyCase(EObject source, EObject target, EStructuralFeature feature) {
List sourceList = (List) source.eGet(feature);
List targetList = (List) target.eGet(feature);
sourceList.removeIf(
sourceElement -> findEObject(targetList, getEObjectID((EObject) sourceElement)) == null);
for (Object sourceElement : sourceList) {
EObject targetElement = findEObject(targetList, getEObjectID((EObject) sourceElement));
if (sourceElement instanceof EObject
&& targetElement instanceof EObject) {
deepEObjectUpdate((EObject) sourceElement,
targetElement);
}
}
for (Object targetElement : targetList) {
if (targetElement instanceof EObject
&& getEObjectID((EObject) targetElement) == null) {//Add new Object
sourceList.add(targetList.indexOf(targetElement), EcoreUtil.copy((T) targetElement));
}
}
source.eSet(feature, target.eGet(feature));
/// ===> BROKEN
// List sourceList = (List) source.eGet(feature);
// List targetList = (List) target.eGet(feature);
//
// sourceList.removeIf(
// sourceElement -> findEObject(targetList, getEObjectID((EObject) sourceElement)) == null);
//
// for (Object sourceElement : sourceList) {
// EObject targetElement = findEObject(targetList, getEObjectID((EObject) sourceElement));
// if (sourceElement instanceof EObject
// && targetElement instanceof EObject) {
// deepEObjectUpdate((EObject) sourceElement,
// targetElement);
// }
// }
//
// for (Object targetElement : targetList) {
// if (targetElement instanceof EObject
// && getEObjectID((EObject) targetElement) == null) {//Add new Object
// sourceList.add(targetList.indexOf(targetElement), EcoreUtil.copy((T) targetElement));
// }
// }
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment