Changeset 15376 in josm


Ignore:
Timestamp:
2019-09-26T17:14:19+02:00 (5 years ago)
Author:
Don-vip
Message:

see #14465 - allow plugins to retrieve selected tags with multiple values

Location:
trunk/src/org/openstreetmap/josm
Files:
1 added
1 edited

Legend:

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

    r15356 r15376  
    7070import org.openstreetmap.josm.data.osm.RelationMember;
    7171import org.openstreetmap.josm.data.osm.Tag;
     72import org.openstreetmap.josm.data.osm.Tags;
    7273import org.openstreetmap.josm.data.osm.Way;
    7374import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent;
     
    714715
    715716    /**
    716      * Returns the selected tag.
     717     * Returns the selected tag. Value is empty if several tags are selected for a given key.
    717718     * @return The current selected tag
    718719     */
    719720    public Tag getSelectedProperty() {
     721        Tags tags = getSelectedProperties();
     722        return tags == null ? null : new Tag(
     723                tags.getKey(),
     724                tags.getValues().size() > 1 ? "" : tags.getValues().iterator().next());
     725    }
     726
     727    /**
     728     * Returns the selected tags. Contains all values if several are selected for a given key.
     729     * @return The current selected tags
     730     * @since 15376
     731     */
     732    public Tags getSelectedProperties() {
    720733        int row = tagTable.getSelectedRow();
    721734        if (row == -1) return null;
    722735        Map<String, Integer> map = editHelper.getDataValues(row);
    723         return new Tag(
    724                 editHelper.getDataKey(row),
    725                 map.size() > 1 ? "" : map.keySet().iterator().next());
     736        return new Tags(editHelper.getDataKey(row), map.keySet());
    726737    }
    727738
Note: See TracChangeset for help on using the changeset viewer.