X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.proconf.g3d.shapeeditor%2Fsrc%2Forg%2Fsimantics%2Fproconf%2Fg3d%2Fshapeeditor%2Fhandlers%2FCSGProjectType.java;fp=org.simantics.proconf.g3d.shapeeditor%2Fsrc%2Forg%2Fsimantics%2Fproconf%2Fg3d%2Fshapeeditor%2Fhandlers%2FCSGProjectType.java;h=a220f784f781b8cd3ca1bb2f2ca6948409b93fe2;hb=477a3eae417fe71addfcf8f87dab41f87151a384;hp=0000000000000000000000000000000000000000;hpb=d0db32bb067d2a7c323054295f6356bdb42078c9;p=simantics%2F3d.git diff --git a/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/CSGProjectType.java b/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/CSGProjectType.java new file mode 100644 index 00000000..a220f784 --- /dev/null +++ b/org.simantics.proconf.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/handlers/CSGProjectType.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2007 VTT Technical Research Centre of Finland and others. + * 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; + } + +}