3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.navigation
.navigator
.operation
;
12 import org
.eclipse
.core
.commands
.ExecutionException
;
13 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
15 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
16 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostOperation
;
17 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
19 import org
.eclipse
.core
.runtime
.IAdaptable
;
20 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
21 import org
.eclipse
.core
.runtime
.IStatus
;
22 import org
.eclipse
.swt
.dnd
.Clipboard
;
23 import org
.eclipse
.swt
.dnd
.TextTransfer
;
24 import org
.eclipse
.swt
.dnd
.Transfer
;
32 public class CopyOperation
extends AbstractPostOperation
{
38 * @param postOperationEnabled
40 public CopyOperation(String label
, IUndoContext undoContext
, TaxonNode taxonNode
,
41 IPostOperationEnabled postOperationEnabled
) {
42 super(label
, undoContext
, taxonNode
, postOperationEnabled
);
46 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
49 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
50 throws ExecutionException
{
52 String name
= taxonNode
.getTaxon().getName().getTitleCache();
54 final Clipboard cb
= new Clipboard(null);
55 TextTransfer textTransfer
= TextTransfer
.getInstance();
56 Transfer
[] transfers
= new Transfer
[]{textTransfer
};
58 cb
.setContents(new Object
[]{name
}, transfers
);
60 return postExecute(taxonNode
);
65 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
68 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
69 throws ExecutionException
{
70 // TODO Auto-generated method stub
75 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
78 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
79 throws ExecutionException
{
80 // TODO Auto-generated method stub