Ignore:
Timestamp:
2010-05-15T18:59:10+02:00 (14 years ago)
Author:
jttt
Message:

Fix #2234: Translation can cause JosmActions to illegally handle shortcuts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r3229 r3252  
    2929
    3030import javax.swing.AbstractButton;
    31 import javax.swing.JComponent;
    3231import javax.swing.JOptionPane;
     32import javax.swing.JPanel;
    3333
    3434import org.openstreetmap.josm.Main;
    3535import org.openstreetmap.josm.actions.AutoScaleAction;
    36 import org.openstreetmap.josm.actions.JosmAction;
    3736import org.openstreetmap.josm.actions.MoveAction;
    3837import org.openstreetmap.josm.actions.mapmode.MapMode;
     
    189188    private Rectangle lastClipBounds = new Rectangle();
    190189
    191     public MapView() {
     190    public MapView(final JPanel contentPane) {
    192191        Main.pref.addPreferenceChangeListener(this);
    193192        addComponentListener(new ComponentAdapter(){
     
    213212                }
    214213
    215                 new MapMover(MapView.this, Main.contentPane);
    216                 JosmAction mv;
    217                 mv = new MoveAction(MoveAction.Direction.UP);
    218                 if (mv.getShortcut() != null) {
    219                     Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortcut().getKeyStroke(), "UP");
    220                     Main.contentPane.getActionMap().put("UP", mv);
    221                 }
    222                 mv = new MoveAction(MoveAction.Direction.DOWN);
    223                 if (mv.getShortcut() != null) {
    224                     Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortcut().getKeyStroke(), "DOWN");
    225                     Main.contentPane.getActionMap().put("DOWN", mv);
    226                 }
    227                 mv = new MoveAction(MoveAction.Direction.LEFT);
    228                 if (mv.getShortcut() != null) {
    229                     Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortcut().getKeyStroke(), "LEFT");
    230                     Main.contentPane.getActionMap().put("LEFT", mv);
    231                 }
    232                 mv = new MoveAction(MoveAction.Direction.RIGHT);
    233                 if (mv.getShortcut() != null) {
    234                     Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortcut().getKeyStroke(), "RIGHT");
    235                     Main.contentPane.getActionMap().put("RIGHT", mv);
    236                 }
     214                new MapMover(MapView.this, contentPane);
     215                new MoveAction(MoveAction.Direction.UP);
     216                new MoveAction(MoveAction.Direction.DOWN);
     217                new MoveAction(MoveAction.Direction.LEFT);
     218                new MoveAction(MoveAction.Direction.RIGHT);
    237219            }
    238220        });
Note: See TracChangeset for help on using the changeset viewer.