}
public UndoableMapCommand getCommand( EditToolHandler handler, MapMouseEvent e, EventType eventType ) {
try{
PathIterator iter = drawCommand.getShape().getPathIterator(AffineTransform.getTranslateInstance(0,0), 1.0);
UndoableComposite commands=new UndoableComposite();
commands.getCommands().add(handler.getContext().getEditFactory().createNullEditFeatureCommand());
EditBlackboard bb = handler.getEditBlackboard(handler.getEditLayer());
commands.getCommands().add(new DeselectEditGeomCommand(handler, bb.getGeoms()));
ShapeType shapeType = determineLayerType(handler);
CreateEditGeomCommand createEditGeomCommand = new CreateEditGeomCommand(bb, "newShape", shapeType); //$NON-NLS-1$
commands.getCommands().add(createEditGeomCommand);
commands.getCommands().add(EditUtils.instance.appendPathToShape(iter, shapeType, handler, bb, createEditGeomCommand.getShapeProvider()));
commands.getCommands().add( new SetCurrentGeomCommand(handler, createEditGeomCommand.getShapeProvider()));
commands.getCommands().add(handler.getCommand(handler.getAcceptBehaviours()));
commands.getFinalizerCommands().add( new SetEditStateCommand(handler, EditState.NONE));
return commands;
}finally{
drawCommand.setValid(false);
drawCommand=null;
path=null;