3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.operations
;
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
;
19 import eu
.etaxonomy
.cdm
.api
.conversation
.IConversationEnabled
;
20 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
21 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonomicTree
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
26 * <p>SaveClassificationOperation class.</p>
32 public class SaveClassificationOperation
extends AbstractPersistentPostOperation
{
34 private TaxonomicTree classification
;
37 * <p>Constructor for SaveClassificationOperation.</p>
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.operations.IPostOperationEnabled} object.
43 * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
45 public SaveClassificationOperation(String label
, IUndoContext undoContext
, TaxonomicTree classification
,
46 IPostOperationEnabled postOperationEnabled
,
47 IConversationEnabled conversationEnabled
) {
48 super(label
, undoContext
, postOperationEnabled
, conversationEnabled
);
50 this.classification
= classification
;
55 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
59 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
60 throws ExecutionException
{
64 if(classification
.getReference() == null){
65 ReferenceBase reference
= ReferenceFactory
.newGeneric();
66 reference
.setTitleCache(classification
.getTitleCache());
67 classification
.setReference(reference
);
70 CdmStore
.getTaxonTreeService().saveOrUpdate(classification
);
74 return postExecute(classification
);
78 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
82 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
83 throws ExecutionException
{
84 // TODO Auto-generated method stub
89 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
93 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
94 throws ExecutionException
{
95 // TODO Auto-generated method stub