1 package org.simantics.processeditor.handlers;
\r
3 import java.util.ArrayList;
\r
4 import java.util.Collection;
\r
6 import org.simantics.db.Builtins;
\r
7 import org.simantics.db.Graph;
\r
8 import org.simantics.db.Resource;
\r
9 import org.simantics.layer0.utils.direct.GraphUtils;
\r
10 import org.simantics.proconf.ui.projects.IProject;
\r
11 import org.simantics.proconf.ui.projects.ProjectType;
\r
13 public class Plant3DProjectType extends ProjectType{
\r
15 public Plant3DProjectType(Graph graph, Resource projectTypeResource) {
\r
16 super(graph, projectTypeResource);
\r
20 public Resource createProject(Graph g, String name) throws Exception {
\r
21 Resource project = super.createProject(g, name);
\r
22 Builtins b = g.getBuiltins();
\r
24 Resource modelLibrary = g.newResource();
\r
25 g.addStatement(modelLibrary, b.InstanceOf, b.ModelLibrary);
\r
26 GraphUtils.addRelatedScalarString(g, modelLibrary, b.HasName, "Plants");
\r
27 g.addStatement(project, b.ConsistsOf, modelLibrary);
\r
30 Resource modelLibrary = g.newResource();
\r
31 g.addStatement(modelLibrary, b.InstanceOf, b.ModelLibrary);
\r
32 GraphUtils.addRelatedScalarString(g, modelLibrary, b.HasName, "Equipment");
\r
33 g.addStatement(project, b.ConsistsOf, modelLibrary);
\r
40 public IProject loadProject(Graph g, Resource r) {
\r
42 IProject project = super.loadProject(g, r);
\r
43 project.set(DefaultPerspective, "org.simantics.proconf.processeditor.plantmodelling");
\r
44 Collection<String> perspectives = new ArrayList<String>();
\r
45 perspectives.add("org.simantics.proconf.processeditor.plantmodelling");
\r
46 project.set(Perspectives, perspectives);
\r