--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.proconf.g3d.shapeeditor.handlers;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.db.Builtins;\r
+import org.simantics.db.Graph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.proconf.ui.projects.IProject;\r
+import org.simantics.proconf.ui.projects.ProjectType;\r
+\r
+public class CSGProjectType extends ProjectType {\r
+\r
+ public CSGProjectType(Graph graph, Resource projectTypeResource) {\r
+ super(graph, projectTypeResource);\r
+ }\r
+\r
+ @Override\r
+ public Resource createProject(Graph g, String name) throws Exception {\r
+ Resource project = super.createProject(g, name);\r
+ Builtins b = g.getBuiltins();\r
+ \r
+ { // Models\r
+ Resource modelLibrary = g.newResource(); \r
+ g.addStatement(modelLibrary, b.InstanceOf, b.ModelLibrary);\r
+ GraphUtils.addRelatedScalarString(g, modelLibrary, b.HasName, "Models");\r
+ g.addStatement(project, b.ConsistsOf, modelLibrary); \r
+ }\r
+ \r
+ \r
+ \r
+ return project;\r
+ }\r
+ \r
+ @Override\r
+ public IProject loadProject(Graph g, Resource r) {\r
+ IProject project = super.loadProject(g, r);\r
+ project.set(DefaultPerspective, "org.simantics.proconf.shapeeditor.perspectives.csg");\r
+ Collection<String> perspectives = new ArrayList<String>();\r
+ perspectives.add("org.simantics.proconf.shapeeditor.perspectives.csg");\r
+ project.set(Perspectives, perspectives);\r
+ \r
+ return project;\r
+ }\r
+ \r
+}\r