/** * Undo effect of command. * * @exception CannotUndoException if the command cannot be undone or has not been executed before. */ public void undo() throws CannotUndoException { // the CommandProcessor should prevent us from being called // without a successful prior execute, just be safe here MSystem system = fSystemState.system(); if (system.activeOperation() != fOpCall) throw new CannotUndoException("no undo information"); system.popOperation(); system.setCurrentState(fSystemState); }
/** * Executes command and stores undo information. * * @exception CommandFailedException if the command failed. */ public void execute() throws CommandFailedException { fSystemState.system().enterOperation(fOpCall, new PrintWriter(Log.out())); }