From: Jussi Koskela Date: Fri, 8 Feb 2019 13:13:31 +0000 (+0200) Subject: Fixed broken validation of document SCL Handler expressions X-Git-Tag: v1.43.0~136^2~199 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F46%2F2646%2F1;p=simantics%2Fplatform.git Fixed broken validation of document SCL Handler expressions The implementation was originally in Simupedia but was obviously lost while moving the validation implementation to Simantics Platform. gitlab #255 Change-Id: I81c92620631caa352daa5a7380733a4edb91e938 --- diff --git a/bundles/org.simantics.document.base.ontology/graph/Components.pgraph b/bundles/org.simantics.document.base.ontology/graph/Components.pgraph index 65a75d288..e89d74589 100644 --- a/bundles/org.simantics.document.base.ontology/graph/Components.pgraph +++ b/bundles/org.simantics.document.base.ontology/graph/Components.pgraph @@ -54,6 +54,7 @@ DOC.SCLValue compileSimupediaSCLHandlerValueExpression self""" "Variable -> String" @L0.assert L0.ConvertsToValueWith DOC.Functions.sclHandlerValue : L0.ExternalValue diff --git a/bundles/org.simantics.document.server/scl/Document/All.scl b/bundles/org.simantics.document.server/scl/Document/All.scl index 6eaf328a3..a90a24bcb 100644 --- a/bundles/org.simantics.document.server/scl/Document/All.scl +++ b/bundles/org.simantics.document.server/scl/Document/All.scl @@ -144,6 +144,7 @@ importJava "org.simantics.document.server.Functions" where stateVariable :: Variable -> Variable compileDocumentSCLValueExpression :: Variable -> String + compileDocumentSCLHandlerValueExpression :: Variable -> String primitiveProperties :: DocumentProperties diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java index 186edd252..d5a727ffa 100644 --- a/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java @@ -1381,6 +1381,15 @@ public class Functions { } } + public static String compileDocumentSCLHandlerValueExpression(ReadGraph graph, Variable context) { + try { + ServerSCLHandlerValueRequest.compile(graph, context); + return ""; + } catch (Exception e) { + return resolveIssueMessage(e); + } + } + private static String resolveIssueMessage(Exception e) { if (e instanceof ImportFailureException) return "";