merge-update from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / key / polytomous / operation / CreateNodeOperation.java
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.AbstractPostTaxonOperation;
14 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
15
16 /**
17 * @author n.hoffmann
18 *
19 */
20 public class CreateNodeOperation extends AbstractPostTaxonOperation {
21
22 PolytomousKeyNode parentNode;
23 private PolytomousKeyNode childNode;
24
25 public CreateNodeOperation(String label,
26 IUndoContext undoContext, PolytomousKeyNode parentNode, IPostOperationEnabled postOperationEnabled) {
27 super(label, undoContext, postOperationEnabled);
28 this.parentNode = parentNode;
29 }
30
31 /* (non-Javadoc)
32 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
33 */
34 @Override
35 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
36 throws ExecutionException {
37
38 childNode = PolytomousKeyNode.NewInstance();
39
40 parentNode.addChild(childNode);
41
42 return postExecute(childNode);
43 }
44
45 /* (non-Javadoc)
46 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
47 */
48 @Override
49 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
50 throws ExecutionException {
51 // TODO Auto-generated method stub
52 return null;
53 }
54
55 /* (non-Javadoc)
56 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
57 */
58 @Override
59 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
60 throws ExecutionException {
61 // TODO Auto-generated method stub
62 return null;
63 }
64
65 }