From: Reino Ruusu Date: Fri, 25 Oct 2019 09:00:36 +0000 (+0300) Subject: Avoid duplicate evaluation of procedural component type requests X-Git-Tag: v1.43.0~136^2~41^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=45ddae414b7f632d52546c3c46b0f6d2b4ab37af;p=simantics%2Fplatform.git Avoid duplicate evaluation of procedural component type requests gitlab #408 Change-Id: I331016fcae55434cc612c6301b74189a47142e90 --- 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..8bf4e3df6 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java @@ -50,6 +50,7 @@ import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.VariableMap; import org.simantics.db.layer0.variable.VariableMapImpl; import org.simantics.db.layer0.variable.VariableNode; +import org.simantics.db.layer0.variable.Variables; import org.simantics.db.service.CollectionSupport; import org.simantics.issues.common.IssueUtils; import org.simantics.layer0.Layer0; @@ -332,10 +333,11 @@ public class Functions { public static List getProceduralDesc(ReadGraph graph, final Variable context) throws DatabaseException { StructuralResource2 STR = StructuralResource2.getInstance(graph); - final Resource type = context.getPossibleType(graph); + Variable config = Variables.getConfigurationVariable(graph, context); + final Resource type = config.getPossibleType(graph); if(type != null) { if(graph.isInstanceOf(type, STR.ProceduralComponentType)) { - return graph.syncRequest(new SubstructureRequest(context)); + return graph.syncRequest(new SubstructureRequest(config)); } } return null;