]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.server/scl/Document/All.scl
Minor updates to Document/All.scl and Prelude.scl
[simantics/platform.git] / bundles / org.simantics.document.server / scl / Document / All.scl
index 23896814224bdeed738e03fb32723c466fc5d367..4db639f5bf2696a389669d527bae19b035978064 100644 (file)
@@ -21,6 +21,13 @@ importJava "org.simantics.document.server.io.ITreeTableCell" where
 
 importJava "org.simantics.document.server.io.IFont" where
     data IFont
+    
+    @JavaName getFamily
+    fontFamily :: IFont -> <Proc> Maybe String
+    @JavaName getStyle
+    fontStyle :: IFont -> <Proc> Maybe String
+    @JavaName getHeight
+    fontHeight :: IFont -> <Proc> Integer
 
 importJava "org.simantics.document.server.io.IColor" where
     data IColor
@@ -78,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
 
@@ -92,7 +102,7 @@ importJava "org.simantics.document.server.Functions" where
     putTuple :: CommandContextMutable -> String -> a -> CommandContextMutable
 
     @JavaName getTuples
-    getTuples :: CommandContext -> String -> [a]
+    getTuples :: CommandContext -> String -> [Dynamic]
 
     printContext :: CommandContext -> String
 
@@ -127,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
     
@@ -136,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__"