Ticket #1622: thepatch.diff

File thepatch.diff, 93.2 KB (added by Henry Loenwind, 18 years ago)
  • src/org/openstreetmap/josm/actions/PreferencesAction.java

     
    1414import org.openstreetmap.josm.Main;
    1515import org.openstreetmap.josm.gui.preferences.PreferenceDialog;
    1616import org.openstreetmap.josm.tools.GBC;
     17import org.openstreetmap.josm.tools.ShortCut;
    1718
    1819/**
    1920 * Open the Preferences dialog.
     
    2627         * Create the preference action with "&Preferences" as label.
    2728         */
    2829        public PreferencesAction() {
    29                 super(tr("Preferences ..."), "preference", tr("Open a preferences page for global settings."), KeyEvent.VK_F12, 0, true);
     30                super(tr("Preferences ..."), "preference", tr("Open a preferences page for global settings."),
     31                ShortCut.registerShortCut("system:preferences", tr("Preferences"), KeyEvent.VK_F12, ShortCut.GROUP_DIRECT), true);
    3032        }
    3133
    3234        /**
  • src/org/openstreetmap/josm/actions/OpenAction.java

     
    2424import org.openstreetmap.josm.io.NmeaReader;
    2525import org.openstreetmap.josm.io.OsmReader;
    2626import org.xml.sax.SAXException;
     27import org.openstreetmap.josm.tools.ShortCut;
    2728
    2829/**
    2930 * Open a file chooser dialog and select an file to import. Then call the gpx-import
     
    3738         * Create an open action. The name is "Open a file".
    3839         */
    3940        public OpenAction() {
    40                 super(tr("Open ..."), "open", tr("Open a file."), KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK);
     41                super(tr("Open ..."), "open", tr("Open a file."),
     42                ShortCut.registerShortCut("system:open", tr("File: Open..."), KeyEvent.VK_O, ShortCut.GROUP_MENU));
    4143        }
    4244
    4345        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/AlignInCircleAction.java

     
    1919import org.openstreetmap.josm.data.osm.Node;
    2020import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2121import org.openstreetmap.josm.data.osm.Way;
     22import org.openstreetmap.josm.tools.ShortCut;
    2223
    2324/**
    2425 * Aligns all selected nodes within a circle. (Useful for roundabouts)
     
    2829public final class AlignInCircleAction extends JosmAction {
    2930
    3031        public AlignInCircleAction() {
    31                 super(tr("Align Nodes in Circle"), "aligncircle", tr("Move the selected nodes into a circle."), KeyEvent.VK_O, 0, true);
     32                super(tr("Align Nodes in Circle"), "aligncircle", tr("Move the selected nodes into a circle."),
     33                ShortCut.registerShortCut("tools:aligncircle", tr("Tool: Align in circle"), KeyEvent.VK_O, ShortCut.GROUP_EDIT), true);
    3234        }
    3335
    3436        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/MoveAction.java

     
    1616import org.openstreetmap.josm.data.osm.Node;
    1717import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1818import org.openstreetmap.josm.data.osm.visitor.AllNodesVisitor;
     19import org.openstreetmap.josm.tools.ShortCut;
    1920
    2021/**
    2122 * Moves the selection
     
    2728        public enum Direction { UP, LEFT, RIGHT, DOWN }
    2829        private Direction myDirection;
    2930       
     31        // any better idea?
     32        private static Object calltosupermustbefirststatementinconstructor(Direction dir, boolean text) {
     33                ShortCut sc;
     34                String directiontext;
     35                if        (dir == Direction.UP)   {
     36                        directiontext = tr("up");
     37                        sc = ShortCut.registerShortCut("core:moveup",    tr("Move objects {0}", directiontext), KeyEvent.VK_UP,    ShortCut.GROUPS_ALT1+ShortCut.GROUP_DIRECT);
     38                } else if (dir == Direction.DOWN)  {
     39                        directiontext = tr("down");
     40                        sc = ShortCut.registerShortCut("core:movedown",  tr("Move objects {0}", directiontext), KeyEvent.VK_DOWN,  ShortCut.GROUPS_ALT1+ShortCut.GROUP_DIRECT);
     41                } else if (dir == Direction.LEFT)  {
     42                        directiontext = tr("left");
     43                        sc = ShortCut.registerShortCut("core:moveleft",  tr("Move objects {0}", directiontext), KeyEvent.VK_LEFT,  ShortCut.GROUPS_ALT1+ShortCut.GROUP_DIRECT);
     44                } else { //dir == Direction.RIGHT) {
     45                        directiontext = tr("right");
     46                        sc = ShortCut.registerShortCut("core:moveright", tr("Move objects {0}", directiontext), KeyEvent.VK_RIGHT, ShortCut.GROUPS_ALT1+ShortCut.GROUP_DIRECT);
     47                }
     48                if (text) {
     49                        return directiontext;
     50                } else {
     51                        return sc;
     52                }
     53        }
     54
    3055        public MoveAction(Direction dir) {
    31                 super(tr("Move"), null, tr("Moves Objects"),
    32                 (dir == Direction.UP) ? KeyEvent.VK_UP :
    33                 (dir == Direction.DOWN) ? KeyEvent.VK_DOWN :
    34                 (dir == Direction.LEFT) ? KeyEvent.VK_LEFT :
    35                 KeyEvent.VK_RIGHT, 0, true);
     56                super(tr("Move {0}", calltosupermustbefirststatementinconstructor(dir, true)), null,
     57                      tr("Moves Objects {0}", calltosupermustbefirststatementinconstructor(dir, true)),
     58                      (ShortCut)calltosupermustbefirststatementinconstructor(dir, false), true);
    3659                myDirection = dir;
    3760        }
    3861
  • src/org/openstreetmap/josm/actions/JosmAction.java

     
    11// License: GPL. Copyright 2007 by Immanuel Scholz and others
    22package org.openstreetmap.josm.actions;
    33
     4import java.awt.event.InputEvent;
    45
    56import javax.swing.AbstractAction;
    67import javax.swing.JComponent;
     
    1011import org.openstreetmap.josm.data.osm.DataSet;
    1112import org.openstreetmap.josm.tools.Destroyable;
    1213import org.openstreetmap.josm.tools.ImageProvider;
    13 import org.openstreetmap.josm.tools.ShortCutLabel;
     14import org.openstreetmap.josm.tools.ShortCut;
    1415
    1516/**
    1617 * Base class helper for all Actions in JOSM. Just to make the life easier.
     
    2324 */
    2425abstract public class JosmAction extends AbstractAction implements Destroyable {
    2526
     27        @Deprecated
    2628        public KeyStroke shortCut;
     29        protected ShortCut sc;
    2730
     31        public ShortCut getShortCut() {
     32                if (sc == null) {
     33                        sc = ShortCut.registerShortCut("core:none", "No Shortcut", 0, ShortCut.GROUP_NONE);
     34                        sc.setAutomatic(); // as this shortcut is shared by all action that don't want to have a shortcut,
     35                                           // we shouldn't allow the user to change it...
     36                }
     37                return sc;
     38        }
     39
     40        @Deprecated
    2841        public JosmAction(String name, String iconName, String tooltip, int shortCut, int modifier, boolean register) {
    2942                super(name, iconName == null ? null : ImageProvider.get(iconName));
    3043                setHelpId();
    31                 String scl = ShortCutLabel.name(shortCut, modifier);
    32                 putValue(SHORT_DESCRIPTION, "<html>"+tooltip+" <font size='-2'>"+scl+"</font>"+(scl.equals("")?"":"&nbsp;")+"</html>");
    3344                if (shortCut != 0) {
    34                         this.shortCut = KeyStroke.getKeyStroke(shortCut, modifier);
    35                         Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(this.shortCut, name);
     45                        int group = ShortCut.GROUP_LAYER; //GROUP_NONE;
     46                        if (((modifier & InputEvent.CTRL_MASK) != 0) || ((modifier & InputEvent.CTRL_DOWN_MASK) != 0)) {
     47                                group = ShortCut.GROUP_MENU;
     48                        } else if (modifier == 0) {
     49                                group = ShortCut.GROUP_EDIT;
     50                        }
     51                        sc = ShortCut.registerShortCut("auto:"+name, name, shortCut, group);
     52                        this.shortCut = sc.getKeyStroke();
     53                        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), name);
    3654                        Main.contentPane.getActionMap().put(name, this);
    3755                }
     56                putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));
    3857        putValue("toolbar", iconName);
    3958        if (register)
    4059                Main.toolbar.register(this);
    4160        }
    4261
     62        /**
     63         * The new super for all actions.
     64         *
     65         * Use this super constructor to setup your action. It takes 5 parameters:
     66         *
     67         * name - the action's text as displayed on the menu (if it is added to a menu)
     68         * iconName - the filename of the icon to use
     69         * tooltip - a longer description of the action that will be displayed in the tooltip. Please note
     70         *           that html is not supported for menu action on some platforms
     71         * shortCut - a ready-created shortcut object or null if you don't want a shortcut. But you always
     72         *            do want a shortcut, remember you can alway register it with group=none, so you
     73         *            won't be assigned a shurtcut unless the user configures one. If you pass null here,
     74         *            the user CANNOT configure a shortcut for your action.
     75         * register - register this action for the toolbar preferences?
     76         */
     77        public JosmAction(String name, String iconName, String tooltip, ShortCut shortCut, boolean register) {
     78                super(name, iconName == null ? null : ImageProvider.get(iconName));
     79                setHelpId();
     80                sc = shortCut;
     81                if (sc != null) {
     82                        this.shortCut = sc.getKeyStroke();
     83                        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), name);
     84                        Main.contentPane.getActionMap().put(name, this);
     85                }
     86                putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));
     87                putValue("toolbar", iconName);
     88    if (register)
     89        Main.toolbar.register(this);
     90        }
     91
    4392        public void destroy() {
    4493                if (shortCut != null) {
    45                         Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).remove(shortCut);
    46                         Main.contentPane.getActionMap().remove(shortCut);
     94                        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).remove(sc.getKeyStroke());
     95                        Main.contentPane.getActionMap().remove(sc.getKeyStroke());
    4796                }
    4897        }
    4998       
  • src/org/openstreetmap/josm/actions/SelectAllAction.java

     
    77import java.awt.event.KeyEvent;
    88
    99import org.openstreetmap.josm.Main;
     10import org.openstreetmap.josm.tools.ShortCut;
    1011
    1112public class SelectAllAction extends JosmAction {
    1213
    1314        public SelectAllAction() {
    14                 super(tr("Select All"),"selectall", tr("Select all undeleted objects in the data layer. This selects incomplete objects too."), KeyEvent.VK_A, KeyEvent.CTRL_DOWN_MASK, true);
     15                super(tr("Select All"),"selectall", tr("Select all undeleted objects in the data layer. This selects incomplete objects too."),
     16                ShortCut.registerShortCut("system:selectall", tr("Edit: Select all"), KeyEvent.VK_A, ShortCut.GROUP_MENU), true);
    1517    }
    1618
    1719        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/ExitAction.java

     
    77import java.awt.event.KeyEvent;
    88
    99import org.openstreetmap.josm.Main;
     10import org.openstreetmap.josm.tools.ShortCut;
    1011
    1112/**
    1213 * Exit the application. May ask for permission first (if something has changed).
     
    1819         * Construct the action with "Exit" as label
    1920         */
    2021        public ExitAction() {
    21                 super(tr("Exit"), "exit", tr("Exit the application."), KeyEvent.VK_Q, KeyEvent.CTRL_DOWN_MASK, true);
     22                super(tr("Exit"), "exit", tr("Exit the application."),
     23                ShortCut.registerShortCut("system:menuexit", tr("Quit JOSM"), KeyEvent.VK_Q, ShortCut.GROUP_MENU), true);
    2224        }
    2325
    2426        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/CopyAction.java

     
    2323import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2424import org.openstreetmap.josm.data.osm.Way;
    2525import org.openstreetmap.josm.data.osm.visitor.Visitor;
     26import org.openstreetmap.josm.tools.ShortCut;
    2627
    2728public final class CopyAction extends JosmAction implements SelectionChangedListener {
    2829
     
    3132        public CopyAction() {
    3233                super(tr("Copy"), "copy",
    3334                                tr("Copy selected objects to paste buffer."),
    34                                 KeyEvent.VK_C, KeyEvent.CTRL_MASK, true);
     35                                ShortCut.registerShortCut("system:copy", tr("Edit: Copy"), KeyEvent.VK_C, ShortCut.GROUP_MENU), true);
    3536                setEnabled(false);
    3637                DataSet.selListeners.add(this);
    3738                listeners = new LinkedList<JosmAction>();
  • src/org/openstreetmap/josm/actions/UnselectAllAction.java

     
    99import javax.swing.JComponent;
    1010
    1111import org.openstreetmap.josm.Main;
     12import org.openstreetmap.josm.tools.ShortCut;
    1213
    1314public class UnselectAllAction extends JosmAction {
    1415
    1516        public UnselectAllAction() {
    1617                super(tr("Unselect All"), "unselectall", tr("Unselect all objects."),
    17                         KeyEvent.VK_U, 0, true);
     18                ShortCut.registerShortCut("edit:unselectall", tr("Edit: Unselect all"), KeyEvent.VK_U, ShortCut.GROUP_EDIT), true);
     19                // this is not really GROUP_EDIT, but users really would complain if the yhad to reconfigure because we put
     20                // the correct group in
    1821
    1922                // Add extra shortcut C-S-a
    2023                Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
    21                         KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_DOWN_MASK
    22                                 | KeyEvent.SHIFT_DOWN_MASK), tr("Unselect All"));
     24                ShortCut.registerShortCut("edit:unselectall2", tr("Edit: Unselect all (2)"), KeyEvent.VK_A, ShortCut.GROUP_MENU).getKeyStroke(),
     25                tr("Unselect All"));
    2326
    2427                // Add extra shortcut ESCAPE
    2528                /*
     
    2831                 * for now this is a reasonable approximation.
    2932                 */
    3033                Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
    31                         KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
     34                ShortCut.registerShortCut("edit:unselectall3", tr("Edit: Unselect all (3)"), KeyEvent.VK_ESCAPE, ShortCut.GROUP_DIRECT).getKeyStroke(),
    3235                        tr("Unselect All"));
    3336        }
    3437
  • src/org/openstreetmap/josm/actions/ZoomInAction.java

     
    77import java.awt.event.KeyEvent;
    88
    99import org.openstreetmap.josm.Main;
     10import org.openstreetmap.josm.tools.ShortCut;
    1011
    1112public final class ZoomInAction extends JosmAction {
    1213
    1314        public ZoomInAction() {
    1415                super(tr("Zoom in"), "dialogs/zoomin", tr("Zoom in"),
    15                         KeyEvent.VK_PLUS, 0, true);
     16                ShortCut.registerShortCut("view:zoomin", tr("View: Zoom in"), KeyEvent.VK_PLUS, ShortCut.GROUP_DIRECT), true);
    1617                setEnabled(true);
    1718        }
    1819
  • src/org/openstreetmap/josm/actions/SplitWayAction.java

     
    3232import org.openstreetmap.josm.data.osm.Way;
    3333import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
    3434import org.openstreetmap.josm.data.osm.visitor.Visitor;
     35import org.openstreetmap.josm.tools.ShortCut;
    3536
    3637/**
    3738 * Splits a way into multiple ways (all identical except for their node list).
     
    4950         * Create a new SplitWayAction.
    5051         */
    5152        public SplitWayAction() {
    52                 super(tr("Split Way"), "splitway", tr("Split a way at the selected node."), KeyEvent.VK_P, 0, true);
     53                super(tr("Split Way"), "splitway", tr("Split a way at the selected node."),
     54                ShortCut.registerShortCut("tools:splitway", tr("Tool: Split way"), KeyEvent.VK_P, ShortCut.GROUP_EDIT), true);
    5355                DataSet.selListeners.add(this);
    5456        }
    5557
  • src/org/openstreetmap/josm/actions/ZoomOutAction.java

     
    77import java.awt.event.KeyEvent;
    88
    99import org.openstreetmap.josm.Main;
     10import org.openstreetmap.josm.tools.ShortCut;
    1011
    1112public final class ZoomOutAction extends JosmAction {
    1213
    1314        public ZoomOutAction() {
    1415                super(tr("Zoom out"), "dialogs/zoomout", tr("Zoom out"),
    15                         KeyEvent.VK_MINUS, 0, true);
     16                ShortCut.registerShortCut("view:zoomout", tr("View: Zoom out"), KeyEvent.VK_MINUS, ShortCut.GROUP_DIRECT), true);
    1617                setEnabled(true);
    1718        }
    1819
  • src/org/openstreetmap/josm/actions/SaveAsAction.java

     
    88import java.io.File;
    99
    1010import org.openstreetmap.josm.gui.layer.Layer;
     11import org.openstreetmap.josm.tools.ShortCut;
    1112
    1213/**
    1314 * Export the data.
     
    2122         * @param layer Save this layer.
    2223         */
    2324        public SaveAsAction(Layer layer) {
    24                 super(tr("Save as ..."), "save_as", tr("Save the current data to a new file."), KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK, layer);
     25                super(tr("Save as ..."), "save_as", tr("Save the current data to a new file."),
     26                ShortCut.registerShortCut("system:saveas", tr("File: Save as..."), KeyEvent.VK_S, ShortCut.GROUP_MENU), layer);
    2527        }
    2628       
    2729        @Override protected File getFile(Layer layer) {
  • src/org/openstreetmap/josm/actions/audio/AudioBackAction.java

     
    1010import org.openstreetmap.josm.actions.JosmAction;
    1111import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    1212import org.openstreetmap.josm.tools.AudioPlayer;
     13import org.openstreetmap.josm.tools.ShortCut;
    1314
    1415public class AudioBackAction extends JosmAction {
    1516
    1617        private double amount; // note, normally negative, i.e. jump backwards in time
    1718       
    1819        public AudioBackAction() {
    19                 super(tr("Back"), "audio-back", tr("Jump back."), KeyEvent.VK_F6, 0, true);
     20                super(tr("Back"), "audio-back", tr("Jump back."),
     21                ShortCut.registerShortCut("audio:back", tr("Audio: Back"), KeyEvent.VK_F6, ShortCut.GROUP_DIRECT), true);
    2022                try {
    2123                        amount = - Double.parseDouble(Main.pref.get("audio.forwardbackamount","10.0"));
    2224                } catch (NumberFormatException e) {
  • src/org/openstreetmap/josm/actions/audio/AudioFwdAction.java

     
    1010import org.openstreetmap.josm.actions.JosmAction;
    1111import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    1212import org.openstreetmap.josm.tools.AudioPlayer;
     13import org.openstreetmap.josm.tools.ShortCut;
    1314
    1415public class AudioFwdAction extends JosmAction {
    1516
    1617        private double amount;
    1718       
    1819        public AudioFwdAction() {
    19                 super(tr("Forward"), "audio-fwd", tr("Jump forward"), KeyEvent.VK_F7, 0, true);
     20                super(tr("Forward"), "audio-fwd", tr("Jump forward"),
     21                ShortCut.registerShortCut("audio:forward", tr("Audio: Forward"), KeyEvent.VK_F7, ShortCut.GROUP_DIRECT), true);
    2022                try {
    2123                        amount = Double.parseDouble(Main.pref.get("audio.forwardbackamount","10.0"));
    2224                } catch (NumberFormatException e) {
  • src/org/openstreetmap/josm/actions/audio/AudioFastSlowAction.java

     
    66import org.openstreetmap.josm.Main;
    77import org.openstreetmap.josm.actions.JosmAction;
    88import org.openstreetmap.josm.tools.AudioPlayer;
     9import org.openstreetmap.josm.tools.ShortCut;
    910
    1011abstract public class AudioFastSlowAction extends JosmAction {
    1112
    1213        private double multiplier;
    1314       
     15        public AudioFastSlowAction(String name, String iconName, String tooltip, ShortCut shortcut, boolean fast) {
     16                super(name, iconName, tooltip, shortcut, true);
     17                try {
     18                        multiplier = Double.parseDouble(Main.pref.get("audio.fastfwdmultiplier","1.3"));
     19                } catch (NumberFormatException e) {
     20                        multiplier = 1.3;
     21                }
     22                if (! fast)
     23                        multiplier = 1.0 / multiplier;
     24        }
     25
     26        @Deprecated
    1427        public AudioFastSlowAction(String name, String iconName, String tooltip, int shortcut, int modifier, boolean fast) {
    1528                super(name, iconName, tooltip, shortcut, modifier, true);
    1629                try {
  • src/org/openstreetmap/josm/actions/audio/AudioPlayPauseAction.java

     
    1010import org.openstreetmap.josm.actions.JosmAction;
    1111import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    1212import org.openstreetmap.josm.tools.AudioPlayer;
     13import org.openstreetmap.josm.tools.ShortCut;
    1314
    1415public class AudioPlayPauseAction extends JosmAction {
    1516
    1617        public AudioPlayPauseAction() {
    17                 super(tr("Play/pause"), "audio-playpause", tr("Play/pause audio."), KeyEvent.VK_PERIOD, 0, true);
     18                super(tr("Play/pause"), "audio-playpause", tr("Play/pause audio."),
     19                ShortCut.registerShortCut("audio:pause", tr("Audio: Play/Pause"), KeyEvent.VK_PERIOD, ShortCut.GROUP_DIRECT), true);
    1820        }
    1921
    2022        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/audio/AudioFasterAction.java

     
    22package org.openstreetmap.josm.actions.audio;
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
     5import org.openstreetmap.josm.tools.ShortCut;
    56
    67import java.awt.event.KeyEvent;
    78
    89public class AudioFasterAction extends AudioFastSlowAction {
    910       
    1011        public AudioFasterAction() {
    11                 super(tr("Faster"), "audio-faster", tr("Faster Forward"), KeyEvent.VK_F9, 0, true);
     12                super(tr("Faster"), "audio-faster", tr("Faster Forward"),
     13                ShortCut.registerShortCut("audio:faster", tr("Audio: Faster"), KeyEvent.VK_F9, ShortCut.GROUP_DIRECT), true);
    1214        }
    1315}
  • src/org/openstreetmap/josm/actions/audio/AudioSlowerAction.java

     
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    66import java.awt.event.KeyEvent;
     7import org.openstreetmap.josm.tools.ShortCut;
    78
    89public class AudioSlowerAction extends AudioFastSlowAction {
    910       
    1011        public AudioSlowerAction() {
    11                 super(tr("Slower"), "audio-slower", tr("Slower Forward"), KeyEvent.VK_F9, KeyEvent.SHIFT_MASK, false);
     12                super(tr("Slower"), "audio-slower", tr("Slower Forward"),
     13                ShortCut.registerShortCut("audio:slower", tr("Audio: Slower"), KeyEvent.VK_F9, ShortCut.GROUP_DIRECT), true);
    1214        }
    1315}
  • src/org/openstreetmap/josm/actions/audio/AudioPrevAction.java

     
    88
    99import org.openstreetmap.josm.actions.JosmAction;
    1010import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
     11import org.openstreetmap.josm.tools.ShortCut;
    1112
    1213public class AudioPrevAction extends JosmAction {
    1314
    1415        public AudioPrevAction() {
    15                 super(tr("Previous Marker"), "audio-prev", tr("Play previous marker."), KeyEvent.VK_F5, 0, true);
     16                super(tr("Previous Marker"), "audio-prev", tr("Play previous marker."),
     17                ShortCut.registerShortCut("audio:prev", tr("Audio: Previous"), KeyEvent.VK_F5, ShortCut.GROUP_DIRECT), true);
    1618        }
    1719
    1820        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/audio/AudioNextAction.java

     
    88
    99import org.openstreetmap.josm.actions.JosmAction;
    1010import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
     11import org.openstreetmap.josm.tools.ShortCut;
    1112
    1213public class AudioNextAction extends JosmAction {
    1314
    1415        public AudioNextAction() {
    15                 super(tr("Next Marker"), "audio-next", tr("Play next marker."), KeyEvent.VK_F8, 0, true);
     16                super(tr("Next Marker"), "audio-next", tr("Play next marker."),
     17                ShortCut.registerShortCut("audio:next", tr("Audio: Next"), KeyEvent.VK_F8, ShortCut.GROUP_DIRECT), true);
    1618        }
    1719
    1820        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/JoinNodeWayAction.java

     
    2222import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2323import org.openstreetmap.josm.data.osm.Way;
    2424import org.openstreetmap.josm.data.osm.WaySegment;
     25import org.openstreetmap.josm.tools.ShortCut;
    2526
    2627public class JoinNodeWayAction extends JosmAction {
    2728        public JoinNodeWayAction() {
    28             super(tr("Join node to way"), "joinnodeway",
    29                         tr("Join a node into the nearest way segments"), KeyEvent.VK_J, 0, true);
     29            super(tr("Join node to way"), "joinnodeway", tr("Join a node into the nearest way segments"),
     30                        ShortCut.registerShortCut("tools:joinnodeway", tr("Tool: Join node to way"), KeyEvent.VK_J, ShortCut.GROUP_EDIT), true);
    3031        }
    3132
    3233        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/search/SearchAction.java

     
    2121import org.openstreetmap.josm.actions.JosmAction;
    2222import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2323import org.openstreetmap.josm.tools.GBC;
     24import org.openstreetmap.josm.tools.ShortCut;
    2425
    2526public class SearchAction extends JosmAction {
    2627
     
    3536    private static SearchSetting lastSearch = null;
    3637
    3738    public SearchAction() {
    38         super(tr("Search ..."), "dialogs/search", tr("Search for objects."), KeyEvent.VK_F, KeyEvent.CTRL_DOWN_MASK,
    39                 true);
     39        super(tr("Search ..."), "dialogs/search", tr("Search for objects."),
     40        ShortCut.registerShortCut("system:find", tr("Search..."), KeyEvent.VK_F, ShortCut.GROUP_HOTKEY), true);
    4041    }
    4142
    4243    public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/AlignInLineAction.java

     
    1717import org.openstreetmap.josm.data.osm.Node;
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1919import org.openstreetmap.josm.data.osm.Way;
     20import org.openstreetmap.josm.tools.ShortCut;
    2021
    2122/**
    2223 * Aligns all selected nodes into a straight line (useful for
     
    2829public final class AlignInLineAction extends JosmAction {
    2930
    3031        public AlignInLineAction() {
    31                 super(tr("Align Nodes in Line"), "alignline", tr("Move the selected nodes onto a line."), KeyEvent.VK_L, 0, true);
     32                super(tr("Align Nodes in Line"), "alignline", tr("Move the selected nodes onto a line."),
     33                ShortCut.registerShortCut("tools:alignline", tr("Tool: Align in line"), KeyEvent.VK_L, ShortCut.GROUP_EDIT), true);
    3234        }
    3335
    3436        /**
  • src/org/openstreetmap/josm/actions/ReverseWayAction.java

     
    2424import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2525import org.openstreetmap.josm.data.osm.Way;
    2626import org.openstreetmap.josm.data.osm.visitor.Visitor;
     27import org.openstreetmap.josm.tools.ShortCut;
    2728
    2829public final class ReverseWayAction extends JosmAction {
    2930
    3031        public ReverseWayAction() {
    31                 super(tr("Reverse ways"), "wayflip",
    32                         tr("Reverse the direction of all selected ways."),
    33                         KeyEvent.VK_R, 0, true);
     32                super(tr("Reverse ways"), "wayflip", tr("Reverse the direction of all selected ways."),
     33                ShortCut.registerShortCut("tools:reverse", tr("Tool: Reverse way"), KeyEvent.VK_R, ShortCut.GROUP_EDIT), true);
    3434        }
    3535
    3636        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/UnGlueAction.java

     
    2525import org.openstreetmap.josm.data.osm.Relation;
    2626import org.openstreetmap.josm.data.osm.RelationMember;
    2727import org.openstreetmap.josm.data.osm.Way;
     28import org.openstreetmap.josm.tools.ShortCut;
    2829
    2930/**
    3031 * Dupe a node that is used my multiple ways, so each way has its own node.
     
    4344         * Create a new SplitWayAction.
    4445         */
    4546        public UnGlueAction() {
    46                 super(tr("UnGlue Ways"), "unglueways", tr("Duplicate the selected node so each way using it has its own copy."), KeyEvent.VK_G, 0, true);
     47                super(tr("UnGlue Ways"), "unglueways", tr("Duplicate the selected node so each way using it has its own copy."),
     48                ShortCut.registerShortCut("tools:unglue", tr("Tool: Unglue"), KeyEvent.VK_G, ShortCut.GROUP_EDIT), true);
    4749                DataSet.selListeners.add(this);
    4850        }
    4951
  • src/org/openstreetmap/josm/actions/GpxExportAction.java

     
    3333import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3434import org.openstreetmap.josm.io.GpxWriter;
    3535import org.openstreetmap.josm.tools.GBC;
     36import org.openstreetmap.josm.tools.ShortCut;
    3637
    3738/**
    3839 * Exports data to gpx.
     
    4445        private final Layer layer;
    4546
    4647        public GpxExportAction(Layer layer) {
    47                 super(tr("Export to GPX ..."), "exportgpx", tr("Export the data to GPX file."), KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK);
     48                super(tr("Export to GPX ..."), "exportgpx", tr("Export the data to GPX file."),
     49                ShortCut.registerShortCut("file:exportgpx", tr("Export to GPX"), KeyEvent.VK_E, ShortCut.GROUP_MENU));
    4850                this.layer = layer;
    4951        }
    5052
  • src/org/openstreetmap/josm/actions/DeleteAction.java

     
    77import java.awt.event.KeyEvent;
    88
    99import org.openstreetmap.josm.Main;
     10import org.openstreetmap.josm.tools.ShortCut;
    1011
    1112public final class DeleteAction extends JosmAction {
    1213
    1314        public DeleteAction() {
    1415                super(tr("Delete"), "dialogs/delete", tr("Delete selected objects."),
    15                         KeyEvent.VK_DELETE, 0, true);
     16                ShortCut.registerShortCut("system:delete", tr("Edit: Delete"), KeyEvent.VK_DELETE, ShortCut.GROUP_DIRECT), true);
    1617                setEnabled(true);
    1718        }
    1819
  • src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

     
    1515import org.openstreetmap.josm.data.osm.WaySegment;
    1616import org.openstreetmap.josm.gui.MapFrame;
    1717import org.openstreetmap.josm.tools.ImageProvider;
     18import org.openstreetmap.josm.tools.ShortCut;
    1819
    1920/**
    2021 * An action that enables the user to delete nodes and other objects.
     
    4243                super(tr("Delete Mode"),
    4344                                "delete",
    4445                                tr("Delete nodes or ways."),
    45                                 KeyEvent.VK_D,
     46                                ShortCut.registerShortCut("mapmode:delete", tr("Delete mode"), KeyEvent.VK_D, ShortCut.GROUP_EDIT),
    4647                                mapFrame,
    4748                                ImageProvider.getCursor("normal", "delete"));
    4849        }
  • src/org/openstreetmap/josm/actions/mapmode/MapMode.java

     
    1111import org.openstreetmap.josm.actions.JosmAction;
    1212import org.openstreetmap.josm.gui.MapFrame;
    1313import org.openstreetmap.josm.tools.ImageProvider;
     14import org.openstreetmap.josm.tools.ShortCut;
    1415
    1516/**
    1617 * A class implementing MapMode is able to be selected as an mode for map editing.
     
    2728        /**
    2829         * Constructor for mapmodes without an menu
    2930         */
     31        public MapMode(String name, String iconName, String tooltip, ShortCut shortCut, MapFrame mapFrame, Cursor cursor) {
     32                super(name, "mapmode/"+iconName, tooltip, shortCut, false);
     33                this.cursor = cursor;
     34                putValue("active", false);
     35        }
     36
     37        /**
     38         * Constructor for mapmodes without an menu
     39         */
     40         @Deprecated
    3041        public MapMode(String name, String iconName, String tooltip, int keystroke, MapFrame mapFrame, Cursor cursor) {
    3142                super(name, "mapmode/"+iconName, tooltip, keystroke, 0, false);
    3243                this.cursor = cursor;
  • src/org/openstreetmap/josm/actions/mapmode/ZoomAction.java

     
    1212import org.openstreetmap.josm.gui.SelectionManager;
    1313import org.openstreetmap.josm.gui.SelectionManager.SelectionEnded;
    1414import org.openstreetmap.josm.tools.ImageProvider;
     15import org.openstreetmap.josm.tools.ShortCut;
    1516
    1617/**
    1718 * Enable the zoom mode within the MapFrame.
     
    4445         * @param mapFrame The MapFrame, whose zoom mode should be enabled.
    4546         */
    4647        public ZoomAction(MapFrame mapFrame) {
    47                 super(tr("Zoom"), "zoom", tr("Zoom and move map"), KeyEvent.VK_Z, mapFrame, ImageProvider.getCursor("normal", "zoom"));
     48                super(tr("Zoom"), "zoom", tr("Zoom and move map"),
     49                ShortCut.registerShortCut("mapmode:zoom", tr("Zoom mode"), KeyEvent.VK_Z, ShortCut.GROUP_EDIT),
     50                mapFrame, ImageProvider.getCursor("normal", "zoom"));
    4851                mv = mapFrame.mapView;
    4952                selectionManager = new SelectionManager(this, true, mv);
    5053        }
  • src/org/openstreetmap/josm/actions/mapmode/PlayHeadDragMode.java

     
    1111import org.openstreetmap.josm.Main;
    1212import org.openstreetmap.josm.data.coor.EastNorth;
    1313import org.openstreetmap.josm.gui.layer.markerlayer.PlayHeadMarker;
     14import org.openstreetmap.josm.tools.ShortCut;
    1415
    1516/**
    1617 * Singleton marker class to track position of audio.
     
    2627        private PlayHeadMarker playHeadMarker = null;
    2728       
    2829        public PlayHeadDragMode(PlayHeadMarker m) {
    29                 super("play head drag", "playheaddrag", "play head trag", 0, Main.map, Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
     30                super("play head drag", "playheaddrag", "play head drag", null,
     31                Main.map, Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
    3032                playHeadMarker = m;
    3133        }
    3234       
  • src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

     
    5151import org.openstreetmap.josm.gui.layer.MapViewPaintable;
    5252import org.openstreetmap.josm.tools.ImageProvider;
    5353import org.openstreetmap.josm.tools.Pair;
     54import org.openstreetmap.josm.tools.ShortCut;
    5455
    5556/**
    5657 *
     
    7374       
    7475        public DrawAction(MapFrame mapFrame) {
    7576                super(tr("Draw"), "node/autonode", tr("Draw nodes"),
    76                         KeyEvent.VK_A, mapFrame, getCursor());
     77                                ShortCut.registerShortCut("mapmode:draw", tr("Draw mode"), KeyEvent.VK_A, ShortCut.GROUP_EDIT),
     78                                mapFrame, getCursor());
    7779
    7880                // Add extra shortcut N
    7981                Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
    80                         KeyStroke.getKeyStroke(KeyEvent.VK_N, 0), tr("Draw"));
     82                        ShortCut.registerShortCut("mapmode:draw2", tr("Draw mode (2)"), KeyEvent.VK_N, ShortCut.GROUP_EDIT).getKeyStroke(), tr("Draw"));
    8183               
    8284                //putValue("help", "Action/AddNode/Autnode");
    8385                selectedColor = Main.pref.getColor(marktr("selected"), Color.YELLOW);
  • src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

     
    3535import org.openstreetmap.josm.gui.SelectionManager;
    3636import org.openstreetmap.josm.gui.SelectionManager.SelectionEnded;
    3737import org.openstreetmap.josm.tools.ImageProvider;
     38import org.openstreetmap.josm.tools.ShortCut;
     39
    3840/**
    3941 * Move is an action that can move all kind of OsmPrimitives (except keys for now).
    4042 *
     
    8385         */
    8486        public SelectAction(MapFrame mapFrame) {
    8587                super(tr("Select"), "move/move", tr("Select, move and rotate objects"),
    86                         KeyEvent.VK_S, mapFrame,
     88                        ShortCut.registerShortCut("mapmode:select", tr("Select mode"), KeyEvent.VK_S, ShortCut.GROUP_EDIT),
     89                        mapFrame,
    8790                        getCursor("normal", "selection", Cursor.DEFAULT_CURSOR));
    8891                putValue("help", "Action/Move/Move");
    8992                selectionManager = new SelectionManager(this, false, mapFrame.mapView);         
  • src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

     
    2929import org.openstreetmap.josm.gui.MapView;
    3030import org.openstreetmap.josm.gui.layer.MapViewPaintable;
    3131import org.openstreetmap.josm.tools.ImageProvider;
     32import org.openstreetmap.josm.tools.ShortCut;
     33
    3234/**
    3335 * Makes a rectangle from a line, or modifies a rectangle.
    3436 *
     
    7173         */
    7274        public ExtrudeAction(MapFrame mapFrame) {
    7375                super(tr("Extrude"), "extrude/extrude", tr("Create areas"),
    74                         KeyEvent.VK_X, mapFrame,
     76                                ShortCut.registerShortCut("mapmode:extrude", tr("Extrude mode"), KeyEvent.VK_X, ShortCut.GROUP_EDIT),
     77                        mapFrame,
    7578                        getCursor("normal", "selection", Cursor.DEFAULT_CURSOR));
    7679                putValue("help", "Action/Extrude/Extrude");
    7780                initialMoveDelay = Main.pref.getInteger("edit.initial-move-delay",200);
  • src/org/openstreetmap/josm/actions/UndoAction.java

     
    88import java.awt.event.KeyEvent;
    99
    1010import org.openstreetmap.josm.Main;
     11import org.openstreetmap.josm.tools.ShortCut;
    1112
    12 
    1313/**
    1414 * Undoes the last command.
    1515 *
     
    2121         * Construct the action with "Undo" as label.
    2222         */
    2323        public UndoAction() {
    24                 super(tr("Undo"), "undo", tr("Undo the last action."), KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK, true);
     24                super(tr("Undo"), "undo", tr("Undo the last action."),
     25                ShortCut.registerShortCut("system:undo", tr("Edit: Undo"), KeyEvent.VK_Z, ShortCut.GROUP_MENU), true);
    2526                setEnabled(false);
    2627        }
    2728
  • src/org/openstreetmap/josm/actions/AlignInRectangleAction.java

     
    1919import org.openstreetmap.josm.data.osm.Node;
    2020import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2121import org.openstreetmap.josm.data.osm.Way;
     22import org.openstreetmap.josm.tools.ShortCut;
    2223
    2324/**
    2425 * Aligns all selected nodes within a rectangle.
     
    3940public final class AlignInRectangleAction extends JosmAction {
    4041
    4142        public AlignInRectangleAction() {
    42                 super(tr("Align Nodes in Rectangle"), "alignrect", tr("Move the selected nodes into a rectangle."), KeyEvent.VK_Q, 0, true);
     43                super(tr("Align Nodes in Rectangle"), "alignrect", tr("Move the selected nodes into a rectangle."),
     44                ShortCut.registerShortCut("tools:alignrect", tr("Tool: Align in rectangle"), KeyEvent.VK_Q, ShortCut.GROUP_EDIT), true);
    4345        }
    4446
    4547        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/DownloadAction.java

     
    1616import org.openstreetmap.josm.gui.download.DownloadDialog;
    1717import org.openstreetmap.josm.gui.download.DownloadDialog.DownloadTask;
    1818import org.openstreetmap.josm.tools.GBC;
     19import org.openstreetmap.josm.tools.ShortCut;
    1920
    2021/**
    2122 * Action that opens a connection to the osm server and downloads map data.
     
    3031        public DownloadDialog dialog;
    3132       
    3233        public DownloadAction() {
    33                 super(tr("Download from OSM ..."), "download", tr("Download map data from the OSM server."), KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK, true);
     34                super(tr("Download from OSM ..."), "download", tr("Download map data from the OSM server."),
     35                ShortCut.registerShortCut("file:download", tr("File: Download"), KeyEvent.VK_D, ShortCut.GROUPS_ALT1+ShortCut.GROUP_HOTKEY), true);
    3436        }
    3537
    3638        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/DuplicateAction.java

     
    1212import org.openstreetmap.josm.data.SelectionChangedListener;
    1313import org.openstreetmap.josm.data.osm.DataSet;
    1414import org.openstreetmap.josm.data.osm.OsmPrimitive;
     15import org.openstreetmap.josm.tools.ShortCut;
    1516
    1617public final class DuplicateAction extends JosmAction implements SelectionChangedListener {
    1718
    1819    public DuplicateAction() {
    1920        super(tr("Duplicate"), "duplicate",
    2021                        tr("Duplicate selection by copy and immediate paste."),
    21                         KeyEvent.VK_D, KeyEvent.CTRL_MASK, true);
     22                        ShortCut.registerShortCut("system:duplicate", tr("Edit: Duplicate selection"), KeyEvent.VK_D, ShortCut.GROUP_MENU), true);
    2223        setEnabled(false);
    2324                DataSet.selListeners.add(this);
    2425    }
  • src/org/openstreetmap/josm/actions/AboutAction.java

     
    3333import org.openstreetmap.josm.tools.GBC;
    3434import org.openstreetmap.josm.tools.ImageProvider;
    3535import org.openstreetmap.josm.tools.UrlLabel;
     36import org.openstreetmap.josm.tools.ShortCut;
    3637
    3738/**
    3839 * Nice about screen. I guess every application need one these days.. *sigh*
     
    6667        }
    6768       
    6869        public AboutAction() {
    69                 super(tr("About"), "about",tr("Display the about screen."), KeyEvent.VK_F1, KeyEvent.SHIFT_DOWN_MASK, true);
     70                super(tr("About"), "about", tr("Display the about screen."), ShortCut.registerShortCut("system:about", tr("About..."), KeyEvent.VK_F1, ShortCut.GROUP_DIRECT), true);
    7071        }
    7172
    7273        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/PasteAction.java

     
    2323import org.openstreetmap.josm.data.osm.RelationMember;
    2424import org.openstreetmap.josm.data.osm.Way;
    2525import org.openstreetmap.josm.data.coor.EastNorth;
     26import org.openstreetmap.josm.tools.ShortCut;
    2627
    2728public final class PasteAction extends JosmAction {
    2829
    2930    public PasteAction() {
    30         super(tr("Paste"), "paste",
    31                         tr("Paste contents of paste buffer."),
    32                         KeyEvent.VK_V, KeyEvent.CTRL_MASK, true);
     31        super(tr("Paste"), "paste", tr("Paste contents of paste buffer."),
     32                        ShortCut.registerShortCut("system:paste", tr("Edit: Paste"), KeyEvent.VK_V, ShortCut.GROUP_MENU), true);
    3333                setEnabled(false);
    3434    }
    3535
  • src/org/openstreetmap/josm/actions/DiskAccessAction.java

     
    99import javax.swing.JOptionPane;
    1010
    1111import org.openstreetmap.josm.Main;
     12import org.openstreetmap.josm.tools.ShortCut;
    1213
    1314/**
    1415 * Helper class for all actions that access the disk
    1516 */
    1617abstract public class DiskAccessAction extends JosmAction {
    1718
     19        public DiskAccessAction(String name, String iconName, String tooltip, ShortCut shortCut) {
     20                super(name, iconName, tooltip, shortCut, true);
     21        }
     22
     23        @Deprecated
    1824        public DiskAccessAction(String name, String iconName, String tooltip, int shortCut, int modifiers) {
    1925                super(name, iconName, tooltip, shortCut, modifiers, true);
    2026        }
  • src/org/openstreetmap/josm/actions/HistoryInfoAction.java

     
    1313import org.openstreetmap.josm.data.osm.Way;
    1414import org.openstreetmap.josm.data.osm.visitor.Visitor;
    1515import org.openstreetmap.josm.tools.OpenBrowser;
     16import org.openstreetmap.josm.tools.ShortCut;
    1617
    1718public class HistoryInfoAction extends JosmAction {
    1819
    1920        public HistoryInfoAction() {
    20                 super(tr("OSM History Information"), "about",tr("Display history information about OSM ways or nodes."), KeyEvent.VK_H, KeyEvent.SHIFT_DOWN_MASK, true);
     21                super(tr("OSM History Information"), "about",tr("Display history information about OSM ways or nodes."),
     22                ShortCut.registerShortCut("core:history", tr("Display history"), KeyEvent.VK_H, ShortCut.GROUP_HOTKEY), true);
    2123        }
    2224
    2325        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/AutoScaleAction.java

     
    1414import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1515import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    1616import org.openstreetmap.josm.gui.layer.Layer;
     17import org.openstreetmap.josm.tools.ShortCut;
    1718
    1819/**
    1920 * Toggles the autoScale feature of the mapView
     
    4546
    4647    public AutoScaleAction(String mode) {
    4748        super(tr("Zoom to {0}", tr(mode)), "dialogs/autoscale/" + mode, tr("Zoom the view to {0}.", tr(mode)),
    48                 AutoScaleAction.getModeShortcut(mode), 0, true);
     49                                ShortCut.registerShortCut("view:zoom"+mode, tr("View: Zoom to {0}", tr(mode)), getModeShortcut(mode), ShortCut.GROUP_EDIT), true);
    4950        String modeHelp = Character.toUpperCase(mode.charAt(0)) + mode.substring(1);
    5051        putValue("help", "Action/AutoScale/" + modeHelp);
    5152        this.mode = mode;
  • src/org/openstreetmap/josm/actions/UploadAction.java

     
    2323import org.openstreetmap.josm.io.OsmServerWriter;
    2424import org.openstreetmap.josm.tools.GBC;
    2525import org.xml.sax.SAXException;
     26import org.openstreetmap.josm.tools.ShortCut;
    2627
    2728/**
    2829 * Action that opens a connection to the osm server and uploads all changes.
     
    5960        public final LinkedList<UploadHook> uploadHooks = new LinkedList<UploadHook>();
    6061
    6162        public UploadAction() {
    62                 super(tr("Upload to OSM ..."), "upload", tr("Upload all changes to the OSM server."), KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK, true);
     63                super(tr("Upload to OSM ..."), "upload", tr("Upload all changes to the OSM server."),
     64                ShortCut.registerShortCut("file:upload", tr("File: Upload"), KeyEvent.VK_U, ShortCut.GROUPS_ALT1+ShortCut.GROUP_HOTKEY), true);
    6365
    6466                /**
    6567                 * Displays a screen where the actions that would be taken are displayed and
  • src/org/openstreetmap/josm/actions/CreateCircleAction.java

     
    1919import org.openstreetmap.josm.data.osm.Node;
    2020import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2121import org.openstreetmap.josm.data.osm.Way;
     22import org.openstreetmap.josm.tools.ShortCut;
    2223
    2324/**
    2425 * Create a new circle from three selected nodes--or a way with 3 nodes. (Useful for roundabouts)
     26 *
    2527 * Note: If a way is selected, it is changed. If nodes are selected a new way is created.
    2628 *       So if you've got a way with 3 nodes it makes a difference between running this on the way or the nodes!
     29 *
    2730 * BTW: Someone might want to implement projection corrections for this...
    2831 *
    2932 * @author Henry Loenwind, based on much copy&Paste from other Actions.
     
    3134public final class CreateCircleAction extends JosmAction {
    3235
    3336        public CreateCircleAction() {
    34                 super(tr("Create Circle"), "createcircle", tr("Create a circle from three selected nodes."), KeyEvent.VK_O, KeyEvent.CTRL_MASK, true);
     37                super(tr("Create Circle"), "createcircle", tr("Create a circle from three selected nodes."),
     38                ShortCut.registerShortCut("tools:createcircle", tr("Tool: Create circle"), KeyEvent.VK_O, ShortCut.GROUP_EDIT), true);
    3539        }
    3640
    3741        private double calcang(double xc, double yc, double x, double y) {
  • src/org/openstreetmap/josm/actions/MergeNodesAction.java

     
    3939import org.openstreetmap.josm.data.osm.visitor.CollectBackReferencesVisitor;
    4040import org.openstreetmap.josm.tools.GBC;
    4141import org.openstreetmap.josm.tools.Pair;
     42import org.openstreetmap.josm.tools.ShortCut;
    4243
    4344
    4445/**
     
    5152public class MergeNodesAction extends JosmAction implements SelectionChangedListener {
    5253
    5354        public MergeNodesAction() {
    54                 super(tr("Merge Nodes"), "mergenodes", tr("Merge nodes into one."), KeyEvent.VK_M, 0, true);
     55                super(tr("Merge Nodes"), "mergenodes", tr("Merge nodes into the oldest one."),
     56                ShortCut.registerShortCut("tools:mergenodes", tr("Tool: Merge nodes"), KeyEvent.VK_M, ShortCut.GROUP_EDIT), true);
    5557                DataSet.selListeners.add(this);
    5658        }
    5759
  • src/org/openstreetmap/josm/actions/SaveActionBase.java

     
    2121import org.openstreetmap.josm.gui.layer.GpxLayer;
    2222import org.openstreetmap.josm.io.OsmWriter;
    2323import org.openstreetmap.josm.io.GpxWriter;
     24import org.openstreetmap.josm.tools.ShortCut;
    2425
    2526public abstract class SaveActionBase extends DiskAccessAction {
    2627
    2728        private Layer layer;
    2829
     30        public SaveActionBase(String name, String iconName, String tooltip, ShortCut shortCut, Layer layer) {
     31                super(name, iconName, tooltip, shortCut);
     32                this.layer = layer;
     33        }
     34
     35        @Deprecated
    2936        public SaveActionBase(String name, String iconName, String tooltip, int shortCut, int modifiers, Layer layer) {
    3037                super(name, iconName, tooltip, shortCut, modifiers);
    3138                this.layer = layer;
  • src/org/openstreetmap/josm/actions/RedoAction.java

     
    88import java.awt.event.KeyEvent;
    99
    1010import org.openstreetmap.josm.Main;
     11import org.openstreetmap.josm.tools.ShortCut;
    1112
    12 
    1313/**
    1414 * Redoes the last command.
    1515 *
     
    2121         * Construct the action with "Redo" as label.
    2222         */
    2323        public RedoAction() {
    24                 super(tr("Redo"), "redo", tr("Redo the last undone action."), KeyEvent.VK_Y, InputEvent.CTRL_DOWN_MASK, true);
     24                super(tr("Redo"), "redo", tr("Redo the last undone action."),
     25                ShortCut.registerShortCut("system:redo", tr("Edit: Redo"), KeyEvent.VK_Y, ShortCut.GROUP_MENU), true);
    2526                setEnabled(false);
    2627        }
    2728
  • src/org/openstreetmap/josm/actions/NewAction.java

     
    1010import org.openstreetmap.josm.Main;
    1111import org.openstreetmap.josm.data.osm.DataSet;
    1212import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     13import org.openstreetmap.josm.tools.ShortCut;
    1314
    1415public class NewAction extends JosmAction {
    1516
    1617        public NewAction() {
    17                 super(tr("New"), "new", tr("Create a new map."), KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK, true);
     18                super(tr("New"), "new", tr("Create a new map."),
     19                ShortCut.registerShortCut("system:new", tr("File: New"), KeyEvent.VK_N, ShortCut.GROUP_MENU), true);
    1820        }
    1921
    2022        public void actionPerformed(ActionEvent e) {
  • src/org/openstreetmap/josm/actions/PasteTagsAction.java

     
    1919import org.openstreetmap.josm.data.SelectionChangedListener;
    2020import org.openstreetmap.josm.data.osm.DataSet;
    2121import org.openstreetmap.josm.data.osm.OsmPrimitive;
     22import org.openstreetmap.josm.tools.ShortCut;
    2223
    2324public final class PasteTagsAction extends JosmAction implements SelectionChangedListener {
    2425
    2526        public PasteTagsAction(JosmAction copyAction) {
    2627                super(tr("Paste Tags"), "pastetags",
    2728                        tr("Apply tags of contents of paste buffer to all selected items."),
    28                         KeyEvent.VK_V, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK, true);
     29                        ShortCut.registerShortCut("system:pastestyle", tr("Edit: Paste tags"), KeyEvent.VK_V, ShortCut.GROUP_MENU), true);
    2930                DataSet.selListeners.add(this);
    3031                copyAction.addListener(this);
    3132                setEnabled(false);
  • src/org/openstreetmap/josm/actions/CombineWayAction.java

     
    3939import org.openstreetmap.josm.data.osm.Way;
    4040import org.openstreetmap.josm.tools.GBC;
    4141import org.openstreetmap.josm.tools.Pair;
     42import org.openstreetmap.josm.tools.ShortCut;
    4243
    4344/**
    4445 * Combines multiple ways into one.
     
    4849public class CombineWayAction extends JosmAction implements SelectionChangedListener {
    4950
    5051        public CombineWayAction() {
    51                 super(tr("Combine Way"), "combineway", tr("Combine several ways into one."), KeyEvent.VK_C, 0, true);
     52                super(tr("Combine Way"), "combineway", tr("Combine several ways into one."),
     53                ShortCut.registerShortCut("tools:combineway", tr("Tool: Combine ways"), KeyEvent.VK_C, ShortCut.GROUP_EDIT), true);
    5254                DataSet.selListeners.add(this);
    5355        }
    5456
  • src/org/openstreetmap/josm/actions/SaveAction.java

     
    1010import org.openstreetmap.josm.gui.layer.Layer;
    1111import org.openstreetmap.josm.gui.layer.GpxLayer;
    1212import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     13import org.openstreetmap.josm.tools.ShortCut;
    1314
    1415/**
    1516 * Export the data as an OSM xml file.
     
    2324         * @param layer Save this layer.
    2425         */
    2526        public SaveAction(Layer layer) {
    26                 super(tr("Save"), "save", tr("Save the current data."), KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK, layer);
     27                super(tr("Save"), "save", tr("Save the current data."),
     28                ShortCut.registerShortCut("system:save", tr("File: Save"), KeyEvent.VK_S, ShortCut.GROUP_MENU), layer);
    2729        }
    2830       
    2931        @Override public File getFile(Layer layer) {
  • src/org/openstreetmap/josm/tools/OpenBrowser.java

     
    1111
    1212/**
    1313 * Helper to open platform web browser on different platforms
     14 *
     15 * This now delegates the real work to a platform specific class.
     16 *
    1417 * @author Imi
    1518 */
    1619public class OpenBrowser {
     
    2932                        }
    3033                }
    3134
    32                 String os = System.getProperty("os.name");
    33                 if (os == null)
    34                         return "unknown operating system";
    3535                try {
    36                         if (os != null && os.startsWith("Windows"))
    37                                 windows(url);
    38                         else if (os.equals("Linux") || os.equals("Solaris") || os.equals("SunOS") || os.equals("AIX") || os.equals("FreeBSD"))
    39                                 linux(url);
    40                         else if (os.equals("Mac OS") || os.equals("Mac OS X"))
    41                                 mac(url);
    42                         else
    43                                 return "unknown operating system";
     36                        Main.platform.openUrl(url);
    4437                } catch (IOException e) {
    4538                        return e.getMessage();
    4639                }
    4740                return null;
    4841        }
    4942
    50         private static void windows(String url) throws IOException {
    51                 Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
    5243        }
    53 
    54         private static void linux(String url) {
    55                 String[] programs = {"gnome-open", "kfmclient openURL", "firefox"};
    56                 for (String program : programs) {
    57                         try {
    58                                 Runtime.getRuntime().exec(program+" "+url);
    59                                 return;
    60                         } catch (IOException e) {
    61             }
    62                 }
    63         }
    64 
    65         private static void mac(String url) throws IOException {
    66                 Runtime.getRuntime().exec("open " + url);
    67         }
    68 }
  • src/org/openstreetmap/josm/tools/ShortCutLabel.java

     
    55
    66import java.awt.event.KeyEvent;
    77
    8 
     8@Deprecated
    99public class ShortCutLabel {
     10        @Deprecated
    1011        public static String name(int shortCut, int modifiers) {
    1112                if (shortCut == 0 && modifiers == 0)
    1213                        return "";
  • src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

     
    4242import org.openstreetmap.josm.gui.NavigatableComponent;
    4343import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    4444import org.openstreetmap.josm.gui.SideButton;
     45import org.openstreetmap.josm.tools.ShortCut;
    4546
    4647public final class ConflictDialog extends ToggleDialog {
    4748
     
    5051        private final JList displaylist = new JList(model);
    5152
    5253        public ConflictDialog() {
    53                 super(tr("Conflict"), "conflict", tr("Merging conflicts."), KeyEvent.VK_C, 100);
     54                super(tr("Conflict"), "conflict", tr("Merging conflicts."),
     55                ShortCut.registerShortCut("subwindow:conflict", tr("Toggle conflict window"), KeyEvent.VK_C, ShortCut.GROUP_LAYER), 100);
    5456                displaylist.setCellRenderer(new OsmPrimitivRenderer());
    5557                displaylist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    5658                displaylist.addMouseListener(new MouseAdapter(){
  • src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java

     
    3737import org.openstreetmap.josm.gui.SideButton;
    3838import org.openstreetmap.josm.tools.GBC;
    3939import org.openstreetmap.josm.tools.ImageProvider;
     40import org.openstreetmap.josm.tools.ShortCut;
    4041
    4142/**
    4243 * History dialog works like follows:
     
    8687        private JLabel notLoaded = new JLabel("<html><i>"+tr("Click Reload to refresh list")+"</i></html>");
    8788
    8889        public HistoryDialog() {
    89                 super(tr("History"), "history", tr("Display the history of all selected items."), KeyEvent.VK_H, 150);
     90                super(tr("History"), "history", tr("Display the history of all selected items."),
     91                ShortCut.registerShortCut("subwindow:history", tr("Toggle history window"), KeyEvent.VK_H, ShortCut.GROUP_LAYER), 150);
    9092                historyPane.setVisible(false);
    9193                notLoaded.setVisible(true);
    9294                notLoaded.setHorizontalAlignment(JLabel.CENTER);
  • src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

     
    4040import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    4141import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    4242import org.openstreetmap.josm.gui.SideButton;
     43import org.openstreetmap.josm.tools.ShortCut;
    4344
    4445/**
    4546 * A small tool dialog for displaying the current selection. The selection manager
     
    7576    private Collection<? extends OsmPrimitive> historyIgnoreSelection = null;
    7677
    7778    public SelectionListDialog() {
    78         super(tr("Current Selection"), "selectionlist", tr("Open a selection list window."), KeyEvent.VK_T, 150);
     79        super(tr("Current Selection"), "selectionlist", tr("Open a selection list window."),
     80        ShortCut.registerShortCut("subwindow:selection", tr("Toggle selection window"), KeyEvent.VK_T, ShortCut.GROUP_LAYER), 150);
    7981
    8082        selectionHistory = new LinkedList<Collection<? extends OsmPrimitive>>();
    8183        popupMenu = new JPopupMenu();
  • src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

     
    2626import org.openstreetmap.josm.actions.HelpAction.Helpful;
    2727import org.openstreetmap.josm.tools.GBC;
    2828import org.openstreetmap.josm.tools.ImageProvider;
     29import org.openstreetmap.josm.tools.ShortCut;
    2930
    3031/**
    3132 * This class is a toggle dialog that can be turned on and off. It is attached
     
    3940                public final String prefname;
    4041                public AbstractButton button;
    4142
    42                 private ToggleDialogAction(String name, String iconName, String tooltip, int shortCut, int modifier, String prefname) {
    43                         super(name, iconName, tooltip, shortCut, modifier, false);
     43                private ToggleDialogAction(String name, String iconName, String tooltip, ShortCut shortCut, String prefname) {
     44                        super(name, iconName, tooltip, shortCut, false);
    4445                        this.prefname = prefname;
    4546                }
    4647
     
    6162        public JPanel parent;
    6263        private final JPanel titleBar = new JPanel(new GridBagLayout());
    6364
     65        @Deprecated
    6466        public ToggleDialog(final String name, String iconName, String tooltip, int shortCut, int preferredHeight) {
    6567                super(new BorderLayout());
    6668                this.prefName = iconName;
     69                ToggleDialogInit(name, iconName, tooltip, ShortCut.registerShortCut("auto:"+name, tooltip, shortCut, ShortCut.GROUP_LAYER), preferredHeight);
     70        }
     71
     72        public ToggleDialog(final String name, String iconName, String tooltip, ShortCut shortCut, int preferredHeight) {
     73                super(new BorderLayout());
     74                this.prefName = iconName;
     75                ToggleDialogInit(name, iconName, tooltip, shortCut, preferredHeight);
     76        }
     77
     78        private void ToggleDialogInit(final String name, String iconName, String tooltip, ShortCut shortCut, int preferredHeight) {
    6779                setPreferredSize(new Dimension(330,preferredHeight));
    68                 action = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortCut, KeyEvent.ALT_MASK, iconName);
     80                action = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortCut, iconName);
    6981                String helpId = "Dialog/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1);
    7082                action.putValue("help", helpId.substring(0, helpId.length()-6));
    7183                setLayout(new BorderLayout());
  • src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java

     
    1919import org.openstreetmap.josm.command.Command;
    2020import org.openstreetmap.josm.gui.MapFrame;
    2121import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
     22import org.openstreetmap.josm.tools.ShortCut;
    2223
    2324public class CommandStackDialog extends ToggleDialog implements CommandQueueListener {
    2425
     
    2627    private JTree tree = new JTree(treeModel);
    2728
    2829        public CommandStackDialog(final MapFrame mapFrame) {
    29                 super(tr("Command Stack"), "commandstack", tr("Open a list of all commands (undo buffer)."), KeyEvent.VK_O, 100);
     30                super(tr("Command Stack"), "commandstack", tr("Open a list of all commands (undo buffer)."),
     31                ShortCut.registerShortCut("subwindow:commandstack", tr("Toggle command stack"), KeyEvent.VK_O, ShortCut.GROUP_LAYER), 100);
    3032                Main.main.undoRedo.listenerCommands.add(this);
    3133                       
    3234                tree.setRootVisible(false);
  • src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

     
    3939import org.openstreetmap.josm.tools.DontShowAgainInfo;
    4040import org.openstreetmap.josm.tools.ImageProvider;
    4141import org.openstreetmap.josm.tools.ImageProvider.OverlayPosition;
     42import org.openstreetmap.josm.tools.ShortCut;
    4243
    4344/**
    4445 * A component that manages the list of all layers and react to selection changes
     
    157158         * Create an layerlist and attach it to the given mapView.
    158159         */
    159160        public LayerListDialog(MapFrame mapFrame) {
    160                 super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."), KeyEvent.VK_L, 100);
     161                super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."),
     162                ShortCut.registerShortCut("subwindow:layers", tr("Toggle layer window"), KeyEvent.VK_L, ShortCut.GROUP_LAYER), 100);
    161163                instance = new JList(model);
    162164                listScrollPane = new JScrollPane(instance);
    163165                add(listScrollPane, BorderLayout.CENTER);
  • src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

     
    3131import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3232import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
    3333import org.openstreetmap.josm.tools.GBC;
     34import org.openstreetmap.josm.tools.ShortCut;
    3435
    3536/**
    3637 * A dialog showing all known relations, with buttons to add, edit, and
     
    5455        private JList displaylist = new JList(list);
    5556
    5657        public RelationListDialog() {
    57                 super(tr("Relations"), "relationlist", tr("Open a list of all relations."), KeyEvent.VK_R, 150);
     58                super(tr("Relations"), "relationlist", tr("Open a list of all relations."),
     59                ShortCut.registerShortCut("subwindow:relations", tr("Toggle relations window"), KeyEvent.VK_R, ShortCut.GROUP_LAYER), 150);
    5860                displaylist.setCellRenderer(new OsmPrimitivRenderer());
    5961                displaylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    6062                displaylist.addMouseListener(new MouseAdapter(){
  • src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

     
    2020import org.openstreetmap.josm.data.osm.DataSet;
    2121import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2222import org.openstreetmap.josm.data.osm.User;
     23import org.openstreetmap.josm.tools.ShortCut;
    2324
    2425/**
    2526 * Displays a dialog with all users who have last edited something in the
     
    4647    private static User anonymousUser = User.get("(anonymous users)");
    4748                       
    4849        public UserListDialog() {
    49                 super(tr("Authors"), "userlist", tr("Open a list of people working on the selected objects."), KeyEvent.VK_A, 150);
     50                super(tr("Authors"), "userlist", tr("Open a list of people working on the selected objects."),
     51                ShortCut.registerShortCut("subwindow:authors", tr("Toggle authors window"), KeyEvent.VK_A, ShortCut.GROUP_LAYER), 150);
    5052               
    5153                data.setColumnIdentifiers(new String[]{tr("Author"),tr("# Objects"),"%"});
    5254                userTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  • src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

     
    6363import org.openstreetmap.josm.gui.tagging.TaggingPreset;
    6464import org.openstreetmap.josm.tools.AutoCompleteComboBox;
    6565import org.openstreetmap.josm.tools.GBC;
     66import org.openstreetmap.josm.tools.ShortCut;
    6667
    6768/**
    6869 * This dialog displays the properties of the current selected primitives.
     
    416417         * Create a new PropertiesDialog
    417418         */
    418419        public PropertiesDialog(MapFrame mapFrame) {
    419                 super(tr("Properties/Memberships"), "propertiesdialog", tr("Properties for selected objects."), KeyEvent.VK_P, 150);
     420                super(tr("Properties/Memberships"), "propertiesdialog", tr("Properties for selected objects."),
     421                ShortCut.registerShortCut("subwindow:properies", tr("Toggle properties window"), KeyEvent.VK_P, ShortCut.GROUP_LAYER), 150);
    420422
    421423                // ---------------------------------------
    422424                // This drop-down is really deprecated but we offer people a chance to
  • src/org/openstreetmap/josm/gui/MainApplication.java

     
    3030 */
    3131public class MainApplication extends Main {
    3232        /**
     33         * Allow subclassing (see JOSM.java)
     34         */
     35        public MainApplication() {}
     36
     37        /**
    3338         * Construct an main frame, ready sized and operating. Does not
    3439         * display the frame.
    3540         */
     
    6570
    6671                Thread.setDefaultUncaughtExceptionHandler(new BugReportExceptionHandler());
    6772
     73                // initialize the plaform hook, and
     74                Main.determinePlatformHook();
     75                // call the really early hook before we anything else
     76                Main.platform.preStartupHook();
     77
    6878                // construct argument table
    6979                List<String> argList = Arrays.asList(argArray);
    7080                final Map<String, Collection<String>> args = new HashMap<String, Collection<String>>();
     
    143153                Main.loadPlugins(true, language);
    144154
    145155                if (argList.contains("--help") || argList.contains("-?") || argList.contains("-h")) {
     156                        // TODO: put in a platformHook for system that have no console by default
    146157                        System.out.println(tr("Java OpenStreetMap Editor")+"\n\n"+
    147158                                        tr("usage")+":\n"+
    148159                                        "\tjava -jar josm.jar <option> <option> <option>...\n\n"+
     
    191202                        }
    192203                });
    193204        }
     205
    194206}
  • src/org/openstreetmap/josm/gui/MapView.java

     
    2525
    2626import org.openstreetmap.josm.Main;
    2727import org.openstreetmap.josm.actions.AutoScaleAction;
     28import org.openstreetmap.josm.actions.JosmAction;
    2829import org.openstreetmap.josm.actions.MoveAction;
    2930import org.openstreetmap.josm.data.Bounds;
    3031import org.openstreetmap.josm.data.SelectionChangedListener;
     
    106107                                new AutoScaleAction("data").actionPerformed(null);
    107108
    108109                                new MapMover(MapView.this, Main.contentPane);
    109                                 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, java.awt.event.InputEvent.SHIFT_MASK), "UP");
    110                                 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, java.awt.event.InputEvent.SHIFT_MASK), "DOWN");
    111                                 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, java.awt.event.InputEvent.SHIFT_MASK), "LEFT");
    112                                 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, java.awt.event.InputEvent.SHIFT_MASK), "RIGHT");
     110                                JosmAction mv;
     111                                mv = new MoveAction(MoveAction.Direction.UP);
     112                                if (mv.getShortCut() != null) {
     113                                        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortCut().getKeyStroke(), "UP");
     114                                        Main.contentPane.getActionMap().put("UP", mv);
     115                                }
     116                                mv = new MoveAction(MoveAction.Direction.DOWN);
     117                                if (mv.getShortCut() != null) {
     118                                        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortCut().getKeyStroke(), "DOWN");
     119                                        Main.contentPane.getActionMap().put("DOWN", mv);
     120                                }
     121                                mv = new MoveAction(MoveAction.Direction.LEFT);
     122                                if (mv.getShortCut() != null) {
     123                                        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortCut().getKeyStroke(), "LEFT");
     124                                        Main.contentPane.getActionMap().put("LEFT", mv);
     125                                }
     126                                mv = new MoveAction(MoveAction.Direction.RIGHT);
     127                                if (mv.getShortCut() != null) {
     128                                        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(mv.getShortCut().getKeyStroke(), "RIGHT");
     129                                        Main.contentPane.getActionMap().put("RIGHT", mv);
     130                                }
    113131
    114                                 Main.contentPane.getActionMap().put("UP", new MoveAction(MoveAction.Direction.UP));
    115                                 Main.contentPane.getActionMap().put("DOWN", new MoveAction(MoveAction.Direction.DOWN));
    116                                 Main.contentPane.getActionMap().put("LEFT", new MoveAction(MoveAction.Direction.LEFT));
    117                                 Main.contentPane.getActionMap().put("RIGHT", new MoveAction(MoveAction.Direction.RIGHT));
    118                                
    119 
    120132                                MapSlider zoomSlider = new MapSlider(MapView.this);
    121133                                add(zoomSlider);
    122134                                zoomSlider.setBounds(3, 0, 114, 30);
  • src/org/openstreetmap/josm/gui/MainMenu.java

     
    1212import javax.swing.JMenuBar;
    1313import javax.swing.JMenuItem;
    1414import javax.swing.KeyStroke;
     15import java.awt.event.KeyEvent;
    1516
    1617import org.openstreetmap.josm.Main;
    1718import org.openstreetmap.josm.actions.AboutAction;
     
    5859import org.openstreetmap.josm.actions.audio.AudioSlowerAction;
    5960import org.openstreetmap.josm.actions.search.SearchAction;
    6061import org.openstreetmap.josm.data.DataSetChecker;
     62import org.openstreetmap.josm.tools.ShortCut;
    6163
    6264/**
    6365 * This is the JOSM main menu bar. It is overwritten to initialize itself and provide
     
    129131        public final JMenu presetsMenu = new JMenu(tr("Presets"));
    130132        public final JMenu helpMenu = new JMenu(tr("Help"));
    131133       
     134        /**
     135         * Add a JosmAction to a menu.
     136         *
     137         * This method handles all the shortcut handling.
     138         * It also makes sure that actions that are handled by the
     139         * OS are not duplicated on the menu.
     140         */
     141        public static void add(JMenu menu, JosmAction action) {
     142                if (!action.getShortCut().getAutomatic()) {
     143                        JMenuItem menuitem = menu.add(action);
     144                        KeyStroke ks = action.getShortCut().getKeyStroke();
     145                        if (ks != null) {
     146                                menuitem.setAccelerator(ks);
     147                        }
     148                }
     149        }
    132150
     151        /**
     152         * Add a menu to the main menu.
     153         *
     154         * This method handles all the shortcut handling.
     155         */
     156        public void add(JMenu menu, int mnemonicKey, String shortName) {
     157                ShortCut.registerShortCut("menu:"+shortName, shortName+" menu", mnemonicKey, ShortCut.GROUP_MNEMONIC).setMnemonic(menu);
     158                add(menu);
     159        }
     160
    133161        public MainMenu() {
    134162        JMenuItem current;
    135163       
    136                 fileMenu.setMnemonic('F');
    137                 current = fileMenu.add(newAction);
    138                 current.setAccelerator(newAction.shortCut);
    139                 current = fileMenu.add(open);
    140                 current.setAccelerator(open.shortCut);
     164                add(fileMenu, newAction);
     165                add(fileMenu, open);
    141166                fileMenu.addSeparator();
    142                 current = fileMenu.add(save);
    143                 current.setAccelerator(save.shortCut);
    144                 current = fileMenu.add(saveAs);
    145                 current.setAccelerator(saveAs.shortCut);
    146                 current = fileMenu.add(gpxExport);
    147                 current.setAccelerator(gpxExport.shortCut);
     167                add(fileMenu, save);
     168                add(fileMenu, saveAs);
     169                add(fileMenu, gpxExport);
    148170                fileMenu.addSeparator();
    149                 current = fileMenu.add(download);
    150                 current.setAccelerator(download.shortCut);
    151                 current = fileMenu.add(upload);
    152                 current.setAccelerator(upload.shortCut);
    153                 fileMenu.addSeparator();
    154                 current = fileMenu.add(exit);
    155                 current.setAccelerator(exit.shortCut);
    156                 add(fileMenu);
     171                add(fileMenu, download);
     172                add(fileMenu, upload);
     173                add(fileMenu, exit);
     174                add(fileMenu, KeyEvent.VK_F, "file");
    157175
    158                 editMenu.setMnemonic('E');
    159                 current = editMenu.add(undo);
    160                 current.setAccelerator(undo.shortCut);
    161                 current = editMenu.add(redo);
    162                 current.setAccelerator(redo.shortCut);
     176                add(editMenu, undo);
     177                add(editMenu, redo);
    163178                editMenu.addSeparator();
    164                 current = editMenu.add(copy);
    165                 current.setAccelerator(copy.shortCut);
    166                 current = editMenu.add(delete);
    167                 current.setAccelerator(delete.shortCut);
    168                 current = editMenu.add(paste);
    169                 current.setAccelerator(paste.shortCut);
    170                 current = editMenu.add(pasteTags);
    171                 current.setAccelerator(pasteTags.shortCut);
    172                 current = editMenu.add(duplicate);
    173                 current.setAccelerator(duplicate.shortCut);
     179                add(editMenu, copy);
     180                add(editMenu, delete);
     181                add(editMenu, paste);
     182                add(editMenu, pasteTags);
     183                add(editMenu, duplicate);
    174184                editMenu.addSeparator();
    175                 current = editMenu.add(selectAll);
    176                 current.setAccelerator(selectAll.shortCut);
    177                 current = editMenu.add(unselectAll);
    178                 current.setAccelerator(unselectAll.shortCut);
     185                add(editMenu, selectAll);
     186                add(editMenu, unselectAll);
    179187                editMenu.addSeparator();
    180                 current = editMenu.add(search);
    181                 current.setAccelerator(search.shortCut);
     188                add(editMenu, search);
    182189                editMenu.addSeparator();
    183                 current = editMenu.add(preferences);
    184                 current.setAccelerator(preferences.shortCut);
    185                 add(editMenu);
     190                add(editMenu, preferences);
     191                add(editMenu, KeyEvent.VK_E, "edit");
    186192               
    187                 viewMenu.setMnemonic('V');
    188193        for (String mode : AutoScaleAction.modes) {
    189194            JosmAction autoScaleAction = new AutoScaleAction(mode);
    190                         current = viewMenu.add(autoScaleAction);
    191                     current.setAccelerator(autoScaleAction.shortCut);
     195                        add(viewMenu, autoScaleAction);
    192196        }
    193197        viewMenu.addSeparator();
    194         JosmAction a = new ZoomOutAction();
    195                 viewMenu.add(a).setAccelerator(a.shortCut);
    196                 a = new ZoomInAction();
    197                 viewMenu.add(a).setAccelerator(a.shortCut);
    198 
     198                add(viewMenu, new ZoomOutAction());
     199                add(viewMenu, new ZoomInAction());
    199200                viewMenu.addSeparator();
    200 
    201201                // TODO move code to an "action" like the others?
    202202        final JCheckBoxMenuItem wireframe = new JCheckBoxMenuItem(tr("Wireframe view"));
    203203                wireframe.setSelected(Main.pref.getBoolean("draw.wireframe", false));
    204         wireframe.setAccelerator(KeyStroke.getKeyStroke("ctrl W"));
     204                wireframe.setAccelerator(ShortCut.registerShortCut("menu:view:wireframe", "Toggle Wireframe view", KeyEvent.VK_W, ShortCut.GROUP_MENU).getKeyStroke());
    205205        wireframe.addActionListener(new ActionListener() {
    206206                public void actionPerformed(ActionEvent ev) {
    207207                        Main.pref.put("draw.wireframe", wireframe.isSelected());
     
    211211                }
    212212        });
    213213        viewMenu.add(wireframe);
     214                add(viewMenu, KeyEvent.VK_V, "view");
    214215       
    215                 add(viewMenu);
    216 
    217                 toolsMenu.setMnemonic('T');
    218                 current = toolsMenu.add(splitWay);
    219                 current.setAccelerator(splitWay.shortCut);
    220                 current = toolsMenu.add(combineWay);
    221                 current.setAccelerator(combineWay.shortCut);
     216                add(toolsMenu, splitWay);
     217                add(toolsMenu, combineWay);
    222218                toolsMenu.addSeparator();
    223                 current = toolsMenu.add(reverseWay);
    224                 current.setAccelerator(reverseWay.shortCut);
     219                add(toolsMenu, reverseWay);
    225220                toolsMenu.addSeparator();
    226                 current = toolsMenu.add(alignInCircle);
    227                 current.setAccelerator(alignInCircle.shortCut);
    228                 current = toolsMenu.add(alignInLine);
    229                 current.setAccelerator(alignInLine.shortCut);
    230                 current = toolsMenu.add(alignInRect);
    231                 current.setAccelerator(alignInRect.shortCut);
     221                add(toolsMenu, alignInCircle);
     222                add(toolsMenu, alignInLine);
     223                add(toolsMenu, alignInRect);
    232224                toolsMenu.addSeparator();
    233                 current = toolsMenu.add(createCircle);
    234                 current.setAccelerator(createCircle.shortCut);
     225                add(toolsMenu, createCircle);
    235226                toolsMenu.addSeparator();
    236                 current = toolsMenu.add(mergeNodes);
    237                 current.setAccelerator(mergeNodes.shortCut);
    238                 current = toolsMenu.add(joinNodeWay);
    239                 current.setAccelerator(joinNodeWay.shortCut);
    240                 current = toolsMenu.add(unglueNodes);
    241                 current.setAccelerator(unglueNodes.shortCut);
    242                 add(toolsMenu);
     227                add(toolsMenu, mergeNodes);
     228                add(toolsMenu, joinNodeWay);
     229                add(toolsMenu, unglueNodes);
     230                add(toolsMenu, KeyEvent.VK_T, "tools");
    243231
    244232                if (! Main.pref.getBoolean("audio.menuinvisible")) {
    245                         audioMenu.setMnemonic('A');
    246                         current = audioMenu.add(audioPlayPause);
    247                         current.setAccelerator(audioPlayPause.shortCut);
    248                         current = audioMenu.add(audioNext);
    249                         current.setAccelerator(audioNext.shortCut);
    250                         current = audioMenu.add(audioPrev);
    251                         current.setAccelerator(audioPrev.shortCut);
    252                         current = audioMenu.add(audioFwd);
    253                         current.setAccelerator(audioFwd.shortCut);
    254                         current = audioMenu.add(audioBack);
    255                         current.setAccelerator(audioBack.shortCut);
    256                         current = audioMenu.add(audioSlower);
    257                         current.setAccelerator(audioSlower.shortCut);
    258                         current = audioMenu.add(audioFaster);
    259                         current.setAccelerator(audioFaster.shortCut);
    260                         add(audioMenu);
     233                        add(audioMenu, audioPlayPause);
     234                        add(audioMenu, audioNext);
     235                        add(audioMenu, audioPrev);
     236                        add(audioMenu, audioFwd);
     237                        add(audioMenu, audioBack);
     238                        add(audioMenu, audioSlower);
     239                        add(audioMenu, audioFaster);
     240                        add(audioMenu, KeyEvent.VK_A, "audio");
    261241                }
    262242
    263                 add(presetsMenu);
    264                 presetsMenu.setMnemonic('P');
     243                add(presetsMenu, KeyEvent.VK_P, "presets");
    265244               
    266                 helpMenu.setMnemonic('H');
    267245                JMenuItem check = new JMenuItem("DEBUG: Check Dataset");
    268246                check.addActionListener(new ActionListener(){
    269247                        public void actionPerformed(ActionEvent e) {
    270248                                DataSetChecker.check();
    271249            }
    272250                });
    273                 current = helpMenu.add(check);
    274                 current = helpMenu.add(help);
    275                 //current.setAccelerator(help.shortCut);
    276                 current = helpMenu.add(about);
    277                 current.setAccelerator(about.shortCut);
    278                 current = helpMenu.add(historyinfo);
    279                 current.setAccelerator(historyinfo.shortCut);
    280                 add(helpMenu);
     251                helpMenu.add(check);
     252                current = helpMenu.add(help); // why is help not a JosmAction?
     253                current.setAccelerator(ShortCut.registerShortCut("system:help", tr("Help"), KeyEvent.VK_F1, ShortCut.GROUP_DIRECT).getKeyStroke());
     254                add(helpMenu, about);
     255                add(helpMenu, historyinfo);
     256                add(helpMenu, KeyEvent.VK_H, "help");
    281257    }
    282258}
  • src/org/openstreetmap/josm/gui/preferences/LafPreference.java

     
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    66import java.awt.Component;
     7import java.lang.reflect.*;
    78
    89import javax.swing.DefaultListCellRenderer;
    910import javax.swing.JComboBox;
     
    2627        public void addGui(PreferenceDialog gui) {
    2728                lafCombo = new JComboBox(UIManager.getInstalledLookAndFeels());
    2829               
     30                // let's try to load additional LookAndFeels and put them into the list
     31                try {
     32                        Class Cquaqua = Class.forName("ch.randelshofer.quaqua.QuaquaLookAndFeel");
     33                        Object Oquaqua = Cquaqua.getConstructor((Class[])null).newInstance((Object[])null);
     34                        // no exception? Then Go!
     35                        lafCombo.addItem(
     36                                new UIManager.LookAndFeelInfo(((javax.swing.LookAndFeel)Oquaqua).getName(), "ch.randelshofer.quaqua.QuaquaLookAndFeel")
     37                        );
     38                } catch (Exception ex) {
     39                        // just ignore, Quaqua may not even be installed...
     40                        //System.out.println("Failed to load Quaqua: " + ex);
     41                }
     42
    2943                String laf = Main.pref.get("laf");
    3044                for (int i = 0; i < lafCombo.getItemCount(); ++i) {
    3145                        if (((LookAndFeelInfo)lafCombo.getItemAt(i)).getClassName().equals(laf)) {
  • src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java

     
    110110                settings.add(new PluginPreference());
    111111                settings.add(Main.toolbar);
    112112                settings.add(new AudioPreference());
     113                settings.add(new ShortcutPreference());
    113114               
    114115                for (PluginProxy plugin : Main.plugins) {
    115116                        PreferenceSetting p = plugin.getPreferenceSetting();
  • src/org/openstreetmap/josm/gui/MapMover.java

     
    1515import javax.swing.JComponent;
    1616import javax.swing.JPanel;
    1717import javax.swing.KeyStroke;
     18import org.openstreetmap.josm.tools.ShortCut;
     19import static org.openstreetmap.josm.tools.I18n.tr;
    1820
    1921import org.openstreetmap.josm.data.coor.EastNorth;
    2022
     
    7880                nc.addMouseMotionListener(this);
    7981                nc.addMouseWheelListener(this);
    8082               
    81                 String[] n = {",",".","up","right","down","left"};
    82                 int[] k = {KeyEvent.VK_COMMA, KeyEvent.VK_PERIOD, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, KeyEvent.VK_DOWN, KeyEvent.VK_LEFT};
     83                if (contentPane != null) {
     84                        contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
     85                                ShortCut.registerShortCut("system:movefocusright", tr("Map: Move right"), KeyEvent.VK_RIGHT, ShortCut.GROUP_HOTKEY).getKeyStroke(),
     86                                "MapMover.Zoomer.right");
     87                        contentPane.getActionMap().put("MapMover.Zoomer.right", new ZoomerAction("right"));
    8388
    84                 if (contentPane != null) {
    85                         for (int i = 0; i < n.length; ++i) {
    86                                 contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(k[i], KeyEvent.CTRL_DOWN_MASK), "MapMover.Zoomer."+n[i]);
    87                                 contentPane.getActionMap().put("MapMover.Zoomer."+n[i], new ZoomerAction(n[i]));
     89                        contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
     90                                ShortCut.registerShortCut("system:movefocusleft", tr("Map: Move left"), KeyEvent.VK_LEFT, ShortCut.GROUP_HOTKEY).getKeyStroke(),
     91                                "MapMover.Zoomer.left");
     92                        contentPane.getActionMap().put("MapMover.Zoomer.left", new ZoomerAction("left"));
     93
     94                        contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
     95                                ShortCut.registerShortCut("system:movefocusup", tr("Map: Move up"), KeyEvent.VK_UP, ShortCut.GROUP_HOTKEY).getKeyStroke(),
     96                                "MapMover.Zoomer.up");
     97                        contentPane.getActionMap().put("MapMover.Zoomer.up", new ZoomerAction("up"));
     98
     99                        contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
     100                                ShortCut.registerShortCut("system:movefocusdown", tr("Map: Move down"), KeyEvent.VK_DOWN, ShortCut.GROUP_HOTKEY).getKeyStroke(),
     101                                "MapMover.Zoomer.down");
     102                        contentPane.getActionMap().put("MapMover.Zoomer.down", new ZoomerAction("down"));
     103
     104                        contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
     105                                ShortCut.registerShortCut("view:zoominalternate", tr("Map: Zoom in"), KeyEvent.VK_COMMA, ShortCut.GROUP_HOTKEY).getKeyStroke(),
     106                                "MapMover.Zoomer.in");
     107                        contentPane.getActionMap().put("MapMover.Zoomer.in", new ZoomerAction(","));
     108
     109                        contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
     110                                ShortCut.registerShortCut("view:zoomoutalternate", tr("Map: Zoom out"), KeyEvent.VK_PERIOD, ShortCut.GROUP_HOTKEY).getKeyStroke(),
     111                                "MapMover.Zoomer.out");
     112                        contentPane.getActionMap().put("MapMover.Zoomer.out", new ZoomerAction("."));
    88113                        }
    89114                }
    90         }
    91115
    92116        /**
    93117         * If the right (and only the right) mouse button is pressed, move the map
  • src/org/openstreetmap/josm/gui/MainApplet.java

     
    2828import org.openstreetmap.josm.actions.JosmAction;
    2929import org.openstreetmap.josm.data.ServerSidePreferences;
    3030import org.openstreetmap.josm.tools.GBC;
     31import org.openstreetmap.josm.tools.ShortCut;
    3132
    3233public class MainApplet extends JApplet {
    3334
    3435        public static final class UploadPreferencesAction extends JosmAction {
    3536                public UploadPreferencesAction() {
    36                         super(tr("Upload Preferences"), "upload-preferences", tr("Upload the current preferences to the server"), KeyEvent.VK_U, KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK, true);
     37                        super(tr("Upload Preferences"), "upload-preferences", tr("Upload the current preferences to the server"),
     38                        ShortCut.registerShortCut("applet:uploadprefs", tr("Upload preferences"), KeyEvent.VK_U, ShortCut.GROUP_HOTKEY), true);
    3739        }
    3840            public void actionPerformed(ActionEvent e) {
    3941                ((ServerSidePreferences)Main.pref).upload();
  • src/org/openstreetmap/josm/Main.java

     
    5858import org.openstreetmap.josm.plugins.PluginInformation;
    5959import org.openstreetmap.josm.plugins.PluginProxy;
    6060import org.openstreetmap.josm.tools.ImageProvider;
     61import org.openstreetmap.josm.tools.PlatformHook;
     62import org.openstreetmap.josm.tools.PlatformHookUnixoid;
     63import org.openstreetmap.josm.tools.PlatformHookWindows;
     64import org.openstreetmap.josm.tools.PlatformHookOsx;
     65import org.openstreetmap.josm.tools.ShortCut;
    6166
    6267abstract public class Main {
    6368        /**
     
    132137        }
    133138
    134139        /**
     140         * Platform specific code goes in here.
     141         * Plugins may replace it, however, some hooks will be called before any plugins have been loeaded.
     142         * So if you need to hook into those early ones, split your class and send the one with the early hooks
     143         * to the JOSM team for inclusion.
     144         */
     145        public static PlatformHook platform;
     146
     147        /**
    135148         * Set or clear (if passed <code>null</code>) the map.
    136149         */
    137150        public final void setMapFrame(final MapFrame map) {
     
    177190                        setMapFrame(null);
    178191        }
    179192
    180 
    181193        public Main() {
    182194                main = this;
     195//              platform = determinePlatformHook();
     196                platform.startupHook();
    183197                contentPane.add(panel, BorderLayout.CENTER);
    184198                panel.add(new GettingStarted(), BorderLayout.CENTER);
    185199                menu = new MainMenu();
     
    189203                // creating toolbar
    190204                contentPane.add(toolbar.control, BorderLayout.NORTH);
    191205
    192                 contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), "Help");
     206                contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(ShortCut.registerShortCut("system:help", tr("Help"), KeyEvent.VK_F1, ShortCut.GROUP_DIRECT).getKeyStroke(), "Help");
    193207                contentPane.getActionMap().put("Help", menu.help);
    194208
    195209                TaggingPresetPreference.initialize();
     
    414428        }
    415429
    416430        public static boolean breakBecauseUnsavedChanges() {
     431                ShortCut.savePrefs();
    417432                if (map != null) {
    418433                        boolean modified = false;
    419434                        boolean uploadedModified = false;
     
    470485
    471486                main.menu.open.openFile(new File(s));
    472487        }
     488
     489        protected static void determinePlatformHook() {
     490                String os = System.getProperty("os.name");
     491                if (os == null) {
     492                        System.err.println("Your operating system has no name, so I'm guessing its some kind of *nix.");
     493                        platform = new PlatformHookUnixoid();
     494                } else if (os.toLowerCase().startsWith("windows")) {
     495                        platform = new PlatformHookWindows();
     496                } else if (os.equals("Linux") || os.equals("Solaris") || os.equals("SunOS") || os.equals("AIX") || os.equals("FreeBSD")) {
     497                        platform = new PlatformHookUnixoid();
     498                } else if (os.toLowerCase().startsWith("mac os x")) {
     499                        platform = new PlatformHookOsx();
     500                } else {
     501                        System.err.println("I don't know your operating system '"+os+"', so I'm guessing its some kind of *nix.");
     502                        platform = new PlatformHookUnixoid();
    473503}
     504        }
     505
     506}
  • build.xml

     
    3636                <delete file="dist/josm-custom.jar"/>
    3737                <jar destfile="dist/josm-custom.jar" basedir="build">
    3838                        <manifest>
    39                                 <attribute name="Main-class" value="org.openstreetmap.josm.gui.MainApplication" />
     39                                <attribute name="Main-class" value="JOSM" />
    4040                        </manifest>
    4141                </jar>
    4242        </target>