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
.api
.service
.ITaxonNodeService
;
21 import eu
.etaxonomy
.cdm
.persistence
.dto
.TaxonNodeDto
;
22 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
23 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
32 public class CopyOperation
extends AbstractPostTaxonOperation
{
38 * @param postOperationEnabled
40 public CopyOperation(String label
, IUndoContext undoContext
, TaxonNodeDto 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
.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(CdmStore
.getService(ITaxonNodeService
.class).find(taxonNode
.getUuid()));
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