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