- Timestamp:
- 2020-01-13T23:51:08+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r15673 r15707 667 667 @Override 668 668 public void popupMenuWillBecomeVisible(PopupMenuEvent e) { 669 final IRelation<?> selection = getSelected(); 670 if (selection != null) { 671 selection.visitKeys((primitive, key, value) -> addLinks(popupMenu, key, value)); 672 } 669 getSelectedRelations().forEach(relation -> 670 relation.visitKeys((primitive, key, value) -> addLinks(popupMenu, key, value))); 673 671 } 674 672 }); -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r15673 r15707 236 236 @Override 237 237 public void popupMenuWillBecomeVisible(PopupMenuEvent e) { 238 final Collection<OsmPrimitive> selection = getSelectedPrimitives(); 239 if (!selection.isEmpty()) { 240 selection.iterator().next().visitKeys((primitive, key, value) -> addLinks(popupMenu, key, value)); 241 } 238 getSelectedPrimitives().forEach(primitive -> 239 primitive.visitKeys((p, key, value) -> addLinks(popupMenu, key, value))); 242 240 } 243 241 }); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r15673 r15707 28 28 import java.util.TreeSet; 29 29 import java.util.concurrent.atomic.AtomicBoolean; 30 import java.util.stream.Collectors; 30 31 31 32 import javax.swing.AbstractAction; … … 65 66 import org.openstreetmap.josm.data.osm.IRelation; 66 67 import org.openstreetmap.josm.data.osm.IRelationMember; 68 import org.openstreetmap.josm.data.osm.KeyValueVisitor; 67 69 import org.openstreetmap.josm.data.osm.Node; 68 70 import org.openstreetmap.josm.data.osm.OsmData; … … 396 398 @Override 397 399 public void popupMenuWillBecomeVisible(PopupMenuEvent e) { 398 final IRelation<?> relation = getSelectedMembershipRelation(); 399 if (relation != null) { 400 relation.visitKeys((primitive, key, value) -> addLinks(membershipMenu, key, value)); 401 } 400 getSelectedMembershipRelations().forEach(relation -> 401 relation.visitKeys((primitive, key, value) -> addLinks(membershipMenu, key, value))); 402 402 } 403 403 }); … … 457 457 @Override 458 458 public void popupMenuWillBecomeVisible(PopupMenuEvent e) { 459 final Tags tags = getSelectedProperties(); 460 if (tags != null) { 461 tags.getValues().forEach(value -> addLinks(tagMenu, tags.getKey(), value)); 462 } 459 visitSelectedProperties((primitive, key, value) -> addLinks(tagMenu, key, value)); 463 460 } 464 461 }); … … 804 801 805 802 /** 803 * Visits all combinations of the selected keys/values. 804 * @param visitor the visitor 805 * @since 15707 806 */ 807 public void visitSelectedProperties(KeyValueVisitor visitor) { 808 for (int row : tagTable.getSelectedRows()) { 809 final String key = editHelper.getDataKey(row); 810 Set<String> values = editHelper.getDataValues(row).keySet(); 811 values.forEach(value -> visitor.visitKeyValue(null, key, value)); 812 } 813 } 814 815 /** 806 816 * Replies the membership popup menu handler. 807 817 * @return The membership popup menu handler … … 818 828 int row = membershipTable.getSelectedRow(); 819 829 return row > -1 ? (IRelation<?>) membershipData.getValueAt(row, 0) : null; 830 } 831 832 /** 833 * Returns all selected relation memberships. 834 * @return The selected relation memberships 835 * @since 15707 836 */ 837 public Collection<IRelation<?>> getSelectedMembershipRelations() { 838 return Arrays.stream(membershipTable.getSelectedRows()) 839 .mapToObj(row -> (IRelation<?>) membershipData.getValueAt(row, 0)) 840 .collect(Collectors.toList()); 820 841 } 821 842
Note:
See TracChangeset
for help on using the changeset viewer.