2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.store
.operations
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.core
.commands
.operations
.AbstractOperation
;
14 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
15 import org
.eclipse
.core
.runtime
.IStatus
;
16 import org
.eclipse
.core
.runtime
.Status
;
18 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
27 public abstract class AbstractPostOperation
extends AbstractOperation
{
29 private static final Logger logger
= Logger
30 .getLogger(AbstractPostOperation
.class);
35 protected IPostOperationEnabled postOperationEnabled
;
38 * A reference to the taxon the concrete operation is working on
40 protected Taxon taxon
;
48 public AbstractPostOperation(String label
, IUndoContext undoContext
,
51 addContext(undoContext
);
61 * @param postOperationEnabled
63 public AbstractPostOperation(String label
, IUndoContext undoContext
,
64 Taxon taxon
, IPostOperationEnabled postOperationEnabled
) {
65 this(label
, undoContext
, taxon
);
66 this.postOperationEnabled
= postOperationEnabled
;
70 * This method will try to call the post operation on a possibly registered
71 * IPostOperationEnabled implementor. Objects that were affected by the operation
72 * may be passed to the registered IPostOperationEnabled implementor.
75 * @param objectAffectedByOperation the affected object. Should be <code>null</code> if not needed
79 protected IStatus
postExecute(CdmBase objectAffectedByOperation
) {
80 if(postOperationEnabled
!= null){
81 logger
.trace("executing post operation");
82 return postOperationEnabled
.postOperation(objectAffectedByOperation
) ? Status
.OK_STATUS
: Status
.CANCEL_STATUS
;
84 return Status
.OK_STATUS
;