Project

General

Profile

Download (2.75 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
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.
8
*/
9
package eu.etaxonomy.taxeditor.navigation.navigator.operation;
10

    
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;
19

    
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;
25

    
26

    
27
/**
28
 * @author l.morris
29
 * @date 23 Jan 2012
30
 *
31
 */
32
public class CopyOperation extends AbstractPostTaxonOperation {
33

    
34
	/**
35
	 * @param label
36
	 * @param undoContext
37
	 * @param taxon
38
	 * @param postOperationEnabled
39
	 */
40
	public CopyOperation(String label, IUndoContext undoContext, TaxonNodeDto taxonNode,
41
			IPostOperationEnabled postOperationEnabled) {
42
		super(label, undoContext, taxonNode, postOperationEnabled);
43
	}
44

    
45
	/* (non-Javadoc)
46
	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
47
	 */
48
	@Override
49
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
50
			throws ExecutionException {
51

    
52
		String name = taxonNode.getTitleCache();
53

    
54
	    final Clipboard cb = new Clipboard(null);
55
	    TextTransfer textTransfer = TextTransfer.getInstance();
56
	    Transfer[] transfers = new Transfer[]{textTransfer};
57

    
58
	    cb.setContents(new Object[]{name}, transfers);
59

    
60
		return postExecute(CdmStore.getService(ITaxonNodeService.class).find(taxonNode.getUuid()));
61
		//return null;
62
	}
63

    
64
	/* (non-Javadoc)
65
	 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
66
	 */
67
	@Override
68
	public IStatus redo(IProgressMonitor monitor, IAdaptable info)
69
			throws ExecutionException {
70
		// TODO Auto-generated method stub
71
		return null;
72
	}
73

    
74
	/* (non-Javadoc)
75
	 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
76
	 */
77
	@Override
78
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
79
			throws ExecutionException {
80
		// TODO Auto-generated method stub
81
		return null;
82
	}
83

    
84
}
(1-1/9)