Ignore:
Timestamp:
2012-04-16T22:53:07+02:00 (12 years ago)
Author:
simon04
Message:

tagging presets: fix customized matching for combo elements (broken due to r5172), remove duplicated/inconsistent parsing/interpreting of preset values

File:
1 edited

Legend:

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

    r4869 r5196  
    149149        for (final TaggingPreset p : presets) {
    150150            for (TaggingPreset.Item item : p.data) {
    151                 if (item instanceof TaggingPreset.Check) {
    152                     TaggingPreset.Check ch = (TaggingPreset.Check) item;
    153                     if (ch.key == null) {
     151                if (item instanceof TaggingPreset.KeyedItem) {
     152                    TaggingPreset.KeyedItem ki = (TaggingPreset.KeyedItem) item;
     153                    if (ki.key == null) {
    154154                        continue;
    155155                    }
    156                     presetTagCache.put(ch.key, OsmUtils.falseval);
    157                     presetTagCache.put(ch.key, OsmUtils.trueval);
    158                 } else if (item instanceof TaggingPreset.Combo) {
    159                     TaggingPreset.Combo co = (TaggingPreset.Combo) item;
    160                     if (co.key == null || co.values == null) {
    161                         continue;
    162                     }
    163                     for (String value : co.values.split(",")) {
    164                         presetTagCache.put(co.key, value);
    165                     }
    166                 } else if (item instanceof TaggingPreset.Key) {
    167                     TaggingPreset.Key ky = (TaggingPreset.Key) item;
    168                     if (ky.key == null || ky.value == null) {
    169                         continue;
    170                     }
    171                     presetTagCache.put(ky.key, ky.value);
    172                 } else if (item instanceof TaggingPreset.Text) {
    173                     TaggingPreset.Text tt = (TaggingPreset.Text) item;
    174                     if (tt.key == null) {
    175                         continue;
    176                     }
    177                     presetTagCache.putVoid(tt.key);
    178                     if (tt.default_ != null && !tt.default_.equals("")) {
    179                         presetTagCache.put(tt.key, tt.default_);
    180                     }
     156                    presetTagCache.putAll(ki.key, ki.getValues());
    181157                } else if (item instanceof TaggingPreset.Roles) {
    182158                    TaggingPreset.Roles r = (TaggingPreset.Roles) item;
     
    266242     *
    267243     * @param list the list to populate
    268      * @param key the tag keys
     244     * @param keys the tag keys
    269245     */
    270246    public void populateWithTagValues(AutoCompletionList list, List<String> keys) {
Note: See TracChangeset for help on using the changeset viewer.