Finalizing PolytomousKeyListEditor
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / key / polytomous / operation / DeleteNodeOperation.java
index d4cc5ddb466e6bd2772c81acedaeb14e4e919f0f..dc054de2ef665819867a72509840b0edf4e498c5 100644 (file)
@@ -9,51 +9,61 @@ import org.eclipse.core.runtime.IAdaptable;
 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)