Changeset 15240 in josm


Ignore:
Timestamp:
2019-07-10T23:58:43+02:00 (6 days ago)
Author:
Don-vip
Message:

fix #17910 - Enable download of incomplete members from cloned relations in relation editor

Location:
trunk/src/org/openstreetmap/josm/gui/dialogs/relation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r15238 r15240  
    2020import javax.swing.table.AbstractTableModel;
    2121
     22import org.openstreetmap.josm.data.osm.AbstractPrimitive;
    2223import org.openstreetmap.josm.data.osm.DataSelectionListener;
    2324import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    381382     */
    382383    public Set<OsmPrimitive> getIncompleteMemberPrimitives() {
    383         Set<OsmPrimitive> ret = new HashSet<>();
    384         for (RelationMember member : members) {
    385             if (member.getMember().isIncomplete()) {
    386                 ret.add(member.getMember());
    387             }
    388         }
    389         return ret;
     384        return members.stream().map(RelationMember::getMember).filter(AbstractPrimitive::isIncomplete).collect(Collectors.toSet());
    390385    }
    391386
     
    396391     */
    397392    public Set<OsmPrimitive> getSelectedIncompleteMemberPrimitives() {
    398         Set<OsmPrimitive> ret = new HashSet<>();
    399         for (RelationMember member : getSelectedMembers()) {
    400             if (member.getMember().isIncomplete()) {
    401                 ret.add(member.getMember());
    402             }
    403         }
    404         return ret;
     393        return getSelectedMembers().stream().map(RelationMember::getMember).filter(AbstractPrimitive::isIncomplete).collect(Collectors.toSet());
    405394    }
    406395
     
    411400     */
    412401    public boolean hasIncompleteMembers() {
    413         for (RelationMember member : members) {
    414             if (member.getMember().isIncomplete())
    415                 return true;
    416         }
    417         return false;
     402        return members.stream().anyMatch(rm -> rm.getMember().isIncomplete());
    418403    }
    419404
     
    424409     */
    425410    public boolean hasIncompleteSelectedMembers() {
    426         for (RelationMember member : getSelectedMembers()) {
    427             if (member.getMember().isIncomplete())
    428                 return true;
    429         }
    430         return false;
     411        return getSelectedMembers().stream().anyMatch(rm -> rm.getMember().isIncomplete());
    431412    }
    432413
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorAction.java

    r14214 r15240  
    9090
    9191    protected final boolean canDownload() {
    92         if (editorAccess.getEditor().getRelation() == null)
    93             return false;
    94         DataSet ds = editorAccess.getEditor().getRelation().getDataSet();
     92        DataSet ds = editorAccess.getEditor().getLayer().getDataSet();
    9593        return !NetworkManager.isOffline(OnlineResource.OSM_API) && ds != null && !ds.isLocked()
    9694                && DownloadPolicy.BLOCKED != ds.getDownloadPolicy();
Note: See TracChangeset for help on using the changeset viewer.