2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.navigation
.navigator
.operation
;
11 import org
.eclipse
.core
.commands
.ExecutionException
;
12 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
13 import org
.eclipse
.core
.runtime
.IAdaptable
;
14 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
15 import org
.eclipse
.core
.runtime
.IStatus
;
16 import org
.eclipse
.swt
.dnd
.Clipboard
;
17 import org
.eclipse
.swt
.dnd
.TextTransfer
;
18 import org
.eclipse
.swt
.dnd
.Transfer
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
21 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
22 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
30 public class CopyOperation
extends AbstractPostTaxonOperation
{
36 * @param postOperationEnabled
38 public CopyOperation(String label
, IUndoContext undoContext
, TaxonNode taxonNode
,
39 IPostOperationEnabled postOperationEnabled
) {
40 super(label
, undoContext
, taxonNode
, postOperationEnabled
);
44 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
47 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
48 throws ExecutionException
{
50 String name
= ((TaxonNode
)taxonNode
).getTaxon().getName().getTitleCache();
52 final Clipboard cb
= new Clipboard(null);
53 TextTransfer textTransfer
= TextTransfer
.getInstance();
54 Transfer
[] transfers
= new Transfer
[]{textTransfer
};
56 cb
.setContents(new Object
[]{name
}, transfers
);
58 return postExecute(((TaxonNode
)taxonNode
));
63 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
66 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
67 throws ExecutionException
{
68 // TODO Auto-generated method stub
73 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
76 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
77 throws ExecutionException
{
78 // TODO Auto-generated method stub