-include "Simantics/All"\r
-include "SWT/All"\r
-\r
-usedSharedOntologies2 :: Variable -> <ReadGraph> [Resource]\r
-usedSharedOntologies2 model = usedSharedOntologies $ represents model\r
-\r
-availableSharedOntologies2 :: Variable -> <ReadGraph> [Resource]\r
-availableSharedOntologies2 model = availableSharedOntologies $ represents model\r
-\r
-useSelectedHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String\r
-useSelectedHandler input parameters = do\r
- model = represents input\r
- resources = map wseResource $ decodeWSES $ parameters "selection"\r
- for resources $ linkSharedOntology model\r
- ""\r
-\r
-unlinkSelectedHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String\r
-unlinkSelectedHandler input parameters = do\r
- model = represents input\r
- resources = map wseResource $ decodeWSES $ parameters "selection"\r
- unlinkSharedOntologyWithUI input resources\r
- ""\r
-\r
-createNewHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String\r
-createNewHandler input parameters = do\r
- createSharedOntologyWithUI L0.SharedOntology\r
- ""\r
-\r
-importHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String\r
-importHandler input parameters = do\r
- importSharedOntologyWithUI input\r
- ""\r
-\r
-fooHandler :: Variable -> CommandContext -> <WriteGraph> Maybe CommandResult\r
-fooHandler self ctx = do\r
- val = fromJust $ possibleString ctx "selected"\r
- setProjectComponentState self "currentSelection" val\r
- Nothing\r
- \r
-availableRanges :: Variable -> <ReadGraph> [String]\r
-availableRanges input = do\r
- u = uri input\r
- res = represents input\r
- ranges = objectsWithType res L0.ConsistsOf SHEET.Range\r
- map nameOf ranges\r
- \r
-defaultRange :: Variable -> <ReadGraph> String\r
-defaultRange input = do\r
- ranges = availableRanges input\r
- if (length ranges) == 0 then "" else ranges!0\r
-\r
-currentRangeName :: Variable -> Variable -> <ReadGraph> String\r
-currentRangeName self input = \r
- projectComponentState self "#currentSelection" (defaultRange input)\r
-\r
-currentRangeExpressionVariable :: Variable -> Variable -> <ReadGraph> Variable\r
-currentRangeExpressionVariable self input = do\r
- name = projectComponentState self "./Combo#currentSelection" (defaultRange input)\r
- browse input ("/" + name + "#cells")\r
-\r
-currentRangeExpression :: Variable -> Variable -> <ReadGraph> String\r
-currentRangeExpression self input = do\r
- variable = currentRangeExpressionVariable self input\r
- value $ browse variable "#expression"\r
-\r
-currentRangeTextAndErrors :: Variable -> Variable -> <ReadGraph> TextAndErrors\r
-currentRangeTextAndErrors self input = do\r
- expression = currentRangeExpression self input\r
- createTextAndErrors expression []\r
-\r
-fooHandler2 :: Variable -> CommandContext -> <WriteGraph> Maybe CommandResult\r
-fooHandler2 self ctx = do\r
- val = fromJust $ possibleString ctx "text"\r
- setExpression self val\r
- Nothing\r
-\r
-modifyCodeHandler :: Variable -> Variable -> CommandContext -> <WriteGraph> Maybe CommandResult\r
-modifyCodeHandler self input ctx = do\r
- val = fromJust $ possibleString ctx "text"\r
- variable = currentRangeExpressionVariable self input\r
- setExpression variable val\r
- Nothing\r
+include "Simantics/All"
+include "SWT/All"
+
+useSelectedHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String
+useSelectedHandler input parameters = do
+ model = represents input
+ resources = map wseResource $ decodeWSES $ parameters "selection"
+ for resources $ linkSharedOntology model
+ ""
+
+unlinkSelectedHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String
+unlinkSelectedHandler input parameters = do
+ model = represents input
+ resources = map wseResource $ decodeWSES $ parameters "selection"
+ unlinkSharedOntologyWithUI input resources
+ ""
+
+createNewHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String
+createNewHandler input parameters = do
+ createSharedOntologyWithUI L0.SharedOntology
+ ""
+
+importHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String
+importHandler input parameters = do
+ importSharedOntologyWithUI input
+ ""
+
+fooHandler :: Variable -> CommandContext -> <WriteGraph> Maybe CommandResult
+fooHandler self ctx = do
+ val = fromJust $ possibleString ctx "selected"
+ setProjectComponentState self "currentSelection" val
+ Nothing
+
+availableRanges :: Variable -> <ReadGraph> [String]
+availableRanges input = do
+ u = uri input
+ res = represents input
+ ranges = objectsWithType res L0.ConsistsOf SHEET.Range
+ map nameOf ranges
+
+defaultRange :: Variable -> <ReadGraph> String
+defaultRange input = do
+ ranges = availableRanges input
+ if (length ranges) == 0 then "" else ranges!0
+
+currentRangeName :: Variable -> Variable -> <ReadGraph> String
+currentRangeName self input =
+ projectComponentState self "#currentSelection" (defaultRange input)
+
+currentRangeExpressionVariable :: Variable -> Variable -> <ReadGraph> Variable
+currentRangeExpressionVariable self input = do
+ name = projectComponentState self "./Combo#currentSelection" (defaultRange input)
+ browse input ("/" + name + "#cells")
+
+currentRangeExpression :: Variable -> Variable -> <ReadGraph> String
+currentRangeExpression self input = do
+ variable = currentRangeExpressionVariable self input
+ value $ browse variable "#expression"
+
+currentRangeTextAndErrors :: Variable -> Variable -> <ReadGraph> TextAndErrors
+currentRangeTextAndErrors self input = do
+ expression = currentRangeExpression self input
+ createTextAndErrors expression []
+
+fooHandler2 :: Variable -> CommandContext -> <WriteGraph> Maybe CommandResult
+fooHandler2 self ctx = do
+ val = fromJust $ possibleString ctx "text"
+ setExpression self val
+ Nothing
+
+modifyCodeHandler :: Variable -> Variable -> CommandContext -> <WriteGraph> Maybe CommandResult
+modifyCodeHandler self input ctx = do
+ val = fromJust $ possibleString ctx "text"
+ variable = currentRangeExpressionVariable self input
+ setExpression variable val
+ Nothing
+
+standardPropertiesElementTransformation :: Variable -> <ReadGraph> Variable
+standardPropertiesElementTransformation var = do
+ match getPossibleType var with
+ Nothing -> var
+ Just resourceType -> if isInheritedFrom resourceType DIA.Element then do
+ match possibleObject (represents var) MOD.ElementToComponent with
+ Nothing -> var
+ Just component -> resourceVariable component
+ else var
\ No newline at end of file