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
.editor
.view
.concept
.operation
;
14 import org
.eclipse
.core
.commands
.ExecutionException
;
15 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
16 import org
.eclipse
.core
.runtime
.IAdaptable
;
17 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
18 import org
.eclipse
.core
.runtime
.IStatus
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
22 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
23 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
26 * Deletes given relations between two taxa.
33 public class DeleteConceptRelationOperation
extends AbstractPostTaxonOperation
{
35 private final Set
<TaxonRelationship
> taxonRelationships
;
42 * @param postOperationEnabled
44 public DeleteConceptRelationOperation(String label
,
45 IUndoContext undoContext
, Taxon taxon
, Set
<TaxonRelationship
> relations
,
46 IPostOperationEnabled postOperationEnabled
) {
47 super(label
, undoContext
, taxon
, postOperationEnabled
);
49 taxonRelationships
= relations
;
53 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
57 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
58 throws ExecutionException
{
62 // Remove relation from taxon
63 for(TaxonRelationship relationship
: taxonRelationships
){
64 element
.removeTaxonRelation(relationship
);
69 return postExecute(element
);
73 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
77 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
78 throws ExecutionException
{
79 return execute(monitor
, info
);
83 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
87 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
88 throws ExecutionException
{
90 for(TaxonRelationship relationship
: taxonRelationships
){
91 element
.addTaxonRelation(relationship
);
95 return postExecute(element
);