2 include "Simantics/Variables"
3 include "Simantics/Ontologies"
5 include "http://www.simantics.org/Modeling-1.2/SCLQuery" as SCLQuery
7 importJava "org.simantics.scl.compiler.errors.CompilationError" where
10 importJava "org.simantics.scl.ui.editor.TextAndErrors" where
12 createTextAndErrors :: String -> [CompilationError] -> TextAndErrors
14 createSCLModuleAction :: Resource -> <Proc> ()
15 createSCLModuleAction res = ignore $ syncWrite (\() -> createSCLModuleDefault res)
17 createSCLScriptAction :: Resource -> <Proc> ()
18 createSCLScriptAction res = ignore $ syncWrite (\() -> createSCLScriptDefault res)
20 createPGraphAction :: Resource -> <Proc> ()
21 createPGraphAction res = ignore $ syncWrite (\() -> createPGraphDefault res)
23 createSCLValueIndependent :: Resource -> String -> <WriteGraph> Resource
24 createSCLValueIndependent valueType expression = do
25 value = newResource ()
26 claim value L0.InstanceOf valueType
27 claimRelatedValue value L0.SCLValue.expression expression
30 createSCLValue :: Resource -> Resource -> Resource -> String -> <WriteGraph> Resource
31 createSCLValue container predicate valueType expression = do
32 value = createSCLValueIndependent valueType expression
33 claim container predicate value
36 setExpression :: Variable -> String -> <WriteGraph> ()
37 setExpression self expression = do
39 claimRelatedValue res L0.SCLValue.expression expression
41 importJava "org.simantics.modeling.ModelingUtils" where
42 createSCLModuleDefault :: Resource -> <WriteGraph> ()
43 createSCLScriptDefault :: Resource -> <WriteGraph> ()
44 createPGraphDefault :: Resource -> <WriteGraph> ()
45 createSCLModule :: Resource -> String -> <WriteGraph> ()
46 createSCLScript :: Resource -> String -> <WriteGraph> ()
47 createPGraph :: Resource -> String -> <WriteGraph> ()
51 "org.simantics.scl.compiler.commands.CommandSession"
53 importJava "org.simantics.modeling.scl.SCLRealm" where
55 syncExec :: SCLRealm -> (<SCL, Proc> a) -> <Proc> a
56 @JavaName refreshVariablesSync
57 refreshVariables :: SCLRealm -> <Proc> ()
59 readSCLRealm :: Resource -> <ReadGraph,Proc> SCLRealm
61 id = relatedValue r L0.HasName
62 in match sclRealmById id with
64 Nothing -> getOrCreateSCLRealm id
66 importJava "org.simantics.modeling.scl.SCLSessionManager" where
67 getOrCreateSCLRealm :: String -> <Proc> SCLRealm
68 sclRealmById :: String -> <Proc> Maybe SCLRealm
70 importJava "org.simantics.scl.compiler.top.CommandResponse" where
71 data CommandResponse =
72 @FieldNames [message, error]
73 CommandResponse String Boolean
75 isSuccessful :: CommandResponse -> Boolean
76 isSuccessful (CommandResponse _ error) = not error
78 instance Show CommandResponse where
79 show (CommandResponse message _) = message
81 importJava "org.simantics.scl.compiler.commands.CommandSession" where
82 execute :: String -> <SCL, Proc> ()
84 @JavaName getVariableValue
85 variableValue :: String -> <SCL> a
86 setVariable :: String -> Type -> a -> <SCL> ()