X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.interop.update%2Fsrc%2Forg%2Fsimantics%2Finterop%2Fupdate%2Fmodel%2FUpdateNode.java;h=54d6b2ce670bc3f28d4e3fa75e73dc1adaf34522;hb=961c51d828eace5c9ab9db9499f0af9a78f16192;hp=3a7953174bd3ffb6b080af45cbe8f039ed5ced72;hpb=ed79a91bdd86658d28be3d50322a0d4d8cff98dc;p=simantics%2Finterop.git diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateNode.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateNode.java index 3a79531..54d6b2c 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateNode.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateNode.java @@ -12,6 +12,7 @@ import org.simantics.layer0.Layer0; public class UpdateNode { + private UpdateNode parent; private UpdateStatus status; private UpdateOp op; private Resource r; @@ -51,6 +52,11 @@ public class UpdateNode { } public Resource getParentResource(ReadGraph g) throws DatabaseException { + if (op != null) { + Resource parent = op.getParentResource(g); + if (parent != null) + return parent; + } Layer0 l0 = Layer0.getInstance(g); return g.getPossibleObject(r, l0.PartOf); } @@ -69,6 +75,7 @@ public class UpdateNode { public void addChild(UpdateNode node) { children.add(node); + node.parent = this; if (op != null && node.op != null) { if (!op.getSubOps().contains(node.op)) { op.addSubOp(node.op); @@ -111,6 +118,21 @@ public class UpdateNode { this.visible = visible; if (op != null) op.visible = visible; + if (visible) { + if (parent != null && !parent.visible) + parent.setVisible(true); + } else { + for (UpdateNode n : children) + n.setVisible(false); + } } + + public void setAllVisible(boolean visible) { + this.visible = visible; + if (op != null) + op.visible = visible; + for (UpdateNode n : children) + n.setAllVisible(visible); + } }