Ticket #5781: arrow-keys-property-table-proof-of-concept.patch

File arrow-keys-property-table-proof-of-concept.patch, 2.9 KB (added by olejorgenb, 15 years ago)
  • src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    diff --git a/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java b/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
    index c962255..543e1b0 100644
    a b import java.util.HashSet;  
    3131import java.util.Iterator;
    3232import java.util.LinkedList;
    3333import java.util.List;
    34 import java.util.Map.Entry;
    3534import java.util.Map;
     35import java.util.Map.Entry;
    3636import java.util.Set;
    3737import java.util.TreeMap;
    3838import java.util.TreeSet;
    import javax.swing.text.JTextComponent;  
    6565
    6666import org.openstreetmap.josm.Main;
    6767import org.openstreetmap.josm.actions.JosmAction;
     68import org.openstreetmap.josm.actions.search.SearchAction.SearchMode;
     69import org.openstreetmap.josm.actions.search.SearchAction.SearchSetting;
    6870import org.openstreetmap.josm.command.ChangeCommand;
    6971import org.openstreetmap.josm.command.ChangePropertyCommand;
    7072import org.openstreetmap.josm.command.Command;
    import org.openstreetmap.josm.tools.LanguageInfo;  
    102104import org.openstreetmap.josm.tools.OpenBrowser;
    103105import org.openstreetmap.josm.tools.Shortcut;
    104106import org.openstreetmap.josm.tools.Utils;
    105 import org.openstreetmap.josm.actions.search.SearchAction.SearchMode;
    106 import org.openstreetmap.josm.actions.search.SearchAction.SearchSetting;
    107107
    108108/**
    109109 * This dialog displays the properties of the current selected primitives.
    public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi  
    378378                }
    379379        }
    380380        propertyTable.changeSelection(row, 0, false, false);
     381        propertyTable.requestFocusInWindow();
    381382    }
    382383
    383384    /**
    public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi  
    487488        lastAddKey = key;
    488489        lastAddValue = value;
    489490        Main.main.undoRedo.add(new ChangePropertyCommand(sel, key, value));
    490         btnAdd.requestFocusInWindow();
     491        propertyTable.requestFocusInWindow(); // necessary?
    491492    }
    492493
    493494    /**
    public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi  
    788789
    789790        // -- add action and shortcut
    790791        this.btnAdd = new SideButton(addAction);
    791         btnAdd.setFocusable(true);
    792         btnAdd.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "onEnter");
    793         btnAdd.getActionMap().put("onEnter", addAction);
     792        getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "onEnter");
     793        getActionMap().put("onEnter", addAction);
     794        // disable the default enter keybinding in the tables:
     795        propertyTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "none");
     796       
    794797
    795798        // -- edit action
    796799        //