Changeset 5169 in josm


Ignore:
Timestamp:
Apr 5, 2012 5:29:22 PM (14 months ago)
Author:
simon04
Message:

(hopefully) fix #7574 - NameTemplate stopped working

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r5164 r5169  
    16921692    } 
    16931693 
     1694    public boolean typeMatches(Collection<PresetType> t) { 
     1695        return t == null || types == null || types.containsAll(t); 
     1696    } 
     1697 
    16941698    public boolean matches(Collection<PresetType> t, Map<String, String> tags, boolean onlyShowable) { 
    16951699        if (onlyShowable && !isShowable()) { 
    16961700            return false; 
    1697         } else if (t != null && types != null && !types.containsAll(t)) { 
     1701        } else if (!typeMatches(t)) { 
    16981702            return false; 
    16991703        } 
  • trunk/src/org/openstreetmap/josm/tools/TaggingPresetNameTemplateList.java

    r5163 r5169  
    22package org.openstreetmap.josm.tools; 
    33 
    4 import java.util.EnumSet; 
     4import java.util.Collection; 
     5import java.util.Collections; 
    56import java.util.LinkedList; 
    67import java.util.List; 
     
    3940 
    4041        for (TaggingPreset t : presetsWithPattern) { 
    41             if (t.matches(EnumSet.of(PresetType.forPrimitive(primitive)), primitive.getKeys(), false)) { 
    42                 return t; 
     42            Collection<PresetType> type = Collections.singleton(PresetType.forPrimitive(primitive)); 
     43            if (t.typeMatches(type)) { 
     44                if (t.nameTemplateFilter != null) { 
     45                    if (t.nameTemplateFilter.match(primitive)) 
     46                        return t; 
     47                    else { 
     48                        continue; 
     49                    } 
     50                } else if (t.matches(type, primitive.getKeys(), false)) { 
     51                    return t; 
     52                } 
    4353            } 
    4454        } 
Note: See TracChangeset for help on using the changeset viewer.