Ignore:
Timestamp:
2014-01-17T19:36:31+01:00 (10 years ago)
Author:
Don-vip
Message:

fix #6633 - Needless 'No conflicts to resolve' dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtil.java

    r6362 r6715  
    22package org.openstreetmap.josm.gui.conflict.tags;
    33
     4import java.util.ArrayList;
    45import java.util.Collection;
    56
     
    2526     *  For tags which are not present on at least one of the merged nodes, the empty value ""
    2627     *  is added to the list of values for this tag, but only if there are at least two
    27      *  primitives with tags.
     28     *  primitives with tags, and at least one tagged primitive do not have this tag.
    2829     *
    2930     * @param tc the tag collection
    30      * @param merged the collection of merged  primitives
     31     * @param merged the collection of merged primitives
    3132     */
    3233    public static void normalizeTagCollectionBeforeEditing(TagCollection tc, Collection<? extends OsmPrimitive> merged) {
     
    3738        }
    3839
    39         int numNodesWithTags = 0;
     40        Collection<OsmPrimitive> taggedPrimitives = new ArrayList<OsmPrimitive>();
    4041        for (OsmPrimitive p: merged) {
    41             if (!p.getKeys().isEmpty()) {
    42                 numNodesWithTags++;
     42            if (p.isTagged()) {
     43                taggedPrimitives.add(p);
    4344            }
    4445        }
    45         if (numNodesWithTags <= 1)
     46        if (taggedPrimitives.size() <= 1)
    4647            return;
    4748
     
    5051            // on all merged nodes
    5152            //
    52             for (OsmPrimitive p: merged) {
     53            for (OsmPrimitive p: taggedPrimitives) {
    5354                if (p.get(key) == null) {
    5455                    tc.add(new Tag(key, "")); // add a tag with key and empty value
Note: See TracChangeset for help on using the changeset viewer.