1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2012 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.sysdyn.ui.browser.actions.newActions;
\r
14 import org.simantics.db.Resource;
\r
15 import org.simantics.db.WriteGraph;
\r
16 import org.simantics.db.common.request.WriteRequest;
\r
17 import org.simantics.db.exception.DatabaseException;
\r
18 import org.simantics.db.layer0.adapter.ActionFactory;
\r
19 import org.simantics.sysdyn.ui.utils.SheetUtils;
\r
20 import org.simantics.ui.SimanticsUI;
\r
23 * Creates a new spreadsheet to a book
\r
24 * @author Teemu Lempinen
\r
27 public class NewSheetAction implements ActionFactory{
\r
30 public Runnable create(Object target) {
\r
31 if(!(target instanceof Resource))
\r
33 final Resource book = (Resource)target;
\r
35 return new Runnable() {
\r
39 SimanticsUI.getSession().asyncRequest(new WriteRequest() {
\r
42 public void perform(WriteGraph graph) throws DatabaseException {
\r
43 SheetUtils.createSheet(graph, book, null, new String[] {}, new int[] {50});
\r