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.modeling.ui.symbolEditor;
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.Status;
16 import org.simantics.Simantics;
17 import org.simantics.db.ReadGraph;
18 import org.simantics.db.common.request.ReadRequest;
19 import org.simantics.db.exception.DatabaseException;
20 import org.simantics.diagram.handler.CopyOperation;
21 import org.simantics.diagram.handler.CopyStrategy;
22 import org.simantics.diagram.handler.DefaultCopyPasteStrategy;
23 import org.simantics.modeling.ui.Activator;
26 * The default strategy for pasting diagram elements.
28 * @author Tuukka Lehtonen
31 public class SymbolEditorCopyPasteStrategy extends DefaultCopyPasteStrategy implements CopyStrategy {
34 public IStatus copy(CopyOperation operation) {
36 Simantics.getSession().syncRequest(new ReadRequest() {
38 public void run(ReadGraph graph) throws DatabaseException {
39 // TODO: implement the necessary checks to prevent copying symbol terminals
42 return Status.OK_STATUS;
43 } catch (DatabaseException e) {
44 IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
45 "Failed to filter copied material.", e);
46 Activator.getDefault().getLog().log(status);