public boolean execute ( Canvas target , Menu menu , MenuItem item ) { FeatureTransaction featureTransaction = mapWidget . getMapModel ( ) . getFeatureEditor ( ) . getFeatureTransaction ( ) ; if ( featureTransaction != null ) { boolean operationCount = featureTransaction . getOperationQueue ( ) . size ( ) > 0 ; if ( operationCount ) { // The first addCoordinateOp may not be undone! FeatureOperation firstOperation = featureTransaction . getOperationQueue ( ) . get ( 0 ) ; if ( firstOperation instanceof AddCoordinateOp ) { if ( featureTransaction . getNewFeatures ( ) [ 0 ] . getGeometry ( ) . getNumPoints ( ) == 1 ) { return false ; } } return true ; } } return false ; }
This function tries to find out whether or not this menu item should be enabled . Only if there are more then 1 operations in the feature transaction operation queue will this menu item be enabled .