Changeset 4926 in josm


Ignore:
Timestamp:
2012-02-13T21:53:14+01:00 (13 years ago)
Author:
stoecker
Message:

some shortcut fixes

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r4919 r4926  
    973973    class SortAction extends AbstractAction implements TableModelListener {
    974974        public SortAction() {
    975             putValue(SHORT_DESCRIPTION, tr("Sort the relation members"));
     975            String tooltip = tr("Sort the relation members");
    976976            putValue(SMALL_ICON, ImageProvider.get("dialogs", "sort"));
    977977            putValue(NAME, tr("Sort"));
    978             //    Shortcut.register Shortcut("relationeditor:sort", tr("Relation Editor: Sort"), KeyEvent.VK_HOME, Shortcut.GROUP_MNEMONIC)
     978            Shortcut sc = Shortcut.registerShortcut("relationeditor:sort", tr("Relation Editor: Sort"),
     979                KeyEvent.VK_END, Shortcut.GROUP_DIRECT2);
     980            sc.setAccelerator(this);
     981            putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));
    979982            updateEnabledState();
    980983        }
     
    9981001            putValue(SMALL_ICON, ImageProvider.get("dialogs/relation", "reverse"));
    9991002            putValue(NAME, tr("Reverse"));
    1000             //   Shortcut.register Shortcut("relationeditor:reverse", tr("Relation Editor: Reverse"), KeyEvent.VK_END, Shortcut.GROUP_MNEMONIC)
     1003        //  Shortcut.register Shortcut("relationeditor:reverse", tr("Relation Editor: Reverse"),
     1004        //      KeyEvent.VK_END, Shortcut.GROUP_DIRECT2)
    10011005            updateEnabledState();
    10021006        }
     
    10171021    class MoveUpAction extends AbstractAction implements ListSelectionListener {
    10181022        public MoveUpAction() {
    1019             putValue(SHORT_DESCRIPTION, tr("Move the currently selected members up"));
     1023            String tooltip = tr("Move the currently selected members up");
    10201024            putValue(SMALL_ICON, ImageProvider.get("dialogs", "moveup"));
    10211025            // putValue(NAME, tr("Move Up"));
    1022             putValue(ACCELERATOR_KEY,
    1023                 Shortcut.registerShortcut("relationeditor:moveup", tr("Relation Editor: Move Up"), KeyEvent.VK_UP, Shortcut.GROUP_MNEMONIC)
    1024                     .getKeyStroke()
    1025             );
     1026            Shortcut sc = Shortcut.registerShortcut("relationeditor:moveup", tr("Relation Editor: Move Up"),
     1027                KeyEvent.VK_UP, Shortcut.GROUP_DIRECT2);
     1028            sc.setAccelerator(this);
     1029            putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));
    10261030            setEnabled(false);
    10271031        }
     
    10381042    class MoveDownAction extends AbstractAction implements ListSelectionListener {
    10391043        public MoveDownAction() {
    1040             putValue(SHORT_DESCRIPTION, tr("Move the currently selected members down"));
     1044            String tooltip = tr("Move the currently selected members down");
    10411045            putValue(SMALL_ICON, ImageProvider.get("dialogs", "movedown"));
    10421046            // putValue(NAME, tr("Move Down"));
    1043             putValue(ACCELERATOR_KEY,
    1044                 Shortcut.registerShortcut("relationeditor:movedown", tr("Relation Editor: Move Down"), KeyEvent.VK_DOWN, Shortcut.GROUP_MNEMONIC)
    1045                     .getKeyStroke()
    1046             );
     1047            Shortcut sc = Shortcut.registerShortcut("relationeditor:movedown", tr("Relation Editor: Move Down"),
     1048                KeyEvent.VK_DOWN, Shortcut.GROUP_DIRECT2);
     1049            sc.setAccelerator(this);
     1050            putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));
    10471051            setEnabled(false);
    10481052        }
     
    10591063    class RemoveAction extends AbstractAction implements ListSelectionListener {
    10601064        public RemoveAction() {
    1061             putValue(SHORT_DESCRIPTION, tr("Remove the currently selected members from this relation"));
     1065            String tooltip = tr("Remove the currently selected members from this relation");
    10621066            putValue(SMALL_ICON, ImageProvider.get("dialogs", "remove"));
    10631067            putValue(NAME, tr("Remove"));
    1064             putValue(ACCELERATOR_KEY,
    1065                  Shortcut.registerShortcut("relationeditor:remove", tr("Relation Editor: Remove"), KeyEvent.VK_DELETE,
    1066                     Shortcut.GROUP_MNEMONIC).getKeyStroke());
     1068            Shortcut sc = Shortcut.registerShortcut("relationeditor:remove", tr("Relation Editor: Remove"),
     1069                KeyEvent.VK_DELETE, Shortcut.GROUP_DIRECT2);
     1070            sc.setAccelerator(this);
     1071            putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));
    10671072            setEnabled(false);
    10681073        }
     
    13951400    class DownloadIncompleteMembersAction extends AbstractAction implements TableModelListener {
    13961401        public DownloadIncompleteMembersAction() {
    1397             putValue(SHORT_DESCRIPTION, tr("Download all incomplete members"));
     1402            String tooltip = tr("Download all incomplete members");
    13981403            putValue(SMALL_ICON, ImageProvider.get("dialogs/relation", "downloadincomplete"));
    13991404            putValue(NAME, tr("Download Members"));
    1400             putValue(ACCELERATOR_KEY,
    1401                 Shortcut.registerShortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"), KeyEvent.VK_HOME, Shortcut.GROUP_MNEMONIC)
    1402                     .getKeyStroke()
    1403             );
    1404                
     1405            Shortcut sc = Shortcut.registerShortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"),
     1406                KeyEvent.VK_HOME, Shortcut.GROUP_DIRECT2);
     1407            sc.setAccelerator(this);
     1408            putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));
    14051409            updateEnabledState();
    14061410        }
     
    14311435            putValue(SMALL_ICON, ImageProvider.get("dialogs/relation", "downloadincompleteselected"));
    14321436            putValue(NAME, tr("Download Members"));
    1433         //  Shortcut.register Shortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"), KeyEvent.VK_K, Shortcut.GROUP_MNEMONIC);
     1437        //  Shortcut.register Shortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"),
     1438        //      KeyEvent.VK_K, Shortcut.GROUP_DIRECT2)
    14341439            updateEnabledState();
    14351440        }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r4923 r4926  
    8484        setupGroup(groups, load, Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_MNEMONIC,KeyEvent.ALT_DOWN_MASK);
    8585        setupGroup(groups, load, Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_DIRECT2, KeyEvent.ALT_DOWN_MASK);
     86        setupGroup(groups, load, Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_DIRECT3, KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK);
    8687
    8788        setupGroup(groups, load, Shortcut.GROUPS_ALT1+Shortcut.GROUP_NONE,       -1);
     
    9394        setupGroup(groups, load, Shortcut.GROUPS_ALT1+Shortcut.GROUP_MNEMONIC,   KeyEvent.ALT_DOWN_MASK);
    9495        setupGroup(groups, load, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT2,    KeyEvent.ALT_DOWN_MASK  | KeyEvent.SHIFT_DOWN_MASK);
     96        setupGroup(groups, load, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT3,    KeyEvent.ALT_DOWN_MASK  | KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK);
    9597
    9698        setupGroup(groups, load, Shortcut.GROUPS_ALT2+Shortcut.GROUP_NONE,       -1);
     
    102104        setupGroup(groups, load, Shortcut.GROUPS_ALT2+Shortcut.GROUP_MNEMONIC,   KeyEvent.ALT_DOWN_MASK);
    103105        setupGroup(groups, load, Shortcut.GROUPS_ALT2+Shortcut.GROUP_DIRECT2,    KeyEvent.ALT_DOWN_MASK  | KeyEvent.CTRL_DOWN_MASK);
     106        setupGroup(groups, load, Shortcut.GROUPS_ALT2+Shortcut.GROUP_DIRECT3,    KeyEvent.META_DOWN_MASK | KeyEvent.CTRL_DOWN_MASK);
    104107
    105108        return groups;
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r4923 r4926  
    5858        setupGroup(groups, load, Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_MNEMONIC,KeyEvent.ALT_DOWN_MASK);
    5959        setupGroup(groups, load, Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_DIRECT2, KeyEvent.ALT_DOWN_MASK);
     60        setupGroup(groups, load, Shortcut.GROUPS_DEFAULT+Shortcut.GROUP_DIRECT3, KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK);
    6061
    6162        setupGroup(groups, load, Shortcut.GROUPS_ALT1+Shortcut.GROUP_NONE,       -1);
     
    6768        setupGroup(groups, load, Shortcut.GROUPS_ALT1+Shortcut.GROUP_MNEMONIC,   KeyEvent.ALT_DOWN_MASK);
    6869        setupGroup(groups, load, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT2,    KeyEvent.ALT_DOWN_MASK  | KeyEvent.SHIFT_DOWN_MASK);
     70        setupGroup(groups, load, Shortcut.GROUPS_ALT1+Shortcut.GROUP_DIRECT3,    KeyEvent.ALT_DOWN_MASK  | KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK);
    6971
    7072        setupGroup(groups, load, Shortcut.GROUPS_ALT2+Shortcut.GROUP_NONE,       -1);
     
    7678        setupGroup(groups, load, Shortcut.GROUPS_ALT2+Shortcut.GROUP_MNEMONIC,   KeyEvent.ALT_DOWN_MASK);
    7779        setupGroup(groups, load, Shortcut.GROUPS_ALT2+Shortcut.GROUP_DIRECT2,    KeyEvent.ALT_DOWN_MASK  | KeyEvent.CTRL_DOWN_MASK);
     80        setupGroup(groups, load, Shortcut.GROUPS_ALT2+Shortcut.GROUP_DIRECT3,    KeyEvent.META_DOWN_MASK | KeyEvent.CTRL_DOWN_MASK);
    7881
    7982        return groups;
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r4923 r4926  
    1414import java.util.Map;
    1515
     16import javax.swing.AbstractAction;
    1617import javax.swing.AbstractButton;
    1718import javax.swing.JMenu;
     
    212213        }
    213214    }
     215    /**
     216     * use this to set a actions's accelerator
     217     */
     218    public void setAccelerator(AbstractAction action) {
     219        if (getKeyStroke() != null) {
     220            action.putValue(AbstractAction.ACCELERATOR_KEY, getKeyStroke());
     221        }
     222    }
    214223
    215224    /**
     
    309318     */
    310319    public static final int GROUP_DIRECT2 = 7;
    311     public static final int GROUP__MAX = 8;
     320    /**
     321     * for direct access, remaining modifiers.
     322     */
     323    public static final int GROUP_DIRECT3 = 8;
     324    public static final int GROUP__MAX = 9;
    312325    public static final int GROUP_RESERVED = 1000;
    313326    public static final int GROUPS_DEFAULT = 0;
Note: See TracChangeset for help on using the changeset viewer.