Merge branch 'develop' into remoting-4.0
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / navigator / operation / EditClassificationOperation.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.navigator.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.IClassificationService;
21 import eu.etaxonomy.cdm.model.taxon.Classification;
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 * <p>EditTaxonomicTreeOperation class.</p>
29 *
30 * @author n.hoffmann
31 * @created Jul 12, 2010
32 * @version 1.0
33 */
34 public class EditClassificationOperation extends AbstractPersistentPostOperation {
35 private final Classification classification;
36
37 /**
38 * <p>Constructor for EditTaxonomicTreeOperation.</p>
39 *
40 * @param label a {@link java.lang.String} object.
41 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
42 * @param classification a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
43 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
44 * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
45 */
46 public EditClassificationOperation(String label, IUndoContext undoContext, Classification classification,
47 IPostOperationEnabled postOperationEnabled,
48 IConversationEnabled conversationEnabled,
49 ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
50 super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
51
52 this.classification = classification;
53 }
54
55 /* (non-Javadoc)
56 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
57 */
58 /** {@inheritDoc} */
59 @Override
60 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
61 throws ExecutionException {
62 bind();
63
64 CdmStore.getService(IClassificationService.class).save(classification);
65
66 monitor.worked(40);
67
68 return postExecute(classification);
69
70 }
71
72 /* (non-Javadoc)
73 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
74 */
75 /** {@inheritDoc} */
76 @Override
77 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
78 throws ExecutionException {
79 return null;
80 }
81
82 /* (non-Javadoc)
83 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
84 */
85 /** {@inheritDoc} */
86 @Override
87 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
88 throws ExecutionException {
89 return null;
90 }
91 }