automated build configuration is on its way
[taxeditor.git] / taxeditor-navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / operation / CreatePolytomousKey.java
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.store.CdmStore;
25
26 /**
27 * @author n.hoffmann
28 * @created Dec 2, 2010
29 * @version 1.0
30 */
31 @Deprecated // we do not undo creation of elements
32 public class CreatePolytomousKey extends AbstractPersistentPostOperation {
33
34 private PolytomousKey key;
35
36 /**
37 * @param label
38 * @param undoContext
39 * @param postOperationEnabled
40 * @param conversationEnabled
41 */
42 public CreatePolytomousKey(String label,
43 IUndoContext undoContext,
44 PolytomousKey key,
45 IPostOperationEnabled postOperationEnabled,
46 IConversationEnabled conversationEnabled) {
47 super(label, undoContext, postOperationEnabled, conversationEnabled);
48 this.key = key;
49 }
50
51 /* (non-Javadoc)
52 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
53 */
54 @Override
55 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
56 throws ExecutionException {
57 bind();
58 monitor.worked(20);
59 CdmStore.getService(IPolytomousKeyService.class).saveOrUpdate(key);
60 monitor.worked(40);
61
62 return postExecute(key);
63 }
64
65 /* (non-Javadoc)
66 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
67 */
68 @Override
69 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
70 throws ExecutionException {
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 return null;
81 }
82
83 }