4 package eu
.etaxonomy
.taxeditor
.editor
.key
.polytomous
.operation
;
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 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
13 import eu
.etaxonomy
.cdm
.api
.application
.ICdmApplicationConfiguration
;
14 import eu
.etaxonomy
.cdm
.api
.service
.IPolytomousKeyNodeService
;
15 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
16 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
17 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
18 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
24 public class DeleteNodeOperation
extends AbstractPostTaxonOperation
{
26 private final PolytomousKeyNode parent
;
27 private final PolytomousKeyNode node
;
29 public DeleteNodeOperation(String label
, IUndoContext undoContext
,
30 PolytomousKeyNode node
, IPostOperationEnabled postOperationEnabled
) {
31 super(label
, undoContext
, postOperationEnabled
);
33 this.parent
= node
.getParent();
40 * org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse
41 * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
44 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
45 throws ExecutionException
{
47 //parent.removeChild(node);
48 ICdmApplicationConfiguration controller
;
50 controller
= CdmStore
.getCurrentApplicationConfiguration();
52 IPolytomousKeyNodeService service
= controller
.getPolytomousKeyNodeService();
54 if (node
.getChildren().size()>0){
55 if(! MessageDialog
.openQuestion(null, "Confirm deletion of children", "The selected node has children, do you want to delete them, too?")) {
56 service
.delete(node
.getUuid(), false);
58 service
.delete(node
.getUuid(), true);
61 service
.delete(node
.getUuid(), true);
63 return postExecute(null);
70 * org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse
71 * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
74 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
75 throws ExecutionException
{
76 return execute(monitor
, info
);
83 * org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse
84 * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
87 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
88 throws ExecutionException
{
89 // TODO Auto-generated method stub