Changeset 1102 in josm for trunk/src


Ignore:
Timestamp:
2008-12-03T18:41:48+01:00 (11 years ago)
Author:
stoecker
Message:

fixed 3 shortcut conflicts

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

Legend:

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

    r999 r1102  
    88
    99import org.openstreetmap.josm.tools.ImageProvider;
     10import org.openstreetmap.josm.tools.Shortcut;
    1011
    1112public class SideButton extends JButton {
     
    2425                setToolTipText(tooltip);
    2526        }
     27        @Deprecated
    2628        public SideButton(String name, String imagename, String property, String tooltip, int mnemonic, ActionListener actionListener)
    2729        {
    2830                super(tr(name), ImageProvider.get("dialogs", imagename));
    2931                setMnemonic(mnemonic);
     32                setup(name, property, tooltip, actionListener);
     33        }
     34        public SideButton(String name, String imagename, String property, String tooltip, Shortcut shortcut, ActionListener actionListener)
     35        {
     36                super(tr(name), ImageProvider.get("dialogs", imagename));
     37                if(shortcut != null)
     38                        shortcut.setMnemonic(this);
    3039                setup(name, property, tooltip, actionListener);
    3140        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

    r1084 r1102  
    429429        public PropertiesDialog(MapFrame mapFrame) {
    430430                super(tr("Properties/Memberships"), "propertiesdialog", tr("Properties for selected objects."),
    431                 Shortcut.registerShortcut("subwindow:properies", tr("Toggle: {0}", tr("Properties/Memberships")), KeyEvent.VK_P,
     431                Shortcut.registerShortcut("subwindow:properties", tr("Toggle: {0}", tr("Properties/Memberships")), KeyEvent.VK_P,
    432432                Shortcut.GROUP_LAYER, Shortcut.SHIFT_DEFAULT), 150);
    433433
     
    602602                };
    603603
    604                 buttonPanel.add(new SideButton(marktr("Add"),"add","Properties",tr("Add a new key/value pair to all objects"), KeyEvent.VK_A, buttonAction));
    605                 buttonPanel.add(new SideButton(marktr("Edit"),"edit","Properties",tr("Edit the value of the selected key for all objects"), KeyEvent.VK_E, buttonAction));
    606                 buttonPanel.add(new SideButton(marktr("Delete"),"delete","Properties",tr("Delete the selected key in all objects"), KeyEvent.VK_D, buttonAction));
     604                Shortcut s = Shortcut.registerShortcut("properties:add", tr("Add Properties"), KeyEvent.VK_B,
     605                Shortcut.GROUP_MNEMONIC);
     606                buttonPanel.add(new SideButton(marktr("Add"),"add","Properties",
     607                tr("Add a new key/value pair to all objects"), s, buttonAction));
     608
     609                s = Shortcut.registerShortcut("properties:edit", tr("Edit Properties"), KeyEvent.VK_I,
     610                Shortcut.GROUP_MNEMONIC);
     611                buttonPanel.add(new SideButton(marktr("Edit"),"edit","Properties",
     612                tr("Edit the value of the selected key for all objects"), s, buttonAction));
     613
     614                s = Shortcut.registerShortcut("properties:delete", tr("Delete Properties"), KeyEvent.VK_Q,
     615                Shortcut.GROUP_MNEMONIC);
     616                buttonPanel.add(new SideButton(marktr("Delete"),"delete","Properties",
     617                tr("Delete the selected key in all objects"), s, buttonAction));
    607618                add(buttonPanel, BorderLayout.SOUTH);
    608619
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r1084 r1102  
    1010import java.util.Map;
    1111import java.util.Collection;
     12import javax.swing.AbstractButton;
    1213import javax.swing.KeyStroke;
    1314import javax.swing.JMenu;
     
    178179        }
    179180    }
     181    /**
     182     * use this to set a buttons's mnemonic
     183     */
     184    public void setMnemonic(AbstractButton button) {
     185        if (requestedGroup == GROUP_MNEMONIC && assignedModifier == groups.get(requestedGroup + GROUPS_DEFAULT) && getKeyStroke() != null && KeyEvent.getKeyText(assignedKey).length() == 1) {
     186            button.setMnemonic(KeyEvent.getKeyText(assignedKey).charAt(0)); //getKeyStroke().getKeyChar() seems not to work here
     187        }
     188    }
    180189
    181190    /**
Note: See TracChangeset for help on using the changeset viewer.