Project

General

Profile

Download (2.67 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10

    
11
package eu.etaxonomy.taxeditor.navigation.operation;
12

    
13
import org.eclipse.core.commands.ExecutionException;
14
import org.eclipse.core.commands.operations.IUndoContext;
15
import org.eclipse.core.runtime.IAdaptable;
16
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.IStatus;
18

    
19
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
20
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
21
import eu.etaxonomy.cdm.model.description.PolytomousKey;
22
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
23
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
24
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
25
import eu.etaxonomy.taxeditor.store.CdmStore;
26

    
27
/**
28
 * @author n.hoffmann
29
 * @created Dec 2, 2010
30
 * @version 1.0
31
 */
32
@Deprecated // we do not undo creation of elements
33
public class CreatePolytomousKey extends AbstractPersistentPostOperation {
34

    
35
	private final PolytomousKey key;
36

    
37
	/**
38
	 * @param label
39
	 * @param undoContext
40
	 * @param postOperationEnabled
41
	 * @param conversationEnabled
42
	 */
43
	public CreatePolytomousKey(String label,
44
			IUndoContext undoContext,
45
			PolytomousKey key,
46
			IPostOperationEnabled postOperationEnabled,
47
			IConversationEnabled conversationEnabled,
48
			ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
49
		super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
50
		this.key = key;
51
	}
52

    
53
	/* (non-Javadoc)
54
	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
55
	 */
56
	@Override
57
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
58
			throws ExecutionException {
59
		bind();
60
		monitor.worked(20);
61
		CdmStore.getService(IPolytomousKeyService.class).saveOrUpdate(key);
62
		monitor.worked(40);
63

    
64
		return postExecute(key);
65
	}
66

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

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

    
85
}
(4-4/5)