From 49ecfd9b8c8e30b6621a68cb5a1b5d65ccd02a12 Mon Sep 17 00:00:00 2001
From: Kalle Lampila <kalle.lampila@iki.fi>
Date: Thu, 15 Dec 2011 21:30:43 +0200
Subject: [PATCH] fix #7148 - Make sure that only selectable items are
selected
Signed-off-by: Kalle Lampila <kalle.lampila@iki.fi>
---
src/org/openstreetmap/josm/data/osm/DataSet.java | 2 +-
.../josm/gui/dialogs/SelectionListDialog.java | 24 +++++++++++++------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/org/openstreetmap/josm/data/osm/DataSet.java b/src/org/openstreetmap/josm/data/osm/DataSet.java
index c25d884..61b2f9c 100644
a
|
b
|
public class DataSet implements Cloneable, ProjectionChangeListener {
|
643 | 643 | synchronized (selectionLock) { |
644 | 644 | for (PrimitiveId id: selection) { |
645 | 645 | OsmPrimitive primitive = getPrimitiveByIdChecked(id); |
646 | | if (primitive != null) { |
| 646 | if (primitive != null && primitive.isSelectable()) { |
647 | 647 | changed = changed | selectedPrimitives.add(primitive); |
648 | 648 | } |
649 | 649 | } |
diff --git a/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java b/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
index cb44697..17d9408 100644
a
|
b
|
public class SelectionListDialog extends ToggleDialog {
|
763 | 763 | int nodes = 0; |
764 | 764 | int relations = 0; |
765 | 765 | for (OsmPrimitive o : sel) { |
766 | | if (o instanceof Way) { |
767 | | ways++; |
768 | | } else if (o instanceof Node) { |
769 | | nodes++; |
770 | | } else if (o instanceof Relation) { |
771 | | relations++; |
| 766 | if (o.isSelectable()) { |
| 767 | if (o instanceof Way) { |
| 768 | ways++; |
| 769 | } else if (o instanceof Node) { |
| 770 | nodes++; |
| 771 | } else if (o instanceof Relation) { |
| 772 | relations++; |
| 773 | } |
772 | 774 | } |
773 | 775 | } |
774 | 776 | StringBuffer text = new StringBuffer(); |
… |
… |
public class SelectionListDialog extends ToggleDialog {
|
784 | 786 | text.append(text.length() > 0 ? ", " : "") |
785 | 787 | .append(trn("{0} relation", "{0} relations", relations, relations)); |
786 | 788 | } |
787 | | if(ways + nodes + relations == 1) |
| 789 | if(ways + nodes + relations == 0) |
| 790 | { |
| 791 | setText(tr("None")); |
| 792 | setEnabled(false); |
| 793 | } else if(ways + nodes + relations == 1) |
788 | 794 | { |
789 | 795 | text.append(": "); |
790 | 796 | for(OsmPrimitive o : sel) { |
791 | | text.append(o.getDisplayName(df)); |
| 797 | if (o.isSelectable()) { |
| 798 | text.append(o.getDisplayName(df)); |
| 799 | } |
792 | 800 | } |
793 | 801 | setText(text.toString()); |
794 | 802 | } else { |