]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
e9003a1aa0114c701462059b07e10329092358b3
[simantics/sysdyn.git] /
1 package org.simantics.sysdyn.ui.wizards.functions;\r
2 \r
3 import java.util.ArrayList;\r
4 import java.util.Collection;\r
5 \r
6 import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
7 import org.simantics.db.ReadGraph;\r
8 import org.simantics.db.Resource;\r
9 import org.simantics.db.common.request.ObjectsWithType;\r
10 import org.simantics.db.exception.DatabaseException;\r
11 import org.simantics.layer0.Layer0;\r
12 import org.simantics.sysdyn.SysdynResource;\r
13 import org.simantics.sysdyn.ui.browser.nodes.SharedFunctionLibraryNode;\r
14 \r
15 public class FunctionTreeSharedLibraries extends ViewpointContributor<SharedFunctionsFolderNode> {\r
16 \r
17     @Override\r
18     public Collection<?> getContribution(ReadGraph graph, SharedFunctionsFolderNode folder)\r
19     throws DatabaseException {\r
20         ArrayList<SharedFunctionLibraryNode> result = new ArrayList<SharedFunctionLibraryNode>();\r
21                 Layer0 l0 = Layer0.getInstance(graph);\r
22                 SysdynResource sr = SysdynResource.getInstance(graph);\r
23                 Resource sharedlibrary = graph.getPossibleResource("http://SharedOntologies");\r
24                 for (Resource r : graph.syncRequest(new ObjectsWithType(sharedlibrary, l0.ConsistsOf, sr.SharedFunctionOntology))){\r
25                         result.add(new SharedFunctionLibraryNode(r));\r
26                 }\r
27         return result;\r
28     }\r
29 \r
30     @Override\r
31     public String getViewpointId() {\r
32         return "Standard";\r
33     }\r
34 \r
35 }\r