]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/scl/Simantics/Library.scl
Make Write-interfaces as @FunctionalInterface for lambdas
[simantics/platform.git] / bundles / org.simantics.modeling.ui / scl / Simantics / Library.scl
1 import "Simantics/Model"
2 include "Simantics/Entity" hiding (nameOf)
3 import "http://www.simantics.org/Layer0-1.1" as L0
4
5 type Library = Resource
6
7 importJava "org.simantics.modeling.ui.SCLLibrary" where
8     @JavaName createLibrary
9     """
10     Creates a new Library under the given Library parameter. Returns the created Library.
11     """
12     createLibrary :: Library -> <Proc> Library
13     
14     @Javaname createLibraryInModel
15     """
16     Creates a new Library under the given Model parameter. Returns the created Library.
17     """
18     createLibraryInModel :: Model -> <Proc> Library
19     
20     @JavaName getLibrary
21     getLibrary :: Model -> String -> <ReadGraph> Library
22     
23 librariesOf :: Model -> <ReadGraph> [Library]
24 librariesOf model = recurse L0.Library (toResource model)
25   where
26     recurse t r = do
27         cs = resourceChildrenOf r 
28         libraries = map fromResource $ filter isLibrary cs
29         libraryGrp = filter (not . isLibrary) cs
30         libraries + concatMap (recurse t) libraryGrp
31     isLibrary r = isInstanceOf r L0.Library