- Timestamp:
- 2016-01-02T14:52:39+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r9086 r9259 705 705 for (int i = tags.size()-1; i >= 0 && count <= tagsToShow; i--, count++) { 706 706 final Tag t = tags.get(i); 707 // Create action for reusing the tag, with keyboard shortcut Ctrl+(1-5) 708 String actionShortcutKey = "properties:recent:"+count; 709 String actionShortcutShiftKey = "properties:recent:shift:"+count; 710 // CHECKSTYLE.OFF: LineLength 711 Shortcut sc = Shortcut.registerShortcut(actionShortcutKey, tr("Choose recent tag {0}", count), KeyEvent.VK_0+count, Shortcut.CTRL); 712 // CHECKSTYLE.ON: LineLength 707 // Create action for reusing the tag, with keyboard shortcut 708 final String actionShortcutKey = "properties:recent:" + count; 709 final String actionShortcutShiftKey = "properties:recent:shift:" + count; 710 final Shortcut sc = count > 10 ? null : Shortcut.registerShortcut( 711 actionShortcutKey, tr("Choose recent tag {0}", count), KeyEvent.VK_0 + count, Shortcut.CTRL); 713 712 final JosmAction action = new JosmAction(actionShortcutKey, null, tr("Use this tag again"), sc, false) { 714 713 @Override … … 721 720 } 722 721 }; 723 Shortcut scShift = Shortcut.registerShortcut(actionShortcutShiftKey, tr("Apply recent tag {0}", count),724 KeyEvent.VK_0+count, Shortcut.CTRL_SHIFT);722 final Shortcut scShift = count > 10 ? null : Shortcut.registerShortcut( 723 actionShortcutShiftKey, tr("Apply recent tag {0}", count), KeyEvent.VK_0 + count, Shortcut.CTRL_SHIFT); 725 724 final JosmAction actionShift = new JosmAction(actionShortcutShiftKey, null, tr("Use this tag again"), scShift, false) { 726 725 @Override … … 763 762 "/td></tr></table></html>"); 764 763 tagLabel.setFont(tagLabel.getFont().deriveFont(Font.PLAIN)); 765 if (action.isEnabled() ) {764 if (action.isEnabled() && sc != null && scShift != null) { 766 765 // Register action 767 766 mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), actionShortcutKey); … … 769 768 mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scShift.getKeyStroke(), actionShortcutShiftKey); 770 769 mainPanel.getActionMap().put(actionShortcutShiftKey, actionShift); 770 } 771 if (action.isEnabled()) { 771 772 // Make the tag label clickable and set tooltip to the action description (this displays also the keyboard shortcut) 772 773 tagLabel.setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
Note:
See TracChangeset
for help on using the changeset viewer.