Changeset 11804 in josm


Ignore:
Timestamp:
2017-04-01T00:10:42+02:00 (7 years ago)
Author:
Don-vip
Message:

fix #14527 - Add Tag - last entry disabled for partial dataset

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r11747 r11804  
    197197    }
    198198
     199    /**
     200     * Determines if the given tag key is already used (by all selected primitives, not just some of them)
     201     * @param key the key to check
     202     * @return {@code true} if the key is used by all selected primitives (key not unset for at least one primitive)
     203     */
     204    @SuppressWarnings("unchecked")
    199205    private boolean containsDataKey(String key) {
    200206        return IntStream.range(0, tagData.getRowCount())
    201                 .mapToObj(i -> tagData.getValueAt(i, 0) /* sic! do not use getDataKey*/)
    202                 .anyMatch(key::equals);
     207                .filter(i -> key.equals(tagData.getValueAt(i, 0)) /* sic! do not use getDataKey*/
     208                    && !((Map<String, Integer>) tagData.getValueAt(i, 1)).containsKey("") /* sic! do not use getDataValues*/)
     209                .findAny().isPresent();
    203210    }
    204211
     
    866873            for (int i = 0; i < tags.size() && count < tagsToShow; i++) {
    867874                final Tag t = tags.get(i);
    868                 boolean keyExists = keyExists(t);
     875                boolean keyExists = containsDataKey(t.getKey());
    869876                if (keyExists && PROPERTY_RECENT_EXISTING.get() == RecentExisting.HIDE)
    870877                    continue;
     
    10741081        }
    10751082
    1076         private boolean keyExists(final Tag t) {
    1077             return valueCount.containsKey(t.getKey());
    1078         }
    1079 
    10801083        private void refreshRecentTags() {
    10811084            switch (PROPERTY_REFRESH_RECENT.get()) {
Note: See TracChangeset for help on using the changeset viewer.