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