@Override public void execute() { fOldPos = fOldParent .getElements() .indexOf(fElement); // do this here as its part of a compound command redo(); }
@Override public void redo() { fOldParent.getElements().remove(fElement); fNewParent.getElements().add(fElement); }
@Override public void undo() { fNewParent.getElements().remove(fElement); fOldParent.getElements().add(fOldPos, fElement); }