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
.apache
.log4j
.Logger
;
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
.name
.NameRelationship
;
21 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
25 * @created Mar 30, 2010
28 public class DeleteNameRelationOperation
extends AbstractPostOperation
{
31 private static final Logger logger
= Logger
32 .getLogger(DeleteNameRelationOperation
.class);
33 private NameRelationship nameRelationship
;
35 public DeleteNameRelationOperation(String label
, IUndoContext undoContext
, NameRelationship nameRelationship
,
36 IPostOperationEnabled postOperationEnabled
) {
37 super(label
, undoContext
, postOperationEnabled
);
38 this.nameRelationship
= nameRelationship
;
42 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
45 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
46 throws ExecutionException
{
48 TaxonNameBase fromName
= nameRelationship
.getFromName();
50 fromName
.removeRelationToTaxonName(nameRelationship
.getToName());
52 return postExecute(null);
56 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
59 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
60 throws ExecutionException
{
61 return execute(monitor
, info
);
65 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
68 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
69 throws ExecutionException
{
70 // TODO Auto-generated method stub