Changeset 7539 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2014-09-15T19:42:31+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/InputMapUtils.java
r7509 r7539 13 13 14 14 /** 15 * Tools to work with Swing InputMap 16 * 15 * Tools to work with Swing InputMap. 16 * @since 5200 17 17 */ 18 18 public final class InputMapUtils { … … 62 62 63 63 /** 64 * Enable activating button on Enter (which is replaced with spacebar for certain Look-And-Feels) 64 * Enable activating button on Enter (which is replaced with spacebar for certain Look-And-Feels). 65 * @param b Button 65 66 */ 66 67 public static void enableEnter(JButton b) { 67 68 b.setFocusable(true); 68 69 b.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter"); 69 b.getActionMap().put("enter", b.getAction());70 b.getActionMap().put("enter", b.getAction()); 70 71 } 71 72 73 /** 74 * Add an action activated with Enter key on a component. 75 * @param c The Swing component 76 * @param a action activated with Enter key 77 */ 72 78 public static void addEnterAction(JComponent c, Action a) { 73 79 c.getActionMap().put("enter", a); … … 75 81 } 76 82 83 /** 84 * Add an action activated with Spacebar key on a component. 85 * @param c The Swing component 86 * @param a action activated with Spacebar key 87 */ 77 88 public static void addSpacebarAction(JComponent c, Action a) { 78 89 c.getActionMap().put("spacebar", a); -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r7012 r7539 19 19 20 20 import org.openstreetmap.josm.Main; 21 import org.openstreetmap.josm.gui.util.GuiHelper; 21 22 22 23 /** … … 27 28 * finally manages loading and saving shortcuts to/from the preferences. 28 29 * 29 * Action authors: You only need the {@link #registerShortcut} factory. Ignore everything 30 * else. 30 * Action authors: You only need the {@link #registerShortcut} factory. Ignore everything else. 31 31 * 32 32 * All: Use only public methods that are also marked to be used. The others are 33 33 * public so the shortcut preferences can use them. 34 * 34 * @since 1084 35 35 */ 36 36 public final class Shortcut { … … 262 262 } 263 263 264 /** None group: used with KeyEvent.CHAR_UNDEFINED if no shortcut is defined */ 264 265 public static final int NONE = 5000; 265 266 public static final int MNEMONIC = 5001; 267 /** Reserved group: for system shortcuts only */ 266 268 public static final int RESERVED = 5002; 269 /** Direct group: no modifier */ 267 270 public static final int DIRECT = 5003; 271 /** Alt group */ 268 272 public static final int ALT = 5004; 273 /** Shift group */ 269 274 public static final int SHIFT = 5005; 275 /** Command group. Matches CTRL modifier on Windows/Linux but META modifier on OS X */ 270 276 public static final int CTRL = 5006; 277 /** Alt-Shift group */ 271 278 public static final int ALT_SHIFT = 5007; 279 /** Alt-Command group. Matches ALT-CTRL modifier on Windows/Linux but ALT-META modifier on OS X */ 272 280 public static final int ALT_CTRL = 5008; 281 /** Command-Shift group. Matches CTRL-SHIFT modifier on Windows/Linux but META-SHIFT modifier on OS X */ 273 282 public static final int CTRL_SHIFT = 5009; 283 /** Alt-Command-Shift group. Matches ALT-CTRL-SHIFT modifier on Windows/Linux but ALT-META-SHIFT modifier on OS X */ 274 284 public static final int ALT_CTRL_SHIFT = 5010; 275 285 … … 285 295 if (initdone) return; 286 296 initdone = true; 297 int commandDownMask = GuiHelper.getMenuShortcutKeyMaskEx(); 287 298 groups.put(NONE, -1); 288 299 groups.put(MNEMONIC, KeyEvent.ALT_DOWN_MASK); … … 290 301 groups.put(ALT, KeyEvent.ALT_DOWN_MASK); 291 302 groups.put(SHIFT, KeyEvent.SHIFT_DOWN_MASK); 292 groups.put(CTRL, KeyEvent.CTRL_DOWN_MASK);303 groups.put(CTRL, commandDownMask); 293 304 groups.put(ALT_SHIFT, KeyEvent.ALT_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK); 294 groups.put(ALT_CTRL, KeyEvent.ALT_DOWN_MASK| KeyEvent.CTRL_DOWN_MASK);295 groups.put(CTRL_SHIFT, KeyEvent.CTRL_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK);296 groups.put(ALT_CTRL_SHIFT, KeyEvent.ALT_DOWN_MASK| KeyEvent.CTRL_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK);305 groups.put(ALT_CTRL, KeyEvent.ALT_DOWN_MASK|commandDownMask); 306 groups.put(CTRL_SHIFT, commandDownMask|KeyEvent.SHIFT_DOWN_MASK); 307 groups.put(ALT_CTRL_SHIFT, KeyEvent.ALT_DOWN_MASK|commandDownMask|KeyEvent.SHIFT_DOWN_MASK); 297 308 298 309 // (1) System reserved shortcuts
Note:
See TracChangeset
for help on using the changeset viewer.