* @param feature Feature being selected
* @param firstFeature true if this is the first feature returned for selection
*/
public void run( IProgressMonitor monitor, UndoableComposite commands,
SelectionParameter parameters, SimpleFeature feature, boolean firstFeature ) {
EditToolHandler handler = parameters.handler;
Class< ? extends Geometry>[] acceptableClasses = parameters.acceptableClasses;
boolean onlyAdd = parameters.onlyAdd;
MapMouseEvent event = parameters.event;
for( Class< ? extends Geometry> clazz : acceptableClasses ) {
if (clazz.isAssignableFrom(feature.getDefaultGeometry().getClass())) {
EditPlugin.trace(EditPlugin.SELECTION,
"Feature is one of the acceptable classes " + feature.getID(), null); //$NON-NLS-1$
if (firstFeature && !keyboardModifierIndicatesAdd(handler, event) && !onlyAdd ) {
commands.addCommand(handler.getCommand(handler.getAcceptBehaviours()));
commands.addCommand(new SelectFeatureAsEditFeatureCommand(handler, feature,
handler.getEditLayer(), Point.valueOf(event.x, event.y)));
} else {
if (onlyAdd || keyboardModifierIndicatesAdd(handler, event)) {
// call SelectFeaturecommand so that it is the CurrentEditGeom
commands.addCommand(new SelectFeatureCommand(handler, feature, Point
.valueOf(event.x, event.y)));