Changeset 4139 in josm for trunk/src/org/openstreetmap/josm/actions/MoveAction.java
- Timestamp:
- 2011-06-18T15:26:52+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/MoveAction.java
r3327 r4139 32 32 33 33 // any better idea? 34 private static Object calltosupermustbefirststatementinconstructor(Direction dir, boolean text) { 35 Shortcut sc; 34 private static String calltosupermustbefirststatementinconstructor_text(Direction dir) { 36 35 String directiontext; 37 36 if (dir == Direction.UP) { 38 37 directiontext = tr("up"); 39 sc = Shortcut.registerShortcut("core:moveup", tr("Move objects {0}", directiontext), KeyEvent.VK_UP, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT);40 38 } else if (dir == Direction.DOWN) { 41 39 directiontext = tr("down"); 42 sc = Shortcut.registerShortcut("core:movedown", tr("Move objects {0}", directiontext), KeyEvent.VK_DOWN, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT);43 40 } else if (dir == Direction.LEFT) { 44 41 directiontext = tr("left"); 45 sc = Shortcut.registerShortcut("core:moveleft", tr("Move objects {0}", directiontext), KeyEvent.VK_LEFT, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT);46 42 } else { //dir == Direction.RIGHT) { 47 43 directiontext = tr("right"); 48 sc = Shortcut.registerShortcut("core:moveright", tr("Move objects {0}", directiontext), KeyEvent.VK_RIGHT, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT);49 44 } 50 if (text) 51 return directiontext; 52 else 53 return sc; 45 return directiontext; 46 } 47 48 // any better idea? 49 private static Shortcut calltosupermustbefirststatementinconstructor(Direction dir) { 50 Shortcut sc; 51 if (dir == Direction.UP) { 52 sc = Shortcut.registerShortcut("core:moveup", tr("Move objects {0}", tr("up")), KeyEvent.VK_UP, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT); 53 } else if (dir == Direction.DOWN) { 54 sc = Shortcut.registerShortcut("core:movedown", tr("Move objects {0}", tr("down")), KeyEvent.VK_DOWN, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT); 55 } else if (dir == Direction.LEFT) { 56 sc = Shortcut.registerShortcut("core:moveleft", tr("Move objects {0}", tr("left")), KeyEvent.VK_LEFT, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT); 57 } else { //dir == Direction.RIGHT) { 58 sc = Shortcut.registerShortcut("core:moveright", tr("Move objects {0}", tr("right")), KeyEvent.VK_RIGHT, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT); 59 } 60 return sc; 54 61 } 55 62 56 63 public MoveAction(Direction dir) { 57 super(tr("Move {0}", calltosupermustbefirststatementinconstructor (dir, true)), null,58 tr("Moves Objects {0}", calltosupermustbefirststatementinconstructor (dir, true)),59 (Shortcut)calltosupermustbefirststatementinconstructor(dir, false), true);64 super(tr("Move {0}", calltosupermustbefirststatementinconstructor_text(dir)), null, 65 tr("Moves Objects {0}", calltosupermustbefirststatementinconstructor_text(dir)), 66 calltosupermustbefirststatementinconstructor(dir), false); 60 67 myDirection = dir; 61 68 putValue("help", ht("/Action/Move")); 69 if (dir == Direction.UP) { 70 putValue("toolbar", "action/move/up"); 71 } else if (dir == Direction.DOWN) { 72 putValue("toolbar", "action/move/down"); 73 } else if (dir == Direction.LEFT) { 74 putValue("toolbar", "action/move/left"); 75 } else { //dir == Direction.RIGHT) { 76 putValue("toolbar", "action/move/right"); 77 } 78 Main.toolbar.register(this); 62 79 } 63 80
Note:
See TracChangeset
for help on using the changeset viewer.