* Return primitives that are affected by some command
* @param path GUI elements
* @return collection of affected primitives, onluy usable ones
*/
protected static FilteredCollection<OsmPrimitive> getAffectedPrimitives(TreePath path) {
PseudoCommand c = ((CommandListMutableTreeNode) path.getLastPathComponent()).getCommand();
final OsmDataLayer currentLayer = Main.main.getEditLayer();
return new FilteredCollection<>(
c.getParticipatingPrimitives(),
new Predicate<OsmPrimitive>(){
@Override
public boolean evaluate(OsmPrimitive o) {
OsmPrimitive p = currentLayer.data.getPrimitiveById(o);
return p != null && p.isUsable();