Changeset 16593 in josm
- Timestamp:
- 2020-06-10T23:43:36+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/TagInfoViewer.java
r16530 r16593 16 16 import javax.swing.ListSelectionModel; 17 17 18 import org.openstreetmap.josm.actions.RestorePropertyAction; 19 import org.openstreetmap.josm.data.osm.DataSet; 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 import org.openstreetmap.josm.data.osm.PrimitiveId; 18 22 import org.openstreetmap.josm.data.osm.Tagged; 23 import org.openstreetmap.josm.gui.MainApplication; 19 24 import org.openstreetmap.josm.gui.dialogs.properties.CopyAllKeyValueAction; 20 25 import org.openstreetmap.josm.gui.dialogs.properties.CopyKeyValueAction; … … 72 77 73 78 IntFunction<String> tagKeyFn = x -> (String) table.getValueAt(x, 0); 79 IntFunction<String> tagValueFn = x -> tagTableModel.getValue(tagKeyFn.apply(x)); 74 80 IntFunction<Map<String, Integer>> tagValuesFn = x -> { 75 String key = tagTableModel.getValue((String) table.getValueAt(x, 0)); 76 if (key != null) { 77 return Collections.singletonMap(key, 1); 78 } 79 return Collections.emptyMap(); 81 String value = tagValueFn.apply(x); 82 return value != null ? Collections.singletonMap(value, 1) : Collections.emptyMap(); 80 83 }; 81 84 Supplier<Collection<? extends Tagged>> objectSp = () -> Collections.singletonList(model.getPointInTime(pointInTime)); 85 Supplier<OsmPrimitive> primitiveSupplier = () -> { 86 DataSet dataSet = MainApplication.getLayerManager().getEditDataSet(); 87 PrimitiveId primitiveId = model.getPointInTime(pointInTime); 88 if (dataSet == null || primitiveId == null) { 89 return null; 90 } 91 return dataSet.getPrimitiveById(primitiveId.getUniqueId(), primitiveId.getType()); 92 }; 82 93 83 94 tagMenu.add(trackJosmAction(new CopyValueAction(table, tagKeyFn, objectSp))); … … 86 97 tagMenu.addPopupMenuListener(copyKeyValueAction); 87 98 tagMenu.add(trackJosmAction(new CopyAllKeyValueAction(table, tagKeyFn, objectSp))); 99 tagMenu.add(new RestorePropertyAction(tagKeyFn, tagValueFn, primitiveSupplier, table.getSelectionModel())); 88 100 tagMenu.addSeparator(); 89 101 tagMenu.add(trackJosmAction(new HelpTagAction(table, tagKeyFn, tagValuesFn)));
Note:
See TracChangeset
for help on using the changeset viewer.