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
.model
.name
.NameRelationship
;
20 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
23 * <p>DeleteNameRelationOperation class.</p>
26 * @created Mar 30, 2010
29 public class DeleteNameRelationOperation
extends AbstractPostOperation
{
31 private NameRelationship nameRelationship
;
34 * <p>Constructor for DeleteNameRelationOperation.</p>
36 * @param label a {@link java.lang.String} object.
37 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
38 * @param nameRelationship a {@link eu.etaxonomy.cdm.model.name.NameRelationship} object.
39 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operations.IPostOperationEnabled} object.
41 public DeleteNameRelationOperation(String label
, IUndoContext undoContext
, NameRelationship nameRelationship
,
42 IPostOperationEnabled postOperationEnabled
) {
43 super(label
, undoContext
, postOperationEnabled
);
44 this.nameRelationship
= nameRelationship
;
48 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
52 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
53 throws ExecutionException
{
55 TaxonNameBase fromName
= nameRelationship
.getFromName();
57 fromName
.removeRelationToTaxonName(nameRelationship
.getToName());
59 return postExecute(null);
63 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
67 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
68 throws ExecutionException
{
69 return execute(monitor
, info
);
73 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
77 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
78 throws ExecutionException
{
79 // TODO Auto-generated method stub