Changeset 5659 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2013-01-03T20:19:57+01:00 (11 years ago)
Author:
akks
Message:

see #8024: Ctrl-Shift-1..5 in Add Tag dialog = add and continue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r5658 r5659  
    549549                // Create action for reusing the tag, with keyboard shortcut Ctrl+(1-5)
    550550                String actionShortcutKey = "properties:recent:"+count;
     551                String actionShortcutShiftKey = "properties:recent:shift:"+count;
    551552                Shortcut sc = Shortcut.registerShortcut(actionShortcutKey, null, KeyEvent.VK_0+count, Shortcut.CTRL);
    552553                final JosmAction action = new JosmAction(actionShortcutKey, null, tr("Use this tag again"), sc, false) {
     
    561562                    }
    562563                };
     564                Shortcut scShift = Shortcut.registerShortcut(actionShortcutShiftKey, null, KeyEvent.VK_0+count, Shortcut.CTRL_SHIFT);
     565                final JosmAction actionShift = new JosmAction(actionShortcutShiftKey, null, tr("Use this tag again"), scShift, false) {
     566                    @Override
     567                    public void actionPerformed(ActionEvent e) {
     568                        action.actionPerformed(null);
     569                        performTagAdding();
     570                        selectKeysComboBox();
     571                    }
     572                };
    563573                recentTagsActions.add(action);
     574                recentTagsActions.add(actionShift);
    564575                disableTagIfNeeded(t, action);
    565576                // Find and display icon
     
    580591                    mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), actionShortcutKey);
    581592                    mainPanel.getActionMap().put(actionShortcutKey, action);
     593                    mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scShift.getKeyStroke(), actionShortcutShiftKey);
     594                    mainPanel.getActionMap().put(actionShortcutShiftKey, actionShift);
    582595                    // Make the tag label clickable and set tooltip to the action description (this displays also the keyboard shortcut)
    583596                    tagLabel.setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
Note: See TracChangeset for help on using the changeset viewer.