]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
AbstractCompileStructuralValueRequest uses wrong RuntimeEnvironment 12/712/1
authorjsimomaa <jani.simomaa@gmail.com>
Wed, 12 Jul 2017 11:18:41 +0000 (14:18 +0300)
committerjsimomaa <jani.simomaa@gmail.com>
Wed, 12 Jul 2017 11:18:41 +0000 (14:18 +0300)
refs #7363

Change-Id: I4b60a5cc4aefc65c86b88ff93fe8951f40bd1238

bundles/org.simantics.structural2/src/org/simantics/structural2/scl/AbstractCompileStructuralValueRequest.java

index e4f08db102d0645dbfc2ea1acf64fd62e84797d8..283e1b5ddcadd6f836fef90a811ce8392bac97a7 100644 (file)
@@ -7,6 +7,7 @@ import org.simantics.databoard.Bindings;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;
 import org.simantics.db.common.procedure.adapter.TransientCacheListener;
+import org.simantics.db.common.request.PossibleIndexRoot;
 import org.simantics.db.common.request.ResourceRead2;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.scl.AbstractExpressionCompilationContext;
@@ -62,8 +63,10 @@ abstract public class AbstractCompileStructuralValueRequest extends AbstractExpr
         Layer0 L0 = Layer0.getInstance(graph);
         String valueType = graph.getPossibleRelatedValue(relation, L0.RequiresValueType, Bindings.STRING);
         if(valueType != null) {
+            Resource relationIndexRoot = graph.syncRequest(new PossibleIndexRoot(relation));
+            RuntimeEnvironment relationRuntimeEnvironment = relationIndexRoot != null ? graph.syncRequest(new RuntimeEnvironmentRequest(relationIndexRoot)) : context.runtimeEnvironment;
             try {
-                return Environments.getType(context.runtimeEnvironment.getEnvironment(), valueType);
+                return Environments.getType(relationRuntimeEnvironment.getEnvironment(), valueType);
             } catch (SCLExpressionCompilationException e) {
                 e.printStackTrace();
             }