- Timestamp:
- 2019-10-26T14:58:45+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions/relation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/relation/AbstractRelationAction.java
r14397 r15476 12 12 import org.openstreetmap.josm.data.osm.IRelation; 13 13 import org.openstreetmap.josm.data.osm.OsmData; 14 import org.openstreetmap.josm.data.osm.OsmUtils; 15 import org.openstreetmap.josm.data.osm.Relation; 14 16 import org.openstreetmap.josm.io.NetworkManager; 15 17 import org.openstreetmap.josm.io.OnlineResource; 16 18 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 19 import org.openstreetmap.josm.tools.Utils; 17 20 18 21 /** … … 52 55 } 53 56 57 protected final boolean canModify() { 58 SubclassFilteredCollection<IRelation<?>, Relation> filteredRelations = Utils.filteredCollection(relations, Relation.class); 59 return OsmUtils.isOsmCollectionEditable(filteredRelations) && filteredRelations.parallelStream().anyMatch(r -> !r.isDeleted()); 60 } 61 54 62 protected final boolean canDownload() { 55 63 if (relations.isEmpty()) { … … 60 68 && ds != null && !ds.isLocked() && DownloadPolicy.BLOCKED != ds.getDownloadPolicy(); 61 69 } 62 70 63 71 protected void setHelpId(String helpId) { 64 72 putValue("help", helpId); -
trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java
r13957 r15476 8 8 9 9 import org.openstreetmap.josm.actions.mapmode.DeleteAction; 10 import org.openstreetmap.josm.data.osm.OsmUtils;11 10 import org.openstreetmap.josm.data.osm.Relation; 12 11 import org.openstreetmap.josm.gui.MainApplication; … … 52 51 @Override 53 52 protected void updateEnabledState() { 54 setEnabled( OsmUtils.isOsmCollectionEditable(relations));53 setEnabled(canModify()); 55 54 } 56 55 } -
trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
r15152 r15476 15 15 import org.openstreetmap.josm.data.osm.IRelation; 16 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 import org.openstreetmap.josm.data.osm.OsmUtils;18 17 import org.openstreetmap.josm.data.osm.Relation; 19 18 import org.openstreetmap.josm.data.osm.RelationMember; … … 87 86 @Override 88 87 protected void updateEnabledState() { 89 boolean enabled = false; 90 SubclassFilteredCollection<IRelation<?>, Relation> filteredRelations = Utils.filteredCollection(relations, Relation.class); 91 if (OsmUtils.isOsmCollectionEditable(filteredRelations)) { 92 for (Relation r : filteredRelations) { 93 if (!r.isDeleted()) { 94 enabled = true; 95 break; 96 } 97 } 98 } 99 setEnabled(enabled); 88 setEnabled(canModify()); 100 89 } 101 90 }
Note:
See TracChangeset
for help on using the changeset viewer.