1
|
/**
|
2
|
* Copyright (C) 2015 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
|
package eu.etaxonomy.taxeditor.editor.key.polytomous.operation;
|
10
|
|
11
|
import org.eclipse.core.commands.ExecutionException;
|
12
|
import org.eclipse.core.commands.operations.IUndoContext;
|
13
|
import org.eclipse.core.runtime.IAdaptable;
|
14
|
import org.eclipse.core.runtime.IProgressMonitor;
|
15
|
import org.eclipse.core.runtime.IStatus;
|
16
|
|
17
|
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
|
18
|
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
|
19
|
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
|
20
|
|
21
|
/**
|
22
|
* @author n.hoffmann
|
23
|
*/
|
24
|
public class CreateNodeOperation extends AbstractPostTaxonOperation {
|
25
|
|
26
|
PolytomousKeyNode parentNode;
|
27
|
private PolytomousKeyNode childNode;
|
28
|
|
29
|
public CreateNodeOperation(String label,
|
30
|
IUndoContext undoContext, PolytomousKeyNode parentNode, IPostOperationEnabled postOperationEnabled) {
|
31
|
super(label, undoContext, postOperationEnabled);
|
32
|
this.parentNode = parentNode;
|
33
|
}
|
34
|
|
35
|
@Override
|
36
|
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
|
37
|
throws ExecutionException {
|
38
|
|
39
|
childNode = PolytomousKeyNode.NewInstance();
|
40
|
|
41
|
parentNode.addChild(childNode);
|
42
|
|
43
|
return postExecute(childNode);
|
44
|
}
|
45
|
|
46
|
@Override
|
47
|
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
|
48
|
throws ExecutionException {
|
49
|
return null;
|
50
|
}
|
51
|
|
52
|
@Override
|
53
|
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
|
54
|
throws ExecutionException {
|
55
|
return null;
|
56
|
}
|
57
|
}
|