1 /*******************************************************************************
\r
2 * Copyright (c) 2007- VTT Technical Research Centre of Finland.
\r
3 * All rights reserved. This program and the accompanying materials
\r
4 * are made available under the terms of the Eclipse Public License v1.0
\r
5 * which accompanies this distribution, and is available at
\r
6 * http://www.eclipse.org/legal/epl-v10.html
\r
9 * VTT Technical Research Centre of Finland - initial API and implementation
\r
10 *******************************************************************************/
\r
11 package org.simantics.processeditor.handlers;
\r
13 import java.util.ArrayList;
\r
14 import java.util.Collection;
\r
16 import org.simantics.db.Builtins;
\r
17 import org.simantics.db.Graph;
\r
18 import org.simantics.db.Resource;
\r
19 import org.simantics.layer0.utils.direct.GraphUtils;
\r
20 import org.simantics.proconf.ui.projects.IProject;
\r
21 import org.simantics.proconf.ui.projects.ProjectType;
\r
23 public class Plant3DProjectType extends ProjectType{
\r
25 public Plant3DProjectType(Graph graph, Resource projectTypeResource) {
\r
26 super(graph, projectTypeResource);
\r
30 public Resource createProject(Graph g, String name) throws Exception {
\r
31 Resource project = super.createProject(g, name);
\r
32 Builtins b = g.getBuiltins();
\r
34 Resource modelLibrary = g.newResource();
\r
35 g.addStatement(modelLibrary, b.InstanceOf, b.ModelLibrary);
\r
36 GraphUtils.addRelatedScalarString(g, modelLibrary, b.HasName, "Plants");
\r
37 g.addStatement(project, b.ConsistsOf, modelLibrary);
\r
40 Resource modelLibrary = g.newResource();
\r
41 g.addStatement(modelLibrary, b.InstanceOf, b.ModelLibrary);
\r
42 GraphUtils.addRelatedScalarString(g, modelLibrary, b.HasName, "Equipment");
\r
43 g.addStatement(project, b.ConsistsOf, modelLibrary);
\r
50 public IProject loadProject(Graph g, Resource r) {
\r
52 IProject project = super.loadProject(g, r);
\r
53 project.set(DefaultPerspective, "org.simantics.proconf.processeditor.plantmodelling");
\r
54 Collection<String> perspectives = new ArrayList<String>();
\r
55 perspectives.add("org.simantics.proconf.processeditor.plantmodelling");
\r
56 project.set(Perspectives, perspectives);
\r