1 include "Simantics/All"
4 usedSharedOntologies2 :: Variable -> <ReadGraph> [Resource]
5 usedSharedOntologies2 model = usedSharedOntologies $ represents model
7 availableSharedOntologies2 :: Variable -> <ReadGraph> [Resource]
8 availableSharedOntologies2 model = availableSharedOntologies $ represents model
10 useSelectedHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String
11 useSelectedHandler input parameters = do
12 model = represents input
13 resources = map wseResource $ decodeWSES $ parameters "selection"
14 for resources $ linkSharedOntology model
17 unlinkSelectedHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String
18 unlinkSelectedHandler input parameters = do
19 model = represents input
20 resources = map wseResource $ decodeWSES $ parameters "selection"
21 unlinkSharedOntologyWithUI input resources
24 createNewHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String
25 createNewHandler input parameters = do
26 createSharedOntologyWithUI L0.SharedOntology
29 importHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String
30 importHandler input parameters = do
31 importSharedOntologyWithUI input
34 fooHandler :: Variable -> CommandContext -> <WriteGraph> Maybe CommandResult
35 fooHandler self ctx = do
36 val = fromJust $ possibleString ctx "selected"
37 setProjectComponentState self "currentSelection" val
40 availableRanges :: Variable -> <ReadGraph> [String]
41 availableRanges input = do
43 res = represents input
44 ranges = objectsWithType res L0.ConsistsOf SHEET.Range
47 defaultRange :: Variable -> <ReadGraph> String
48 defaultRange input = do
49 ranges = availableRanges input
50 if (length ranges) == 0 then "" else ranges!0
52 currentRangeName :: Variable -> Variable -> <ReadGraph> String
53 currentRangeName self input =
54 projectComponentState self "#currentSelection" (defaultRange input)
56 currentRangeExpressionVariable :: Variable -> Variable -> <ReadGraph> Variable
57 currentRangeExpressionVariable self input = do
58 name = projectComponentState self "./Combo#currentSelection" (defaultRange input)
59 browse input ("/" + name + "#cells")
61 currentRangeExpression :: Variable -> Variable -> <ReadGraph> String
62 currentRangeExpression self input = do
63 variable = currentRangeExpressionVariable self input
64 value $ browse variable "#expression"
66 currentRangeTextAndErrors :: Variable -> Variable -> <ReadGraph> TextAndErrors
67 currentRangeTextAndErrors self input = do
68 expression = currentRangeExpression self input
69 createTextAndErrors expression []
71 fooHandler2 :: Variable -> CommandContext -> <WriteGraph> Maybe CommandResult
72 fooHandler2 self ctx = do
73 val = fromJust $ possibleString ctx "text"
74 setExpression self val
77 modifyCodeHandler :: Variable -> Variable -> CommandContext -> <WriteGraph> Maybe CommandResult
78 modifyCodeHandler self input ctx = do
79 val = fromJust $ possibleString ctx "text"
80 variable = currentRangeExpressionVariable self input
81 setExpression variable val