Changeset 8581 in josm


Ignore:
Timestamp:
2015-07-07T23:45:23+02:00 (9 years ago)
Author:
Don-vip
Message:

fix #11664 - fix regression of r8566 for relation editor

File:
1 edited

Legend:

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

    r8510 r8581  
    3131 *
    3232 */
    33 @SuppressWarnings("serial")
    3433public class TagEditorModel extends AbstractTableModel {
    3534    public static final String PROP_DIRTY = TagEditorModel.class.getName() + ".dirty";
     
    407406     */
    408407    public void applyToPrimitive(Tagged primitive) {
    409         Map<String, String> tags = primitive.getKeys();
    410         applyToTags(tags, false);
    411         primitive.setKeys(tags);
     408        primitive.setKeys(applyToTags(false));
    412409    }
    413410
     
    415412     * applies the current state of the tag editor model to a map of tags
    416413     *
    417      * @param tags the map of key/value pairs
    418      *
    419      */
    420     public void applyToTags(Map<String, String> tags, boolean keepEmpty) {
    421         tags.clear();
     414     * @return the map of key/value pairs
     415     */
     416    private Map<String, String> applyToTags(boolean keepEmpty) {
     417        Map<String, String> result = new HashMap<>();
    422418        for (TagModel tag: this.tags) {
    423419            // tag still holds an unchanged list of different values for the same key.
     
    432428                continue;
    433429            }
    434             tags.put(tag.getName().trim(), tag.getValue().trim());
    435         }
     430            result.put(tag.getName().trim(), tag.getValue().trim());
     431        }
     432        return result;
    436433    }
    437434
     
    441438
    442439    public Map<String, String> getTags(boolean keepEmpty) {
    443         Map<String, String> tags = new HashMap<>();
    444         applyToTags(tags, keepEmpty);
    445         return tags;
     440        return applyToTags(keepEmpty);
    446441    }
    447442
Note: See TracChangeset for help on using the changeset viewer.