1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.editor.name.operation;
|
11
|
|
12
|
import org.eclipse.core.commands.ExecutionException;
|
13
|
import org.eclipse.core.commands.operations.IUndoContext;
|
14
|
import org.eclipse.core.runtime.IAdaptable;
|
15
|
import org.eclipse.core.runtime.IProgressMonitor;
|
16
|
import org.eclipse.core.runtime.IStatus;
|
17
|
|
18
|
import eu.etaxonomy.cdm.model.name.NameRelationship;
|
19
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
20
|
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
|
21
|
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
|
22
|
|
23
|
/**
|
24
|
* <p>DeleteNameRelationOperation class.</p>
|
25
|
*
|
26
|
* @author n.hoffmann
|
27
|
* @created Mar 30, 2010
|
28
|
*/
|
29
|
public class DeleteNameRelationOperation extends AbstractPostTaxonOperation {
|
30
|
|
31
|
private NameRelationship nameRelationship;
|
32
|
|
33
|
/**
|
34
|
* <p>Constructor for DeleteNameRelationOperation.</p>
|
35
|
*
|
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.operation.IPostOperationEnabled} object.
|
40
|
*/
|
41
|
public DeleteNameRelationOperation(String label, IUndoContext undoContext, NameRelationship nameRelationship,
|
42
|
IPostOperationEnabled postOperationEnabled) {
|
43
|
super(label, undoContext, postOperationEnabled);
|
44
|
this.nameRelationship = nameRelationship;
|
45
|
}
|
46
|
|
47
|
/** {@inheritDoc} */
|
48
|
@Override
|
49
|
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
|
50
|
throws ExecutionException {
|
51
|
|
52
|
TaxonName fromName = nameRelationship.getFromName();
|
53
|
|
54
|
fromName.removeRelationToTaxonName(nameRelationship.getToName());
|
55
|
|
56
|
return postExecute(null);
|
57
|
}
|
58
|
|
59
|
/** {@inheritDoc} */
|
60
|
@Override
|
61
|
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
|
62
|
throws ExecutionException {
|
63
|
return execute(monitor, info);
|
64
|
}
|
65
|
|
66
|
/** {@inheritDoc} */
|
67
|
@Override
|
68
|
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
|
69
|
throws ExecutionException {
|
70
|
// TODO Auto-generated method stub
|
71
|
return null;
|
72
|
}
|
73
|
}
|