import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
/**
* @author n.hoffmann
- *
+ *
*/
public class DeleteNodeOperation extends AbstractPostOperation {
- private PolytomousKeyNode node;
- private PolytomousKey key;
+ private final PolytomousKeyNode parent;
+ private final PolytomousKeyNode node;
- public DeleteNodeOperation(String label,
- IUndoContext undoContext, PolytomousKeyNode node, IPostOperationEnabled postOperationEnabled) {
+ public DeleteNodeOperation(String label, IUndoContext undoContext,
+ PolytomousKeyNode node, IPostOperationEnabled postOperationEnabled) {
super(label, undoContext, postOperationEnabled);
this.node = node;
+ this.parent = node.getParent();
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse
+ * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
*/
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
-
- key = node.getKey();
-
-
+
+ parent.removeChild(node);
+
return postExecute(null);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse
+ * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
*/
@Override
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- // TODO Auto-generated method stub
- return null;
+ return execute(monitor, info);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse
+ * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
*/
@Override
public IStatus undo(IProgressMonitor monitor, IAdaptable info)