Changeset 1180 in josm for trunk/src/org/openstreetmap/josm/actions/JosmAction.java
- Timestamp:
- 2008-12-25T18:58:04+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r1169 r1180 25 25 abstract public class JosmAction extends AbstractAction implements Destroyable { 26 26 27 @Deprecated28 public KeyStroke shortcut;29 27 protected Shortcut sc; 30 28 … … 36 34 } 37 35 return sc; 38 }39 40 @Deprecated41 public JosmAction(String name, String iconName, String tooltip, int shortcut, int modifier, boolean register) {42 super(name, iconName == null ? null : ImageProvider.get(iconName));43 setHelpId();44 if (shortcut != 0) {45 int group = Shortcut.GROUP_LAYER; //GROUP_NONE;46 if (((modifier & InputEvent.CTRL_MASK) != 0) || ((modifier & InputEvent.CTRL_DOWN_MASK) != 0)) {47 group = Shortcut.GROUP_MENU;48 } else if (modifier == 0) {49 group = Shortcut.GROUP_EDIT;50 }51 sc = Shortcut.registerShortcut("auto:"+name, name, shortcut, group);52 this.shortcut = sc.getKeyStroke();53 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), name);54 Main.contentPane.getActionMap().put(name, this);55 }56 putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));57 putValue("toolbar", iconName);58 if (register)59 Main.toolbar.register(this);60 36 } 61 37 … … 80 56 sc = shortcut; 81 57 if (sc != null) { 82 this.shortcut = sc.getKeyStroke();83 58 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), name); 84 59 Main.contentPane.getActionMap().put(name, this); … … 91 66 92 67 public void destroy() { 93 if (s hortcut!= null) {68 if (sc != null) { 94 69 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).remove(sc.getKeyStroke()); 95 70 Main.contentPane.getActionMap().remove(sc.getKeyStroke());
Note:
See TracChangeset
for help on using the changeset viewer.