Commit adbb22e3 authored by Romain Bioteau's avatar Romain Bioteau

Merge remote-tracking branch 'origin/release-7.8.0'

parents 762f8bfe 89d7d934
......@@ -106,6 +106,14 @@ public class EMFModelUpdater<T extends EObject> {
.getEAllStructuralFeatures()
.stream()
.filter(EReference.class::isInstance)
.filter(feature -> {
if (!target.eClass().getEAllStructuralFeatures().contains(feature)) {
BonitaStudioLog.warning(String.format("Cannot update EObject value: %s does not have a %s feature.",
target.eClass().getName(), feature.getName()), Activator.PLUGIN_ID);
return false;
}
return true;
})
.forEach(feature -> {
if (feature.isMany()) {
handleManyCase(source, target, feature);
......@@ -127,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));
// }
// }
}
......
......@@ -12,7 +12,7 @@
<tychoExtrasVersion>1.1.0</tychoExtrasVersion>
<os-jvm-flags></os-jvm-flags>
<bundle.version>${project.version}</bundle.version>
<ui.designer.version>1.8.27</ui.designer.version>
<ui.designer.version>1.8.28</ui.designer.version>
<engine.version>${project.version}</engine.version>
<filters.version>${project.version}</filters.version>
<platform.version>${project.parent.version}</platform.version>
......
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