1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.layer0.adapter;
14 import java.util.Collection;
16 import org.eclipse.core.runtime.IAdaptable;
17 import org.simantics.db.Resource;
18 import org.simantics.db.WriteGraph;
19 import org.simantics.db.exception.DatabaseException;
20 import org.simantics.db.layer0.util.Layer0Utils;
21 import org.simantics.db.layer0.util.PasteEventHandler;
22 import org.simantics.db.layer0.util.SimanticsClipboard;
24 public interface PasteHandler extends IAdaptable {
27 * Performs actions to paste data from the specified clipboard instance. The
28 * target of pasting generally has something to do with the graph database
29 * but not necessarily. The method must internally start transactions to
30 * either read from or write to the graph database.
32 * @param clipboard clipboard instance to paste data from
33 * @throws DatabaseException
35 Collection<Resource> pasteFromClipboard(SimanticsClipboard clipboard) throws DatabaseException;
38 * Performs actions to paste data from the specified clipboard instance
39 * using the specified write transaction database handle. Just as in
40 * {@link #pasteFromClipboard(SimanticsClipboard)} this pasting generally
41 * does with the graph database. This method can be used for performing
42 * copy/paste operations as a part of a write transaction.
44 * @param graph the write transaction handle to use for writing the data
45 * @param clipboard clipboard instance to paste data from
46 * @throws DatabaseException
49 * @see Layer0Utils#copyTo(WriteGraph, org.simantics.db.Resource, org.simantics.db.Resource)
51 Collection<Resource> pasteFromClipboard(WriteGraph graph, SimanticsClipboard clipboard, PasteEventHandler handler) throws DatabaseException;