Changeset 16512 in josm


Ignore:
Timestamp:
2020-05-28T14:46:30+02:00 (4 years ago)
Author:
GerdP
Message:

fix #19275: Relation list panel: Direct option for history viewer
Apply 19275.2c.patch which enables Ctrl+H in RelationListDialog

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java

    r16505 r16512  
    77import java.awt.event.ActionEvent;
    88import java.awt.event.KeyEvent;
    9 import java.util.HashSet;
     9import java.util.LinkedHashSet;
    1010import java.util.Set;
     11import java.util.stream.Collectors;
    1112
     13import javax.swing.JList;
    1214import javax.swing.JTable;
    1315
     
    4446    public void actionPerformed(ActionEvent ae) {
    4547        // Generic handling of tables displaying OSM primitives
     48        Set<PrimitiveId> sel = new LinkedHashSet<>();
    4649        if (ae.getSource() instanceof JTable) {
    4750            JTable table = (JTable) ae.getSource();
    48             Set<PrimitiveId> sel = new HashSet<>();
    4951            for (int row : table.getSelectedRows()) {
    5052                for (int col = 0; col < table.getModel().getColumnCount(); col++) {
     
    5658                }
    5759            }
    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));
     66        }
     67        if (!sel.isEmpty()) {
     68            HistoryBrowserDialogManager.getInstance().showHistory(sel);
     69            return;
    6270        }
    6371        // Otherwise show history for currently selected objects
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r16438 r16512  
    3535
    3636import org.openstreetmap.josm.actions.ExpertToggleAction;
     37import org.openstreetmap.josm.actions.HistoryInfoAction;
    3738import org.openstreetmap.josm.actions.relation.AddSelectionToRelations;
    3839import org.openstreetmap.josm.actions.relation.DeleteRelationsAction;
     
    199200        displaylist.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_C, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), "copy");
    200201
     202        HistoryInfoAction historyAction = MainApplication.getMenu().historyinfo;
     203        displaylist.getActionMap().put("historyAction", historyAction);
     204        displaylist.getInputMap().put(historyAction.getShortcut().getKeyStroke(), "historyAction");
     205
    201206        updateActionsRelationLists();
    202207    }
Note: See TracChangeset for help on using the changeset viewer.