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
.editor
.name
.operation
;
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
;
21 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
22 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
25 * <p>DeleteNameRelationOperation class.</p>
28 * @created Mar 30, 2010
31 public class DeleteNameRelationOperation
extends AbstractPostTaxonOperation
{
33 private NameRelationship nameRelationship
;
36 * <p>Constructor for DeleteNameRelationOperation.</p>
38 * @param label a {@link java.lang.String} object.
39 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
40 * @param nameRelationship a {@link eu.etaxonomy.cdm.model.name.NameRelationship} object.
41 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
43 public DeleteNameRelationOperation(String label
, IUndoContext undoContext
, NameRelationship nameRelationship
,
44 IPostOperationEnabled postOperationEnabled
) {
45 super(label
, undoContext
, postOperationEnabled
);
46 this.nameRelationship
= nameRelationship
;
50 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
54 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
55 throws ExecutionException
{
57 TaxonNameBase fromName
= nameRelationship
.getFromName();
59 fromName
.removeRelationToTaxonName(nameRelationship
.getToName());
61 return postExecute(null);
65 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
69 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
70 throws ExecutionException
{
71 return execute(monitor
, info
);
75 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
79 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
80 throws ExecutionException
{
81 // TODO Auto-generated method stub