46e7bc2edd7b437b6502ad88dfd2a84f3d871e91
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / operations / EditTaxonomicTreeOperation.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.operations;
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.model.taxon.TaxonomicTree;
21 import eu.etaxonomy.taxeditor.store.CdmStore;
22
23 /**
24 * <p>EditTaxonomicTreeOperation class.</p>
25 *
26 * @author n.hoffmann
27 * @created Jul 12, 2010
28 * @version 1.0
29 */
30 public class EditTaxonomicTreeOperation extends AbstractPersistentPostOperation {
31 private TaxonomicTree classification;
32
33 /**
34 * <p>Constructor for EditTaxonomicTreeOperation.</p>
35 *
36 * @param label a {@link java.lang.String} object.
37 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
38 * @param classification a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
39 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operations.IPostOperationEnabled} object.
40 * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
41 */
42 public EditTaxonomicTreeOperation(String label, IUndoContext undoContext, TaxonomicTree classification,
43 IPostOperationEnabled postOperationEnabled,
44 IConversationEnabled conversationEnabled) {
45 super(label, undoContext, postOperationEnabled, conversationEnabled);
46
47 this.classification = classification;
48 }
49
50 /* (non-Javadoc)
51 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
52 */
53 /** {@inheritDoc} */
54 @Override
55 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
56 throws ExecutionException {
57 bind();
58
59 CdmStore.getTaxonTreeService().save(classification);
60
61 monitor.worked(40);
62
63 return postExecute(classification);
64
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 /** {@inheritDoc} */
71 @Override
72 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
73 throws ExecutionException {
74 // TODO Auto-generated method stub
75 return null;
76 }
77
78 /* (non-Javadoc)
79 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
80 */
81 /** {@inheritDoc} */
82 @Override
83 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
84 throws ExecutionException {
85 // TODO Auto-generated method stub
86 return null;
87 }
88 }