2,2c2,2 < * @(#)CreationTool.java 5.2 --- > * @(#)CreationTool.java 3a4,9 > * Project: JHotdraw - a GUI framework for technical drawings > * http://www.jhotdraw.org > * http://jhotdraw.sourceforge.net > * Copyright: © by the original author(s) and all contributors > * License: Lesser GNU Public License (LGPL) > * http://www.opensource.org/licenses/lgpl-license.html 9a19,19 > import java.util.Vector; 10,10d13 < 11a15,16 > import CH.ifa.draw.util.UndoableAdapter; > import CH.ifa.draw.util.Undoable; 11,11c14,14 < import CH.ifa.draw.framework.*; --- > import CH.ifa.draw.framework.*; 22a31,31 > * 24a34,35 > * > * @version <$CURRENT_VERSION$> 40a52,57 > * the figure that was actually added > * Note, this can be a different figure from the one which has been created. > */ > private Figure myAddedFigure; > > /** 75a93,93 > setAddedFigure((view().add(getCreatedFigure()))); 76,76c94,94 < fCreatedFigure.displayBox(fAnchorPoint, fAnchorPoint); --- > getAddedFigure().displayBox(fAnchorPoint, fAnchorPoint); 77,77d94 < view().add(fCreatedFigure); 84,84c101,101 < if (fPrototype == null) --- > if (fPrototype == null) { 85a103,103 > } 85,85c102,102 < throw new HJDError("No protoype defined"); --- > throw new JHotDrawRuntimeException("No protoype defined"); 93,93c111,111 < fCreatedFigure.displayBox(fAnchorPoint, new Point(x,y)); --- > getAddedFigure().displayBox(fAnchorPoint, new Point(x,y)); 101a120,131 > if (getCreatedFigure().isEmpty()) { > drawing().remove(getAddedFigure()); > // nothing to undo > setUndoActivity(null); > } > else { > // use undo activity from paste command... > setUndoActivity(createUndoActivity()); > > // put created figure into a figure enumeration > getUndoActivity().setAffectedFigures(new SingleFigureEnumerator(getAddedFigure())); > } 102,103d119 < if (fCreatedFigure.isEmpty()) < drawing().remove(fCreatedFigure); 104a133,133 > setAddedFigure(null); 111,111c140,140 < protected Figure createdFigure() { --- > protected Figure getCreatedFigure() { 113a143,165 > > private void setCreatedFigure(Figure newCreatedFigure) { > fCreatedFigure = newCreatedFigure; > } > > /** > * Gets the figure that was actually added > * Note, this can be a different figure from the one which has been created. > */ > protected Figure getAddedFigure() { > return myAddedFigure; > } > > private void setAddedFigure(Figure newAddedFigure) { > myAddedFigure = newAddedFigure; > } > > /** > * Factory method for undo activity > */ > protected Undoable createUndoActivity() { > return new PasteCommand.UndoActivity(view()); > }