1 package org.simantics.modeling.ui.actions;
\r
3 import org.simantics.Simantics;
\r
4 import org.simantics.db.Resource;
\r
5 import org.simantics.db.WriteGraph;
\r
6 import org.simantics.db.common.request.WriteResultRequest;
\r
7 import org.simantics.db.exception.DatabaseException;
\r
8 import org.simantics.modeling.ModelingResources;
\r
11 * @author Tuukka Lehtonen
\r
13 public class NewLocalLibrary extends NewLibrary {
\r
15 protected Resource createLocalLibrary(WriteGraph graph, Resource parent)
\r
16 throws DatabaseException {
\r
17 Resource lib = super.createLibrary(graph, parent);
\r
18 ModelingResources MOD = ModelingResources.getInstance(graph);
\r
19 graph.claim(lib, MOD.IsLocalLibraryOf, parent);
\r
24 public Resource newLibrary(final Resource model) throws DatabaseException {
\r
25 Resource library = Simantics.getSession().syncRequest(new WriteResultRequest<Resource>() {
\r
28 public Resource perform(WriteGraph graph) throws DatabaseException {
\r
29 Resource library = createLocalLibrary(graph, model);
\r