diff --git a/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java b/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java
index 84640adca..99a07119f 100644
|
a
|
b
|
import org.openstreetmap.josm.data.osm.history.HistoryRelation;
|
| 30 | 30 | import org.openstreetmap.josm.data.osm.history.HistoryWay; |
| 31 | 31 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; |
| 32 | 32 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetNameTemplateList; |
| | 33 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; |
| 33 | 34 | import org.openstreetmap.josm.spi.preferences.Config; |
| 34 | 35 | import org.openstreetmap.josm.tools.AlphanumComparator; |
| 35 | 36 | import org.openstreetmap.josm.tools.I18n; |
| … |
… |
public class DefaultNameFormatter implements NameFormatter, HistoryNameFormatter
|
| 174 | 175 | if (n == null) { |
| 175 | 176 | n = formatAddress(node); |
| 176 | 177 | } |
| | 178 | if (n == null) { |
| | 179 | n = formatMatchingPreset(node); |
| | 180 | } |
| 177 | 181 | |
| 178 | 182 | if (n == null) { |
| 179 | 183 | n = node.isNew() ? tr("node") : Long.toString(node.getId()); |
| … |
… |
public class DefaultNameFormatter implements NameFormatter, HistoryNameFormatter
|
| 230 | 234 | if (n == null) { |
| 231 | 235 | n = way.get("ref"); |
| 232 | 236 | } |
| 233 | | if (n == null) { |
| 234 | | n = way.hasKey("highway") ? tr("highway") : |
| 235 | | way.hasKey("railway") ? tr("railway") : |
| 236 | | way.hasKey("waterway") ? tr("waterway") : |
| 237 | | way.hasKey("landuse") ? tr("landuse") : null; |
| 238 | | } |
| 239 | 237 | if (n == null) { |
| 240 | 238 | n = formatAddress(way); |
| 241 | 239 | } |
| 242 | | if (n == null && way.hasKey("building")) { |
| 243 | | n = tr("building"); |
| | 240 | if (n == null) { |
| | 241 | n = formatMatchingPreset(way); |
| 244 | 242 | } |
| 245 | 243 | if (n == null || n.isEmpty()) { |
| 246 | 244 | n = String.valueOf(way.getId()); |
| … |
… |
public class DefaultNameFormatter implements NameFormatter, HistoryNameFormatter
|
| 305 | 303 | return n; |
| 306 | 304 | } |
| 307 | 305 | |
| | 306 | private String formatMatchingPreset(IPrimitive osm) { |
| | 307 | Collection<TaggingPreset> presets = TaggingPresets.getMatchingPresets(osm); |
| | 308 | if (!presets.isEmpty()) { |
| | 309 | TaggingPreset taggingPreset = presets.iterator().next(); |
| | 310 | return taggingPreset.group != null |
| | 311 | ? taggingPreset.group.getLocaleName() + "/" + taggingPreset.getLocaleName() |
| | 312 | : taggingPreset.getLocaleName(); |
| | 313 | } |
| | 314 | return null; |
| | 315 | } |
| | 316 | |
| 308 | 317 | private final Comparator<IWay<?>> wayComparator = Comparator.comparing(this::format); |
| 309 | 318 | |
| 310 | 319 | @Override |