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 = do
16 syncWrite (\() -> createSCLModuleDefault res)
19 createPGraphAction :: Resource -> <Proc> ()
20 createPGraphAction res = do
21 syncWrite (\() -> createPGraphDefault res)
24 createSCLValueIndependent :: Resource -> String -> <WriteGraph> Resource
25 createSCLValueIndependent valueType expression = do
26 value = newResource ()
27 claim value L0.InstanceOf valueType
28 claimRelatedValue value L0.SCLValue.expression expression
31 createSCLValue :: Resource -> Resource -> Resource -> String -> <WriteGraph> Resource
32 createSCLValue container predicate valueType expression = do
33 value = createSCLValueIndependent valueType expression
34 claim container predicate value
37 setExpression :: Variable -> String -> <WriteGraph> ()
38 setExpression self expression = do
40 claimRelatedValue res L0.SCLValue.expression expression
42 importJava "org.simantics.modeling.ModelingUtils" where
43 createSCLModuleDefault :: Resource -> <WriteGraph> ()
44 createPGraphDefault :: Resource -> <WriteGraph> ()
45 createSCLModule :: Resource -> String -> <WriteGraph> ()
49 "org.simantics.scl.compiler.commands.CommandSession"
51 importJava "org.simantics.modeling.scl.SCLRealm" where
53 syncExec :: SCLRealm -> (<SCL, Proc> a) -> <Proc> a
54 @JavaName refreshVariablesSync
55 refreshVariables :: SCLRealm -> <Proc> ()
57 readSCLRealm :: Resource -> <ReadGraph,Proc> SCLRealm
59 id = relatedValue r L0.HasName
60 in match sclRealmById id with
62 Nothing -> getOrCreateSCLRealm id
64 importJava "org.simantics.modeling.scl.SCLSessionManager" where
65 getOrCreateSCLRealm :: String -> <Proc> SCLRealm
66 sclRealmById :: String -> <Proc> Maybe SCLRealm
68 importJava "org.simantics.scl.compiler.top.CommandResponse" where
69 data CommandResponse =
70 @FieldNames [message, error]
71 CommandResponse String Boolean
73 isSuccessful :: CommandResponse -> Boolean
74 isSuccessful (CommandResponse _ error) = not error
76 instance Show CommandResponse where
77 show (CommandResponse message _) = message
79 importJava "org.simantics.scl.compiler.commands.CommandSession" where
80 execute :: String -> <SCL, Proc> ()
82 @JavaName getVariableValue
83 variableValue :: String -> <SCL> a
84 setVariable :: String -> Type -> a -> <SCL> ()