From: Tuukka Lehtonen Date: Sun, 26 Apr 2020 20:21:09 +0000 (+0300) Subject: Use RuntimeEnvironmentRequest2 where applicable X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=844ae73ef4a9109b12d4d810b9d3bc5e147e298f;p=simantics%2Fplatform.git Use RuntimeEnvironmentRequest2 where applicable This allows e.g. procedural user component substructure expressions to use SCL functionality included by the user component's local SCL modules instead of only having to rely on functionality included by the SCLMain at the containing index root. gitlab #527 Change-Id: I7bcb22910737851771f2be54aafecd7480d1c81b --- diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileProceduralSCLMonitorRequest.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileProceduralSCLMonitorRequest.java index 4c7964513..79eb3d6ba 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileProceduralSCLMonitorRequest.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileProceduralSCLMonitorRequest.java @@ -11,7 +11,7 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.VariableRead; import org.simantics.db.layer0.scl.AbstractExpressionCompilationContext; import org.simantics.db.layer0.scl.AbstractExpressionCompilationRequest; -import org.simantics.db.layer0.util.RuntimeEnvironmentRequest; +import org.simantics.db.layer0.util.RuntimeEnvironmentRequest2; import org.simantics.db.layer0.variable.Variable; import org.simantics.layer0.Layer0; import org.simantics.modeling.ProceduralSubstructureMapRequest; @@ -88,7 +88,7 @@ public class CompileProceduralSCLMonitorRequest extends AbstractExpressionCompil public CompilationContext perform(ReadGraph graph) throws DatabaseException { Resource indexRoot = graph.syncRequest(new IndexRoot(componentType)); - RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest(indexRoot)); + RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest2(componentType, indexRoot)); THashMap> propertyMap = graph.sync(new ProceduralSubstructureMapRequest(componentVariable)); return new CompilationContext(runtimeEnvironment, propertyMap); diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLMonitorRequest.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLMonitorRequest.java index dfea83931..b9ec1affc 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLMonitorRequest.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLMonitorRequest.java @@ -9,7 +9,7 @@ import org.simantics.db.common.request.ResourceRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.scl.AbstractExpressionCompilationContext; import org.simantics.db.layer0.scl.AbstractExpressionCompilationRequest; -import org.simantics.db.layer0.util.RuntimeEnvironmentRequest; +import org.simantics.db.layer0.util.RuntimeEnvironmentRequest2; import org.simantics.db.layer0.variable.Variable; import org.simantics.layer0.Layer0; import org.simantics.modeling.ComponentTypeSubstructure; @@ -114,7 +114,7 @@ public class CompileSCLMonitorRequest extends AbstractExpressionCompilationReque public CompilationContext perform(ReadGraph graph) throws DatabaseException { Resource indexRoot = graph.syncRequest(new IndexRoot(resource)); - RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest(indexRoot)); + RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest2(resource, indexRoot)); return new CompilationContext(runtimeEnvironment, ComponentTypeSubstructure.forType(graph, resource)); } }); diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLQueryRequest.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLQueryRequest.java index 1cef75ddf..dab7aa0e7 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLQueryRequest.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/CompileSCLQueryRequest.java @@ -7,8 +7,8 @@ import org.simantics.db.Resource; import org.simantics.db.common.procedure.adapter.TransientCacheListener; import org.simantics.db.common.request.IndexRoot; import org.simantics.db.common.request.ResourceRead2; +import org.simantics.db.common.request.RuntimeEnvironmentRequest; import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.util.RuntimeEnvironmentRequest; import org.simantics.db.layer0.variable.Variable; import org.simantics.layer0.Layer0; import org.simantics.scl.compiler.common.names.Name; diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/AbstractCompileStructuralValueRequest.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/AbstractCompileStructuralValueRequest.java index fce1abaa2..5e8538a69 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/AbstractCompileStructuralValueRequest.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/AbstractCompileStructuralValueRequest.java @@ -9,10 +9,10 @@ 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.common.request.RuntimeEnvironmentRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.scl.AbstractExpressionCompilationContext; import org.simantics.db.layer0.scl.AbstractExpressionCompilationRequest; -import org.simantics.db.layer0.util.RuntimeEnvironmentRequest; import org.simantics.db.layer0.util.RuntimeEnvironmentRequest2; import org.simantics.layer0.Layer0; import org.simantics.scl.compiler.elaboration.expressions.EApply; diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/procedural/ProceduralComponentTypeCompilationContextRequest.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/procedural/ProceduralComponentTypeCompilationContextRequest.java index 50a905e82..1e3647905 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/procedural/ProceduralComponentTypeCompilationContextRequest.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/procedural/ProceduralComponentTypeCompilationContextRequest.java @@ -8,7 +8,7 @@ import org.simantics.db.common.procedure.adapter.TransientCacheListener; import org.simantics.db.common.request.IndexRoot; import org.simantics.db.common.request.UnaryRead; import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.util.RuntimeEnvironmentRequest; +import org.simantics.db.layer0.util.RuntimeEnvironmentRequest2; import org.simantics.scl.compiler.environment.specification.EnvironmentSpecification; import org.simantics.scl.compiler.runtime.RuntimeEnvironment; import org.simantics.structural2.scl.ComponentTypeProperty; @@ -25,7 +25,7 @@ public class ProceduralComponentTypeCompilationContextRequest extends UnaryRead< public ProceduralComponentTypeCompilationContext perform(ReadGraph graph) throws DatabaseException { Resource indexRoot = graph.syncRequest(new IndexRoot(parameter)); - RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest(indexRoot) { + RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest2(parameter, indexRoot) { @Override protected void fillEnvironmentSpecification( EnvironmentSpecification environmentSpecification) {