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
;
14 import org
.eclipse
.core
.runtime
.IAdaptable
;
15 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
16 import org
.eclipse
.core
.runtime
.IStatus
;
17 import org
.eclipse
.swt
.dnd
.Clipboard
;
18 import org
.eclipse
.swt
.dnd
.TextTransfer
;
19 import org
.eclipse
.swt
.dnd
.Transfer
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
22 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
23 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
31 public class CopyOperation
extends AbstractPostTaxonOperation
{
37 * @param postOperationEnabled
39 public CopyOperation(String label
, IUndoContext undoContext
, TaxonNode taxonNode
,
40 IPostOperationEnabled postOperationEnabled
) {
41 super(label
, undoContext
, taxonNode
, postOperationEnabled
);
45 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
48 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
49 throws ExecutionException
{
51 String name
= ((TaxonNode
)taxonNode
).getTaxon().getName().getTitleCache();
53 final Clipboard cb
= new Clipboard(null);
54 TextTransfer textTransfer
= TextTransfer
.getInstance();
55 Transfer
[] transfers
= new Transfer
[]{textTransfer
};
57 cb
.setContents(new Object
[]{name
}, transfers
);
59 return postExecute(((TaxonNode
)taxonNode
));
64 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
67 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
68 throws ExecutionException
{
69 // TODO Auto-generated method stub
74 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
77 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
78 throws ExecutionException
{
79 // TODO Auto-generated method stub