Changeset 16549 in josm


Ignore:
Timestamp:
2020-06-07T12:37:32+02:00 (4 years ago)
Author:
simon04
Message:

fix #16255 - Possibility to edit relation roles from the membership dialog

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

Legend:

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

    r16441 r16549  
    1717import java.util.Arrays;
    1818import java.util.Collection;
     19import java.util.Collections;
    1920import java.util.EnumSet;
    2021import java.util.HashMap;
     
    2324import java.util.Map;
    2425import java.util.Map.Entry;
    25 import java.util.Optional;
    2626import java.util.Set;
    2727import java.util.TreeMap;
     
    673673                if (ref instanceof IRelation && !ref.isIncomplete() && !ref.isDeleted()) {
    674674                    IRelation<?> r = (IRelation<?>) ref;
    675                     MemberInfo mi = Optional.ofNullable(roles.get(r)).orElseGet(() -> new MemberInfo(newSel));
    676                     roles.put(r, mi);
     675                    MemberInfo mi = roles.computeIfAbsent(r, ignore -> new MemberInfo(newSel));
    677676                    int i = 1;
    678677                    for (IRelationMember<?> m : r.getMembers()) {
     
    975974            } else if (e.getSource() == membershipTable) {
    976975                int row = membershipTable.rowAtPoint(e.getPoint());
    977                 if (row > -1) {
     976                int col = membershipTable.columnAtPoint(e.getPoint());
     977                if (row > -1 && col == 1) {
     978                    final Relation relation = (Relation) membershipData.getValueAt(row, 0);
     979                    final MemberInfo memberInfo = (MemberInfo) membershipData.getValueAt(row, 1);
     980                    RelationRoleEditor.editRole(relation, memberInfo);
     981                } else if (row > -1) {
    978982                    editMembership(row);
    979983                }
     
    10241028            }
    10251029            return Utils.shortenString(positionString, 20);
     1030        }
     1031
     1032        List<IRelationMember<?>> getRole() {
     1033            return Collections.unmodifiableList(role);
    10261034        }
    10271035
Note: See TracChangeset for help on using the changeset viewer.