X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=inline;f=org.simantics.interop.update%2Fsrc%2Forg%2Fsimantics%2Finterop%2Fupdate%2Fmodel%2FUpdateTree.java;h=a971da4f41234690724961a9fc1137e13192ffe3;hb=refs%2Fchanges%2F37%2F4637%2F1;hp=a2066f4108c33e35a92d10b28ab9314c2153c34f;hpb=82a773fbfa81a3e40b10272526eee52324f2e8d2;p=simantics%2Finterop.git diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateTree.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateTree.java index a2066f4..a971da4 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateTree.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateTree.java @@ -51,7 +51,13 @@ public class UpdateTree { private UpdateNode createNode(ReadGraph g, Resource r1, Resource r2) throws DatabaseException { UpdateNode node = null; if (r1 != null && r2 != null) { - node = createNode(g, UpdateStatus.EXIST, r1); + UpdateOp op = updateOps.getUpdateOp(r1); + if (op == null) + op = updateOps.getUpdateOp(r2); + if (op == null) + node = createNode(g, UpdateStatus.EXIST, r1); + else + node = createNode(g, UpdateStatus.EXIST, op); nodes.put(r1, node); nodes.put(r2, node); } else if (r1 != null) { @@ -65,9 +71,6 @@ public class UpdateTree { } public UpdateNode addNode(ReadGraph g, Resource r1, Resource r2) throws DatabaseException { - if (r1 != null && r2 != null) { - return null; - } if (nodes.containsKey(r1)) return nodes.get(r1); if (nodes.containsKey(r2)) @@ -130,8 +133,13 @@ public class UpdateTree { if (!handleCustom(g, op)) { if (op.isAdd()) { addNode(g, null,op.getResource()); - } else { + } else if (op.isDelete()){ addNode(g, op.getResource(), null); + } else if (op.isChange()) { + Resource o = op.getResource(); + Resource l = getChanges().getComparable().containsLeft(o) ? o :getChanges().getComparable().getLeft(o); + Resource r = getChanges().getComparable().containsRight(o) ? o :getChanges().getComparable().getRight(o); + addNode(g, l, r); } } }