Ticket #19275: 19275.2c.patch
File 19275.2c.patch, 3.3 KB (added by , 5 years ago) |
---|
-
src/org/openstreetmap/josm/actions/HistoryInfoAction.java
6 6 7 7 import java.awt.event.ActionEvent; 8 8 import java.awt.event.KeyEvent; 9 import java.util. HashSet;9 import java.util.LinkedHashSet; 10 10 import java.util.Set; 11 import java.util.stream.Collectors; 11 12 13 import javax.swing.JList; 12 14 import javax.swing.JTable; 13 15 14 16 import org.openstreetmap.josm.data.osm.OsmData; … … 43 45 @Override 44 46 public void actionPerformed(ActionEvent ae) { 45 47 // Generic handling of tables displaying OSM primitives 48 Set<PrimitiveId> sel = new LinkedHashSet<>(); 46 49 if (ae.getSource() instanceof JTable) { 47 50 JTable table = (JTable) ae.getSource(); 48 Set<PrimitiveId> sel = new HashSet<>();49 51 for (int row : table.getSelectedRows()) { 50 52 for (int col = 0; col < table.getModel().getColumnCount(); col++) { 51 53 Object value = table.getModel().getValueAt(row, col); … … 55 57 } 56 58 } 57 59 } 58 if (!sel.isEmpty()) { 59 HistoryBrowserDialogManager.getInstance().showHistory(sel); 60 return; 61 } 60 } else if (ae.getSource() instanceof JList) { 61 JList<?> list = (JList<?>) ae.getSource(); 62 sel = list.getSelectedValuesList() 63 .stream().filter(v -> v instanceof PrimitiveId) 64 .map(v -> (PrimitiveId) v) 65 .collect(Collectors.toCollection(LinkedHashSet::new)); 62 66 } 67 if (!sel.isEmpty()) { 68 HistoryBrowserDialogManager.getInstance().showHistory(sel); 69 return; 70 } 63 71 // Otherwise show history for currently selected objects 64 72 OsmData<?, ?, ?, ?> set = getLayerManager().getActiveData(); 65 73 if (set != null && !set.selectionEmpty()) { -
src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
34 34 import javax.swing.event.PopupMenuListener; 35 35 36 36 import org.openstreetmap.josm.actions.ExpertToggleAction; 37 import org.openstreetmap.josm.actions.HistoryInfoAction; 37 38 import org.openstreetmap.josm.actions.relation.AddSelectionToRelations; 38 39 import org.openstreetmap.josm.actions.relation.DeleteRelationsAction; 39 40 import org.openstreetmap.josm.actions.relation.DuplicateRelationAction; … … 198 199 displaylist.getActionMap().put("copy", MainApplication.getMenu().copy); 199 200 displaylist.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_C, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), "copy"); 200 201 202 HistoryInfoAction historyAction = MainApplication.getMenu().historyinfo; 203 displaylist.getActionMap().put("historyAction", historyAction); 204 displaylist.getInputMap().put(historyAction.getShortcut().getKeyStroke(), "historyAction"); 205 201 206 updateActionsRelationLists(); 202 207 } 203 208