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 / navigator / operation / EditClassificationOperation.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.navigator.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.IClassificationService;
20 import eu.etaxonomy.cdm.model.taxon.Classification;
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 * <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 final 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 ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
49 super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
50
51 this.classification = classification;
52 }
53
54 /* (non-Javadoc)
55 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
56 */
57 /** {@inheritDoc} */
58 @Override
59 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
60 throws ExecutionException {
61 bind();
62
63 CdmStore.getService(IClassificationService.class).save(classification);
64
65 monitor.worked(40);
66
67 return postExecute(classification);
68
69 }
70
71 /* (non-Javadoc)
72 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
73 */
74 /** {@inheritDoc} */
75 @Override
76 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
77 throws ExecutionException {
78 return null;
79 }
80
81 /* (non-Javadoc)
82 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
83 */
84 /** {@inheritDoc} */
85 @Override
86 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
87 throws ExecutionException {
88 return null;
89 }
90 }