Changeset 17596 in josm for trunk/src/org


Ignore:
Timestamp:
2021-03-20T12:24:13+01:00 (4 years ago)
Author:
simon04
Message:

fix #20047 - Relation editor: Harmonize F1 function (linking to osm wiki pages)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java

    r16698 r17596  
    99import java.awt.event.FocusAdapter;
    1010import java.awt.event.FocusEvent;
     11import java.util.Collections;
    1112
    1213import javax.swing.AbstractAction;
    1314import javax.swing.BoxLayout;
    1415import javax.swing.JButton;
     16import javax.swing.JComponent;
    1517import javax.swing.JPanel;
    1618import javax.swing.JScrollPane;
    1719
    1820import org.openstreetmap.josm.data.osm.OsmPrimitive;
     21import org.openstreetmap.josm.gui.dialogs.properties.HelpAction;
     22import org.openstreetmap.josm.gui.dialogs.properties.HelpTagAction;
    1923import org.openstreetmap.josm.gui.dialogs.properties.PresetListPanel;
    2024import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    161165        }
    162166        this.tagTable = new TagTable(this.model, maxCharacters);
     167
     168        setupKeyboardShortcuts();
    163169        build();
     170    }
     171
     172    private void setupKeyboardShortcuts() {
     173        // F1 button = custom help action
     174        final HelpAction helpTagAction = new HelpTagAction(tagTable,
     175                viewRow -> this.model.get(tagTable.convertRowIndexToModel(viewRow)).getName(),
     176                viewRow -> Collections.singletonMap(this.model.get(tagTable.convertRowIndexToModel(viewRow)).getValue(), 1));
     177        getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(HelpAction.getKeyStroke(), "onHelp");
     178        getActionMap().put("onHelp", helpTagAction);
    164179    }
    165180
Note: See TracChangeset for help on using the changeset viewer.