Changeset 16609 in josm for trunk/src/org/openstreetmap/josm/gui/history/HistoryViewerPanel.java
- Timestamp:
- 2020-06-11T22:48:46+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/HistoryViewerPanel.java
r16473 r16609 5 5 import java.awt.Insets; 6 6 import java.awt.event.ActionEvent; 7 import java.util.function.BiPredicate; 8 import java.util.stream.IntStream; 7 9 8 10 import javax.swing.AbstractAction; … … 10 12 import javax.swing.JScrollPane; 11 13 import javax.swing.JTable; 14 import javax.swing.ListSelectionModel; 12 15 13 16 import org.openstreetmap.josm.actions.AutoScaleAction; … … 94 97 } 95 98 99 /** 100 * Enables semantic highlighting for the {@link org.openstreetmap.josm.data.StructUtils.SerializeOptions} 101 * @param thisSelectionModel selection model 102 * @param thisModel table model (corresponding to the selection model) 103 * @param otherModel table model for the other point in time 104 * @param isSemanticallyEquivalent predicate to determine whether the items should be highlighted 105 */ 106 protected void enableSemanticSelectionSynchronization(ListSelectionModel thisSelectionModel, 107 DiffTableModel thisModel, DiffTableModel otherModel, 108 BiPredicate<TwoColumnDiff.Item, TwoColumnDiff.Item> isSemanticallyEquivalent) { 109 selectionSynchronizer.setSelectionIndexMapper((selection, sourceSelectionModel) -> { 110 DiffTableModel sourceModel = sourceSelectionModel == thisSelectionModel ? thisModel : otherModel; 111 DiffTableModel destinationModel = sourceSelectionModel == thisSelectionModel ? otherModel : thisModel; 112 return IntStream.range(0, destinationModel.getRowCount()) 113 .filter(i -> isSemanticallyEquivalent.test(sourceModel.getValueAt(selection, 0), destinationModel.getValueAt(i, 0))); 114 }); 115 } 116 96 117 static class ListPopupMenu extends JPopupMenu { 97 118 private final ZoomToObjectAction zoomToObjectAction;
Note:
See TracChangeset
for help on using the changeset viewer.