]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.server/scl/Document/All.scl
ValueType modifications to satisfy compilation of SCL-expressions
[simantics/platform.git] / bundles / org.simantics.document.server / scl / Document / All.scl
index fa83a224acfc2d7076af4417e2f2e181680e93e7..641f4fdc158f1e6e5546f1d6f6dbd601da3b6538 100644 (file)
@@ -85,6 +85,9 @@ instance Coercible CommandContextMutable CommandContext where
 cloneCommandContext :: CommandContext -> <Proc> CommandContextMutable
 cloneCommandContext context = merge (commandContext ()) context
 
+instance Show CommandContext where
+    show ctx = printContext ctx
+
 importJava "org.simantics.document.server.io.CommandResult" where
     data CommandResult
 
@@ -134,6 +137,8 @@ importJava "org.simantics.document.server.Functions" where
     
     stateVariable :: Variable -> <ReadGraph> Variable
     
+    compileDocumentSCLValueExpression :: Variable -> <ReadGraph> String
+    
 propertyValueCached :: Serializable a => Typeable a => Variable -> String -> <ReadGraph> a
 propertyValueCached var prop = propertyValueCached_ var prop binding
     
@@ -143,10 +148,10 @@ displayValue var str = propertyValue (property var str) "HasDisplayValue"
 displayValue0 :: Variable -> <ReadGraph> String
 displayValue0 var = propertyValue var "HasDisplayValue"
 
-consoleLog :: Variable -> String -> <ReadGraph> ()
-consoleLog state message = do
-    console = state#console
-    runProc $ addMessage console message
+consoleLog :: CommandContext -> String -> ()
+consoleLog context message = match possibleValue context "console" with
+  Nothing -> ()
+  Just console -> runProc $ addMessage console message
 
 contextDocument :: CommandContext -> <Proc> IDocument
 contextDocument ctx = justValue ctx "__document__"