if( type==ShapeType.POLYGON && EditPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.P_FILL_POLYGONS) ){
drawShapeCommand.setFill(PreferenceUtil.instance().getDrawGeomsFill());
}
EditBlackboard blackboard = editBlackboard;
PrimitiveShape currentShape = handler.getCurrentShape();
if (currentShape == null) {
UndoableComposite undoableComposite = startNewShape(handler, blackboard);
return undoableComposite;
}
currentShape=currentShape.getEditGeom().getShell();
//if current shape is a line and point matches up with one of the end points then
// continue line.
if( currentShape.getEditGeom().getShapeType()==ShapeType.LINE ){
if( currentShape.getNumPoints()>0 && nearestPoint.equals(currentShape.getPoint(0)) ){
// over the first end point so reverse order and return;
EditUtils.instance.reverseOrder(currentShape);
return null;
}
if( currentShape.getNumPoints()>1 && !nearestPoint.equals(currentShape.getPoint(currentShape.getNumPoints()-1)) ){
// not over one of the end points
return createNewGeom(handler);
}
return null;
}
if (currentShape.getEditGeom().getShapeType()==ShapeType.POINT) {
// it's a point create a new point.
return createNewGeom(handler);
}else{
if (currentShape.contains(nearestPoint, true)) {
if (handler.getCurrentGeom().getShell() == currentShape) {
for( PrimitiveShape hole : handler.getCurrentGeom().getHoles() ) {
if (hole.contains(nearestPoint, true)) {
return createNewGeom(handler);
}