]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.server/scl/Document/All.scl
Console printing enhancements for documents (Simupedia)
[simantics/platform.git] / bundles / org.simantics.document.server / scl / Document / All.scl
index 98a63269978b01597d1d5ea7fb14628f39fec688..7781cfdb3ffaa9595eb322be7d01ffc286bf48c0 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
 
@@ -143,22 +146,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__"
-
-importJava "org.simantics.document.server.io.IRequest" where
-    @private
-    data IRequest
-    
-    @private
-    getParameter :: IRequest -> String -> <Proc> Maybe String
-
-possibleQueryParameterFromContext :: CommandContext -> String -> <Proc> Maybe String
-possibleQueryParameterFromContext context parameter = do
-    request = fromJust $ possibleValue context "__request__"
-    getParameter request parameter