Read previous BTree modification count from the graph 30/1330/2
authorJussi Koskela <jussi.koskela@semantum.fi>
Wed, 20 Dec 2017 06:52:49 +0000 (08:52 +0200)
committerJussi Koskela <jussi.koskela@semantum.fi>
Thu, 21 Dec 2017 11:34:15 +0000 (13:34 +0200)
Modification count is used when generating unique names for the
resources. We should continue from the previous modification count
whenever creating new BTree object to work on.

refs #7690

Change-Id: I446af8ad22157a1c64c984071ae6c36cae374935

bundles/org.simantics.datatypes/src/org/simantics/datatypes/utils/BTreeUtils.java

index 7d4f782a94d4e184f4916bd11514aec451e5900a..60ceba1b561da23ba77e0882b6f9af443a4c211a 100644 (file)
@@ -380,7 +380,8 @@ final public class BTreeUtils implements BTreeContentManager {
                        this.ownerRelation = ownerRelation;
                        this.nodeType = nodeType != null ? nodeType : DATA.BTreeNode;
                        this.t = t;
-                       this.mod = 0;
+                       Long possibleMod = graph.getPossibleRelatedValue(tree, DATA.BTree_mod, Bindings.LONG);
+                       this.mod = possibleMod != null ? possibleMod : 0;
                        this.cached = cached;
                        if (cached) {
                                this.beans = new HashMap<Resource, BTreeContentBean>();