1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.etaxonomy.taxeditor.editor.key.polytomous.operation;
|
5
|
|
6
|
import org.eclipse.core.commands.ExecutionException;
|
7
|
import org.eclipse.core.commands.operations.IUndoContext;
|
8
|
import org.eclipse.core.runtime.IAdaptable;
|
9
|
import org.eclipse.core.runtime.IProgressMonitor;
|
10
|
import org.eclipse.core.runtime.IStatus;
|
11
|
|
12
|
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
|
13
|
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
|
14
|
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
|
15
|
|
16
|
/**
|
17
|
* @author n.hoffmann
|
18
|
*
|
19
|
*/
|
20
|
public class DeleteNodeOperation extends AbstractPostOperation {
|
21
|
|
22
|
private final PolytomousKeyNode parent;
|
23
|
private final PolytomousKeyNode node;
|
24
|
|
25
|
public DeleteNodeOperation(String label, IUndoContext undoContext,
|
26
|
PolytomousKeyNode node, IPostOperationEnabled postOperationEnabled) {
|
27
|
super(label, undoContext, postOperationEnabled);
|
28
|
this.node = node;
|
29
|
this.parent = node.getParent();
|
30
|
}
|
31
|
|
32
|
/*
|
33
|
* (non-Javadoc)
|
34
|
*
|
35
|
* @see
|
36
|
* org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse
|
37
|
* .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
38
|
*/
|
39
|
@Override
|
40
|
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
|
41
|
throws ExecutionException {
|
42
|
|
43
|
parent.removeChild(node);
|
44
|
|
45
|
return postExecute(null);
|
46
|
}
|
47
|
|
48
|
/*
|
49
|
* (non-Javadoc)
|
50
|
*
|
51
|
* @see
|
52
|
* org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse
|
53
|
* .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
54
|
*/
|
55
|
@Override
|
56
|
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
|
57
|
throws ExecutionException {
|
58
|
return execute(monitor, info);
|
59
|
}
|
60
|
|
61
|
/*
|
62
|
* (non-Javadoc)
|
63
|
*
|
64
|
* @see
|
65
|
* org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse
|
66
|
* .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
67
|
*/
|
68
|
@Override
|
69
|
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
|
70
|
throws ExecutionException {
|
71
|
// TODO Auto-generated method stub
|
72
|
return null;
|
73
|
}
|
74
|
|
75
|
}
|