/** Since this is an add operation, figures can only be released if it has been undone. */ public void release() { if (undone == true) { FigureEnumeration fe = getAffectedFigures(); while (fe.hasNextFigure()) { Figure f = fe.nextFigure(); getDrawingView().drawing().remove(f); f.release(); } } setAffectedFigures(CH.ifa.draw.standard.FigureEnumerator.getEmptyEnumeration()); }
public boolean undo() { if (!super.undo()) { return false; } // undo of add really shouldnt need visitor !?!dnoyeb!?! log("AddUndoActivity AddUndoActivity undo"); DeleteFromDrawingVisitor deleteVisitor = new DeleteFromDrawingVisitor(getDrawingView().drawing()); FigureEnumeration fe = getAffectedFigures(); while (fe.hasNextFigure()) { CH.ifa.draw.framework.Figure f = fe.nextFigure(); f.visit(deleteVisitor); } setAffectedFigures(deleteVisitor.getDeletedFigures()); getDrawingView().clearSelection(); undone = true; return true; }