]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Synchronization can now read children for multi-instantiated composites
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 17 Jun 2020 09:22:52 +0000 (12:22 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 17 Jun 2020 09:46:03 +0000 (12:46 +0300)
org.simantics.structural2.Functions.structuralChildDomainChildren
getVariables implementation still relied on getPossibleType(ReadGraph),
which returns null for multi-instances. The previous similar flaw was
fixed in #259.

gitlab #562

Change-Id: I55421a32310c7a55c089637faeb3186dd43a0e4b
(cherry picked from commit e89ad0dd828fd8c628288d416590b1f8ec0194ef)

bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java

index e43007637ac5ca616a89f33b3cc3f62247ad8fea..e9bb272d3d4442d07184c2bed0437a63f67a5562 100644 (file)
@@ -635,8 +635,8 @@ public class Functions {
 
                @Override
                public Map<String, Variable> getVariables(ReadGraph graph, Variable context, Map<String, Variable> map) throws DatabaseException {
-                       
-                       Resource type = context.getPossibleType(graph);
+                       StructuralResource2 STR = StructuralResource2.getInstance(graph);
+                       Resource type = context.getPossibleType(graph, STR.Component);
                        if(type == null) return null;
                        
                        StructuralComponentClass clazz = StructuralComponentClass.get(graph, type);
@@ -653,7 +653,6 @@ public class Functions {
                }
                return map;
                        } else if (StructuralComponentClass.DEFINED.equals(clazz)) {
-                               StructuralResource2 STR = StructuralResource2.getInstance(graph);
                                Resource def = graph.getSingleObject(type, STR.IsDefinedBy);
                 Map<String, Resource> children = graph.syncRequest(new UnescapedChildMapOfResource(def), TransientCacheListener.instance());
                 return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, children, map);