X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fscl%2FSimantics%2FModel.scl;fp=bundles%2Forg.simantics.modeling%2Fscl%2FSimantics%2FModel.scl;h=a2531e3e07a7060e02d9e5cab2a505611e771b8d;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=f360040d359dcef4d9b18659eefbd49259291758;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/scl/Simantics/Model.scl b/bundles/org.simantics.modeling/scl/Simantics/Model.scl index f360040d3..a2531e3e0 100644 --- a/bundles/org.simantics.modeling/scl/Simantics/Model.scl +++ b/bundles/org.simantics.modeling/scl/Simantics/Model.scl @@ -1,70 +1,70 @@ -include "Simantics/Entity" hiding (nameOf) -include "Simantics/Ontologies" - -type Model = Resource -type Configuration = Resource - -""" - model name - -Returns an existing model in the current project with the given `name` -""" -model :: String -> Model -model name = match possibleResourceChild (currentProject ()) name with - Just m -> fromResource m - Nothing -> fail $ "Didn't find a model " + name + "." - -""" - configurationOf model - -Returns the configuration of the given `model` -and returns the `configuration` resource -""" -configurationOf :: Model -> Configuration -configurationOf m = do - conf = singleObject (toResource m) SIMU.HasConfiguration - fromResource conf - -""" -Returns the list of all models in the current project. -""" -allModels :: () -> [Model] -allModels _ = map fromResource $ objectsWithType (currentProject ()) L0.ConsistsOf SIMU.Model - -importJava "org.simantics.modeling.ModelingUtils" where - """Removes the index associated with the model.""" - removeIndex :: Model -> () - - resetIssueSources :: Model -> () - - """Copies annotation types from one model to another.""" - copyAnnotationTypes :: Model -> Model -> () - - deleteIndex :: Resource -> () - releaseMemory :: () -> () - - searchByType :: Resource -> Resource -> [Resource] - searchByTypeShallow :: Resource -> Resource -> [Resource] - searchByTypeAndName :: Resource -> Resource -> String -> [Resource] - searchByTypeAndNameShallow :: Resource -> Resource -> String -> [Resource] - searchByQuery :: Resource -> String -> [Resource] - searchByQueryShallow :: Resource -> String -> [Resource] - searchByTypeAndFilter :: Resource -> Resource -> (Resource -> Boolean) -> [Resource] - - listIndexEntries :: Resource -> String -> String - activateModel :: Resource -> Boolean - - @JavaName createModel - createGenericModel :: Resource -> String -> Resource - -importJava "org.simantics.modeling.ModelingUtils" where - @JavaName getPossibleModel - getPossibleModel :: Resource -> Model - possibleIndexRoot :: Resource -> Maybe Resource - -activateModelAction :: Resource -> () -activateModelAction model = do - syncWrite (\() -> activateModel model) - () - +include "Simantics/Entity" hiding (nameOf) +include "Simantics/Ontologies" + +type Model = Resource +type Configuration = Resource + +""" + model name + +Returns an existing model in the current project with the given `name` +""" +model :: String -> Model +model name = match possibleResourceChild (currentProject ()) name with + Just m -> fromResource m + Nothing -> fail $ "Didn't find a model " + name + "." + +""" + configurationOf model + +Returns the configuration of the given `model` +and returns the `configuration` resource +""" +configurationOf :: Model -> Configuration +configurationOf m = do + conf = singleObject (toResource m) SIMU.HasConfiguration + fromResource conf + +""" +Returns the list of all models in the current project. +""" +allModels :: () -> [Model] +allModels _ = map fromResource $ objectsWithType (currentProject ()) L0.ConsistsOf SIMU.Model + +importJava "org.simantics.modeling.ModelingUtils" where + """Removes the index associated with the model.""" + removeIndex :: Model -> () + + resetIssueSources :: Model -> () + + """Copies annotation types from one model to another.""" + copyAnnotationTypes :: Model -> Model -> () + + deleteIndex :: Resource -> () + releaseMemory :: () -> () + + searchByType :: Resource -> Resource -> [Resource] + searchByTypeShallow :: Resource -> Resource -> [Resource] + searchByTypeAndName :: Resource -> Resource -> String -> [Resource] + searchByTypeAndNameShallow :: Resource -> Resource -> String -> [Resource] + searchByQuery :: Resource -> String -> [Resource] + searchByQueryShallow :: Resource -> String -> [Resource] + searchByTypeAndFilter :: Resource -> Resource -> (Resource -> Boolean) -> [Resource] + + listIndexEntries :: Resource -> String -> String + activateModel :: Resource -> Boolean + + @JavaName createModel + createGenericModel :: Resource -> String -> Resource + +importJava "org.simantics.modeling.ModelingUtils" where + @JavaName getPossibleModel + getPossibleModel :: Resource -> Model + possibleIndexRoot :: Resource -> Maybe Resource + +activateModelAction :: Resource -> () +activateModelAction model = do + syncWrite (\() -> activateModel model) + () + \ No newline at end of file