1 /*******************************************************************************
\r
2 * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.
\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.proconf.g3d.shapeeditor.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 CSGProjectType extends ProjectType {
\r
25 public CSGProjectType(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
35 Resource modelLibrary = g.newResource();
\r
36 g.addStatement(modelLibrary, b.InstanceOf, b.ModelLibrary);
\r
37 GraphUtils.addRelatedScalarString(g, modelLibrary, b.HasName, "Models");
\r
38 g.addStatement(project, b.ConsistsOf, modelLibrary);
\r
47 public IProject loadProject(Graph g, Resource r) {
\r
48 IProject project = super.loadProject(g, r);
\r
49 project.set(DefaultPerspective, "org.simantics.proconf.shapeeditor.perspectives.csg");
\r
50 Collection<String> perspectives = new ArrayList<String>();
\r
51 perspectives.add("org.simantics.proconf.shapeeditor.perspectives.csg");
\r
52 project.set(Perspectives, perspectives);
\r