ref #6190 removing svn property place holder in first line of code - java files
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / operation / CreatePolytomousKey.java
1 /**
2 * Copyright (C) 2007 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
10 package eu.etaxonomy.taxeditor.navigation.operation;
11
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
18 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
19 import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
20 import eu.etaxonomy.cdm.model.description.PolytomousKey;
21 import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
22 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
23 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
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 final 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 ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
48 super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
49 this.key = key;
50 }
51
52 /* (non-Javadoc)
53 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
54 */
55 @Override
56 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
57 throws ExecutionException {
58 bind();
59 monitor.worked(20);
60 CdmStore.getService(IPolytomousKeyService.class).saveOrUpdate(key);
61 monitor.worked(40);
62
63 return postExecute(key);
64 }
65
66 /* (non-Javadoc)
67 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
68 */
69 @Override
70 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
71 throws ExecutionException {
72 return null;
73 }
74
75 /* (non-Javadoc)
76 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
77 */
78 @Override
79 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
80 throws ExecutionException {
81 return null;
82 }
83
84 }