From: Tuukka Lehtonen Date: Wed, 17 Jun 2020 09:22:52 +0000 (+0300) Subject: Synchronization can now read children for multi-instantiated composites X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=603ddcc348905e7c56f7c93519118fa0528d973c;p=simantics%2Fplatform.git Synchronization can now read children for multi-instantiated composites 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) --- diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java index e43007637..e9bb272d3 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java @@ -635,8 +635,8 @@ public class Functions { @Override public Map getVariables(ReadGraph graph, Variable context, Map 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 children = graph.syncRequest(new UnescapedChildMapOfResource(def), TransientCacheListener.instance()); return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, children, map);