Changeset 1935 in josm for trunk


Ignore:
Timestamp:
2009-08-08T15:59:57+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3203: pressing DEL deletes Layer instead of objects
Enabled DEL in layer list again, should not interfere with DEL on map view anymore.

Location:
trunk/src/org/openstreetmap/josm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/JosmAction.java

    r1820 r1935  
    5656     * Use this super constructor to setup your action. It takes 5 parameters:
    5757     *
    58      * name - the action's text as displayed on the menu (if it is added to a menu)
    59      * iconName - the filename of the icon to use
    60      * tooltip - a longer description of the action that will be displayed in the tooltip. Please note
    61      *           that html is not supported for menu action on some platforms
    62      * shortcut - a ready-created shortcut object or null if you don't want a shortcut. But you always
    63      *            do want a shortcut, remember you can alway register it with group=none, so you
    64      *            won't be assigned a shurtcut unless the user configures one. If you pass null here,
     58     * @param name the action's text as displayed on the menu (if it is added to a menu)
     59     * @param iconName the filename of the icon to use
     60     * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note
     61     *           that html is not supported for menu actions on some platforms.
     62     * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always
     63     *            do want a shortcut, remember you can always register it with group=none, so you
     64     *            won't be assigned a shortcut unless the user configures one. If you pass null here,
    6565     *            the user CANNOT configure a shortcut for your action.
    66      * register - register this action for the toolbar preferences?
     66     * @param register register this action for the toolbar preferences?
    6767     */
    6868    public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r1865 r1935  
    102102        if(!Main.map.mapView.isActiveLayerVisible())
    103103            return;
     104
     105        // request focus in order to enable the expected keyboard shortcuts
     106        //
     107        Main.map.mapView.requestFocus();
     108
    104109        boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0;
    105110        boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r1912 r1935  
    307307        if(!Main.map.mapView.isActiveLayerDrawable())
    308308            return;
     309        // request focus in order to enable the expected keyboard shortcuts
     310        //
     311        Main.map.mapView.requestFocus();
    309312
    310313        if(e.getClickCount() > 1 && mousePos != null && mousePos.equals(oldMousePos)) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r1862 r1935  
    351351        if(!Main.map.mapView.isActiveLayerVisible())
    352352            return;
     353        // request focus in order to enable the expected keyboard shortcuts
     354        //
     355        Main.map.mapView.requestFocus();
    353356
    354357        cancelDrawMode = false;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r1919 r1935  
    99import java.awt.Point;
    1010import java.awt.event.ActionEvent;
     11import java.awt.event.FocusEvent;
     12import java.awt.event.FocusListener;
    1113import java.awt.event.KeyEvent;
    1214import java.awt.event.MouseAdapter;
     
    2123
    2224import javax.swing.AbstractAction;
     25import javax.swing.Action;
    2326import javax.swing.DefaultListCellRenderer;
    2427import javax.swing.DefaultListModel;
     
    131134        //-- delete layer action
    132135        DeleteLayerAction deleteLayerAction = new DeleteLayerAction();
    133         // #3203: grabs DELETE even for primitives on the map
    134         // FIXME: disabling for now, don't understand yet what's going on
    135         //        layerList.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
    136         //                KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),"deleteLayer"
    137         //        );
    138         //        layerList.getActionMap().put("deleteLayer", deleteLayerAction);
     136        layerList.getInputMap(JComponent.WHEN_FOCUSED).put(
     137                KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),"deleteLayer"
     138        );
     139        layerList.getActionMap().put("deleteLayer", deleteLayerAction);
    139140        adaptTo(deleteLayerAction, selectionModel);
    140141        buttonPanel.add(new SideButton(deleteLayerAction, "delete"));
Note: See TracChangeset for help on using the changeset viewer.