From 32e465bb26e42e851a36bb5d65c25c862a4153e9 Mon Sep 17 00:00:00 2001
From: Kalle Lampila <kalle.lampila@iki.fi>
Date: Sun, 27 Nov 2011 20:20:51 +0200
Subject: [PATCH] fix #6953 - Make sure that only selectable primitives are
select via validator
Signed-off-by: Kalle Lampila <kalle.lampila@iki.fi>
---
.../josm/data/validation/TestError.java | 16 ++++++++++++++++
.../josm/gui/dialogs/ValidatorDialog.java | 2 +-
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/src/org/openstreetmap/josm/data/validation/TestError.java b/src/org/openstreetmap/josm/data/validation/TestError.java
index 1448d3e..385b902 100644
|
a
|
b
|
import java.util.Collection;
|
| 8 | 8 | import java.util.Collections; |
| 9 | 9 | import java.util.List; |
| 10 | 10 | import java.util.TreeSet; |
| | 11 | import java.util.ArrayList; |
| 11 | 12 | |
| 12 | 13 | import org.openstreetmap.josm.command.Command; |
| 13 | 14 | import org.openstreetmap.josm.data.osm.Node; |
| … |
… |
public class TestError {
|
| 121 | 122 | } |
| 122 | 123 | |
| 123 | 124 | /** |
| | 125 | * Gets the list of primitives affected by this error and are selectable |
| | 126 | * @return the list of selectable primitives affected by this error |
| | 127 | */ |
| | 128 | public Collection<? extends OsmPrimitive> getSelectablePrimitives() { |
| | 129 | List<OsmPrimitive> selectablePrimitives = new ArrayList<OsmPrimitive>(primitives.size()); |
| | 130 | for (OsmPrimitive o : primitives) { |
| | 131 | if (o.isSelectable()) { |
| | 132 | selectablePrimitives.add(o); |
| | 133 | } |
| | 134 | } |
| | 135 | return selectablePrimitives; |
| | 136 | } |
| | 137 | |
| | 138 | |
| | 139 | /** |
| 124 | 140 | * Sets the list of primitives affected by this error |
| 125 | 141 | * @param primitives the list of primitives affected by this error |
| 126 | 142 | */ |
diff --git a/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java b/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
index f28608b..4dffbf4 100644
|
a
|
b
|
public class ValidatorDialog extends ToggleDialog implements ActionListener, Sel
|
| 328 | 328 | Object nodeInfo = childNode.getUserObject(); |
| 329 | 329 | if (nodeInfo instanceof TestError) { |
| 330 | 330 | TestError error = (TestError) nodeInfo; |
| 331 | | sel.addAll(error.getPrimitives()); |
| | 331 | sel.addAll(error.getSelectablePrimitives()); |
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | } |