I have spotted a strange behaviour while working with udig 1.2m9. I guess it is a bug and here are the steps to reproduce it:
1. Open a shapefile of point geometry and choose the layer
2. Use point tool
3. Add a point to the layer
4. Choose the added point with the edit geometry tool and drag drop it on the layer
5. Choose an empty point in layer
6. It is a good chance you lost the added point, in this case redraw map
7. Iterate over steps 4-6 a couple of times
8. Redraw map
9. Even if you have added a single point, it is drawn multiple times on the map
I have tried this issue with city.shp and temporary layers, both give the same behaviour.
I have tracked down the issue and it seems that the the spatial index which is activated in RefreshTool is never refreshed truely because a move operation in udig(AFAIK) corresponds to a remove and add operation regarding to the code in org.geotools.data.Diff class. Here the modify method removes the feature from index and adds the new location. The problem here is the old location is changed to new location before this step. So the spatial index searches with the new coordinates thus lacks to find the position and cannot remove it.
To correct this behavior I have changed the SetAttributeCommand.java -> run()
from this:
this.oldValue = feature2.getAttribute(xpath);
feature2.setAttribute(xpath, value);
AttributeDescriptor attributeType = layer.getSchema().getDescriptor(xpath);
resource.modifyFeatures(attributeType, value, fidFilter);
to this:
this.oldValue = feature2.getAttribute(xpath);
AttributeDescriptor attributeType = layer.getSchema().getDescriptor(xpath);
resource.modifyFeatures(attributeType, value, fidFilter);
feature2.setAttribute(xpath, value);