Index: trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java	(revision 7538)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java	(revision 7539)
@@ -24,5 +24,4 @@
 
 import javax.swing.AbstractAction;
-import javax.swing.Action;
 import javax.swing.DefaultCellEditor;
 import javax.swing.DefaultListSelectionModel;
@@ -62,4 +61,5 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.util.GuiHelper;
+import org.openstreetmap.josm.gui.widgets.DisableShortcutsOnFocusGainedTextField;
 import org.openstreetmap.josm.gui.widgets.JosmTextField;
 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
@@ -76,5 +76,5 @@
  * change the ordering of the layers, to hide/show layers, to activate layers,
  * and to delete layers.
- *
+ * @since 17
  */
 public class LayerListDialog extends ToggleDialog {
@@ -127,5 +127,5 @@
         public void actionPerformed(ActionEvent e) {
             final Layer l = model.getLayer(model.getRowCount() - layerIndex - 1);
-            if(l != null) {
+            if (l != null) {
                 l.toggleVisible();
             }
@@ -135,4 +135,5 @@
     private final Shortcut[] visibilityToggleShortcuts = new Shortcut[10];
     private final ToggleLayerIndexVisibility[] visibilityToggleActions = new ToggleLayerIndexVisibility[10];
+
     /**
      * registers (shortcut to toggle right hand side toggle dialogs)+(number keys) shortcuts
@@ -153,5 +154,5 @@
 
     /**
-     * Create an layer list and attach it to the given mapView.
+     * Creates a layer list and attach it to the given mapView.
      */
     protected LayerListDialog(MapFrame mapFrame) {
@@ -189,14 +190,22 @@
         layerList.getColumnModel().getColumn(1).setResizable(false);
         layerList.getColumnModel().getColumn(2).setCellRenderer(new LayerNameCellRenderer());
-        layerList.getColumnModel().getColumn(2).setCellEditor(new LayerNameCellEditor(new JosmTextField()));
+        layerList.getColumnModel().getColumn(2).setCellEditor(new LayerNameCellEditor(new DisableShortcutsOnFocusGainedTextField()));
+        // Disable some default JTable shortcuts to use JOSM ones (see #5678, #10458)
         for (KeyStroke ks : new KeyStroke[] {
-                KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
-                KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
-                KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.SHIFT_MASK),
-                KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK),
-                KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK),
-                KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK),
+                KeyStroke.getKeyStroke(KeyEvent.VK_A, GuiHelper.getMenuShortcutKeyMaskEx()),
+                KeyStroke.getKeyStroke(KeyEvent.VK_C, GuiHelper.getMenuShortcutKeyMaskEx()),
+                KeyStroke.getKeyStroke(KeyEvent.VK_V, GuiHelper.getMenuShortcutKeyMaskEx()),
+                KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.SHIFT_DOWN_MASK),
+                KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_DOWN_MASK),
+                KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_DOWN_MASK),
+                KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_DOWN_MASK),
+                KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_DOWN_MASK),
+                KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_DOWN_MASK),
+                KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_DOWN_MASK),
+                KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_DOWN_MASK),
                 KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0),
                 KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0),
+                KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0),
+                KeyStroke.getKeyStroke(KeyEvent.VK_F8, 0),
         })
         {
@@ -246,5 +255,5 @@
         adaptTo(showHideLayerAction, selectionModel);
 
-        //-- layer opacity action
+        // -- layer opacity action
         LayerOpacityAction layerOpacityAction = new LayerOpacityAction();
         adaptTo(layerOpacityAction, selectionModel);
@@ -261,5 +270,5 @@
         adaptTo(duplicateLayerAction, selectionModel);
 
-        //-- delete layer action
+        // -- delete layer action
         DeleteLayerAction deleteLayerAction = new DeleteLayerAction();
         layerList.getActionMap().put("deleteLayer", deleteLayerAction);
@@ -309,4 +318,8 @@
     }
 
+    /**
+     * Returns the layer list model.
+     * @return the layer list model
+     */
     public LayerListModel getModel() {
         return model;
@@ -372,8 +385,8 @@
      */
     public final class DeleteLayerAction extends AbstractAction implements IEnabledStateUpdating, LayerAction {
+
         /**
          * Creates a {@link DeleteLayerAction} which will delete the currently
          * selected layers in the layer dialog.
-         *
          */
         public DeleteLayerAction() {
@@ -423,4 +436,7 @@
     }
 
+    /**
+     * Action which will toggle the visibility of the currently selected layers.
+     */
     public final class ShowHideLayerAction extends AbstractAction implements IEnabledStateUpdating, LayerAction, MultikeyShortcutAction {
 
@@ -431,7 +447,6 @@
          * Creates a {@link ShowHideLayerAction} which will toggle the visibility of
          * the currently selected layers
-         *
-         */
-        public ShowHideLayerAction(boolean init) {
+         */
+        public ShowHideLayerAction() {
             putValue(NAME, tr("Show/hide"));
             putValue(SMALL_ICON, ImageProvider.get("dialogs", "showhide"));
@@ -441,14 +456,5 @@
                     tr("Show/hide layer")), KeyEvent.VK_S, Shortcut.SHIFT);
             multikeyShortcut.setAccelerator(this);
-            if (init) {
-                updateEnabledState();
-            }
-        }
-
-        /**
-         * Constructs a new {@code ShowHideLayerAction}.
-         */
-        public ShowHideLayerAction() {
-            this(true);
+            updateEnabledState();
         }
 
@@ -517,4 +523,7 @@
     }
 
+    /**
+     * Action which allows to change the opacity of one or more layers.
+     */
     public final class LayerOpacityAction extends AbstractAction implements IEnabledStateUpdating, LayerAction {
         private Layer layer;
@@ -523,5 +532,5 @@
 
         /**
-         * Creates a {@link LayerOpacityAction} which allows to chenge the
+         * Creates a {@link LayerOpacityAction} which allows to change the
          * opacity of one or more layers.
          *
@@ -632,4 +641,8 @@
         private Shortcut multikeyShortcut;
 
+        /**
+         * Constructs a new {@code ActivateLayerAction}.
+         * @param layer the layer
+         */
         public ActivateLayerAction(Layer layer) {
             this();
@@ -670,6 +683,5 @@
 
         private void execute(Layer layer) {
-            // model is  going to be updated via LayerChangeListener
-            // and PropertyChangeEvents
+            // model is  going to be updated via LayerChangeListener and PropertyChangeEvents
             Main.map.mapView.setActiveLayer(layer);
             layer.setVisible(true);
@@ -704,8 +716,10 @@
             updateEnabledState();
         }
+
         @Override
         public void layerAdded(Layer newLayer) {
             updateEnabledState();
         }
+
         @Override
         public void layerRemoved(Layer oldLayer) {
@@ -738,4 +752,9 @@
         private  Layer layer;
 
+        /**
+         * Constructs a new {@code MergeAction}.
+         * @param layer the layer
+         * @throws IllegalArgumentException if {@code layer} is null
+         */
         public MergeAction(Layer layer) throws IllegalArgumentException {
             this();
@@ -806,6 +825,11 @@
      */
     public final class DuplicateAction extends AbstractAction implements IEnabledStateUpdating {
-        private  Layer layer;
-
+        private Layer layer;
+
+        /**
+         * Constructs a new {@code DuplicateAction}.
+         * @param layer the layer
+         * @throws IllegalArgumentException if {@code layer} is null
+         */
         public DuplicateAction(Layer layer) throws IllegalArgumentException {
             this();
@@ -891,14 +915,14 @@
 
     private static class LayerVisibleCheckBox extends JCheckBox {
-        private final ImageIcon icon_eye;
-        private final ImageIcon icon_eye_translucent;
+        private final ImageIcon iconEye;
+        private final ImageIcon iconEyeTranslucent;
         private boolean isTranslucent;
         public LayerVisibleCheckBox() {
             setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
-            icon_eye = ImageProvider.get("dialogs/layerlist", "eye");
-            icon_eye_translucent = ImageProvider.get("dialogs/layerlist", "eye-translucent");
+            iconEye = ImageProvider.get("dialogs/layerlist", "eye");
+            iconEyeTranslucent = ImageProvider.get("dialogs/layerlist", "eye-translucent");
             setIcon(ImageProvider.get("dialogs/layerlist", "eye-off"));
             setPressedIcon(ImageProvider.get("dialogs/layerlist", "eye-pressed"));
-            setSelectedIcon(icon_eye);
+            setSelectedIcon(iconEye);
             isTranslucent = false;
         }
@@ -907,7 +931,7 @@
             if (this.isTranslucent == isTranslucent) return;
             if (isTranslucent) {
-                setSelectedIcon(icon_eye_translucent);
+                setSelectedIcon(iconEyeTranslucent);
             } else {
-                setSelectedIcon(icon_eye);
+                setSelectedIcon(iconEye);
             }
             this.isTranslucent = isTranslucent;
@@ -923,5 +947,5 @@
 
     private static class ActiveLayerCellRenderer implements TableCellRenderer {
-        JCheckBox cb;
+        final JCheckBox cb;
         public ActiveLayerCellRenderer() {
             cb = new ActiveLayerCheckBox();
@@ -938,5 +962,5 @@
 
     private static class LayerVisibleCellRenderer implements TableCellRenderer {
-        LayerVisibleCheckBox cb;
+        final LayerVisibleCheckBox cb;
         public LayerVisibleCellRenderer() {
             this.cb = new LayerVisibleCheckBox();
@@ -953,5 +977,5 @@
 
     private static class LayerVisibleCellEditor extends DefaultCellEditor {
-        LayerVisibleCheckBox cb;
+        final LayerVisibleCheckBox cb;
         public LayerVisibleCellEditor(LayerVisibleCheckBox cb) {
             super(cb);
@@ -1014,5 +1038,5 @@
 
     private static class LayerNameCellEditor extends DefaultCellEditor {
-        public LayerNameCellEditor(JosmTextField tf) {
+        public LayerNameCellEditor(DisableShortcutsOnFocusGainedTextField tf) {
             super(tf);
         }
@@ -1027,5 +1051,6 @@
 
     class PopupMenuHandler extends PopupMenuLauncher {
-        @Override public void showMenu(MouseEvent evt) {
+        @Override
+        public void showMenu(MouseEvent evt) {
             Layer layer = getModel().getLayer(layerList.getSelectedRow());
             menu = new LayerListPopup(getModel().getSelectedLayers(), layer);
@@ -1079,9 +1104,19 @@
 
     /**
-     * Observer interface to be implemented by views using {@link LayerListModel}
-     *
+     * Observer interface to be implemented by views using {@link LayerListModel}.
      */
     public interface LayerListModelListener {
+
+        /**
+         * Fired when a layer is made visible.
+         * @param index the layer index
+         * @param layer the layer
+         */
         public void makeVisible(int index, Layer layer);
+
+
+        /**
+         * Fired when something has changed in the layer list model.
+         */
         public void refresh();
     }
@@ -1161,12 +1196,9 @@
 
         /**
-         * Populates the model with the current layers managed by
-         * {@link MapView}.
-         *
+         * Populates the model with the current layers managed by {@link MapView}.
          */
         public void populate() {
             for (Layer layer: getLayers()) {
                 // make sure the model is registered exactly once
-                //
                 layer.removePropertyChangeListener(this);
                 layer.addPropertyChangeListener(this);
@@ -1176,6 +1208,5 @@
 
         /**
-         * Marks <code>layer</code> as selected layer. Ignored, if
-         * layer is null.
+         * Marks <code>layer</code> as selected layer. Ignored, if layer is null.
          *
          * @param layer the layer.
@@ -1192,9 +1223,7 @@
 
         /**
-         * Replies the list of currently selected layers. Never null, but may
-         * be empty.
-         *
-         * @return the list of currently selected layers. Never null, but may
-         * be empty.
+         * Replies the list of currently selected layers. Never null, but may be empty.
+         *
+         * @return the list of currently selected layers. Never null, but may be empty.
          */
         public List<Layer> getSelectedLayers() {
@@ -1412,12 +1441,10 @@
             final Layer activeLayer = getActiveLayer();
             if (activeLayer != null) {
-                // there's an active layer - select it and make it
-                // visible
+                // there's an active layer - select it and make it visible
                 int idx = getLayers().indexOf(activeLayer);
                 selectionModel.setSelectionInterval(idx, idx);
                 ensureSelectedIsVisible();
             } else {
-                // no active layer - select the first one and make
-                // it visible
+                // no active layer - select the first one and make it visible
                 selectionModel.setSelectionInterval(0, 0);
                 ensureSelectedIsVisible();
@@ -1557,5 +1584,5 @@
 
     /**
-     * Creates a {@link ShowHideLayerAction} for <code>layer</code> in the
+     * Creates a {@link ShowHideLayerAction} in the
      * context of this {@link LayerListDialog}.
      *
@@ -1563,11 +1590,9 @@
      */
     public ShowHideLayerAction createShowHideLayerAction() {
-        ShowHideLayerAction act = new ShowHideLayerAction(true);
-        act.putValue(Action.NAME, tr("Show/Hide"));
-        return act;
-    }
-
-    /**
-     * Creates a {@link DeleteLayerAction} for <code>layer</code> in the
+        return new ShowHideLayerAction();
+    }
+
+    /**
+     * Creates a {@link DeleteLayerAction} in the
      * context of this {@link LayerListDialog}.
      *
@@ -1575,5 +1600,4 @@
      */
     public DeleteLayerAction createDeleteLayerAction() {
-        // the delete layer action doesn't depend on the current layer
         return new DeleteLayerAction();
     }
@@ -1601,4 +1625,9 @@
     }
 
+    /**
+     * Returns the layer at given index, or {@code null}.
+     * @param index the index
+     * @return the layer at given index, or {@code null} if index out of range
+     */
     public static Layer getLayerForIndex(int index) {
 
@@ -1614,5 +1643,10 @@
     }
 
-    // This is not Class<? extends Layer> on purpose, to allow asking for layers implementing some interface
+    /**
+     * Returns a list of info on all layers of a given class.
+     * @param layerClass The layer class. This is not {@code Class<? extends Layer>} on purpose,
+     *                   to allow asking for layers implementing some interface
+     * @return list of info on all layers assignable from {@code layerClass}
+     */
     public static List<MultikeyInfo> getLayerInfoByClass(Class<?> layerClass) {
 
@@ -1635,20 +1669,25 @@
     }
 
+    /**
+     * Determines if a layer is valid (contained in layer list).
+     * @param l the layer
+     * @return {@code true} if layer {@code l} is contained in current layer list
+     */
     public static boolean isLayerValid(Layer l) {
-        if (l == null)
+
+        if (l == null || !Main.isDisplayingMapView())
             return false;
 
-        if (!Main.isDisplayingMapView())
-            return false;
-
         return Main.map.mapView.getAllLayersAsList().contains(l);
     }
 
+    /**
+     * Returns info about layer.
+     * @param l the layer
+     * @return info about layer {@code l}
+     */
     public static MultikeyInfo getLayerInfo(Layer l) {
 
-        if (l == null)
-            return null;
-
-        if (!Main.isDisplayingMapView())
+        if (l == null || !Main.isDisplayingMapView())
             return null;
 
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 7538)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 7539)
@@ -117,4 +117,5 @@
     HighlightHelper highlightHelper = new HighlightHelper();
     private boolean highlightEnabled = Main.pref.getBoolean("draw.target-highlight", true);
+
     /**
      * Constructs <code>RelationListDialog</code>
@@ -197,5 +198,6 @@
     }
 
-    @Override public void showNotify() {
+    @Override
+    public void showNotify() {
         MapView.addLayerChangeListener(newAction);
         newAction.updateEnabledState();
@@ -205,5 +207,6 @@
     }
 
-    @Override public void hideNotify() {
+    @Override
+    public void hideNotify() {
         MapView.removeLayerChangeListener(newAction);
         DatasetEventManager.getInstance().removeDatasetListener(this);
@@ -323,5 +326,6 @@
         }
 
-        @Override public void mouseClicked(MouseEvent e) {
+        @Override
+        public void mouseClicked(MouseEvent e) {
             if (!Main.main.hasEditLayer()) return;
             if (isDoubleClick(e)) {
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java	(revision 7538)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java	(revision 7539)
@@ -80,5 +80,6 @@
 
 /**
- * Class that helps PropertiesDialog add and edit tag values
+ * Class that helps PropertiesDialog add and edit tag values.
+ * @since 5633
  */
 class TagEditHelper {
@@ -139,5 +140,5 @@
 
     /**
-    * Edit the value in the tags table row
+    * Edit the value in the tags table row.
     * @param row The row of the table from which the value is edited.
     * @param focusOnKey Determines if the initial focus should be set on key instead of value
@@ -187,5 +188,5 @@
 
     /**
-     * Load recently used tags from preferences if needed
+     * Load recently used tags from preferences if needed.
      */
     public void loadTagsIfNeeded() {
@@ -204,5 +205,5 @@
 
     /**
-     * Store recently used tags in preferences if needed
+     * Store recently used tags in preferences if needed.
      */
     public void saveTagsIfNeeded() {
@@ -258,22 +259,22 @@
         ListCellRenderer<AutoCompletionListItem> cellRenderer = new ListCellRenderer<AutoCompletionListItem>() {
             final DefaultListCellRenderer def = new DefaultListCellRenderer();
-                @Override
-                public Component getListCellRendererComponent(JList<? extends AutoCompletionListItem> list,
-                        AutoCompletionListItem value, int index, boolean isSelected,  boolean cellHasFocus){
-                    Component c = def.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
-                    if (c instanceof JLabel) {
-                        String str = value.getValue();
-                        if (valueCount.containsKey(objKey)) {
-                            Map<String, Integer> m = valueCount.get(objKey);
-                            if (m.containsKey(str)) {
-                                str = tr("{0} ({1})", str, m.get(str));
-                                c.setFont(c.getFont().deriveFont(Font.ITALIC + Font.BOLD));
-                            }
+            @Override
+            public Component getListCellRendererComponent(JList<? extends AutoCompletionListItem> list,
+                    AutoCompletionListItem value, int index, boolean isSelected,  boolean cellHasFocus){
+                Component c = def.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+                if (c instanceof JLabel) {
+                    String str = value.getValue();
+                    if (valueCount.containsKey(objKey)) {
+                        Map<String, Integer> m = valueCount.get(objKey);
+                        if (m.containsKey(str)) {
+                            str = tr("{0} ({1})", str, m.get(str));
+                            c.setFont(c.getFont().deriveFont(Font.ITALIC + Font.BOLD));
                         }
-                        ((JLabel) c).setText(str);
-                    }
-                    return c;
-                }
-            };
+                    }
+                    ((JLabel) c).setText(str);
+                }
+                return c;
+            }
+        };
 
         private EditTagDialog(String key, int row, Map<String, Integer> map, final boolean initialFocusOnKey) {
@@ -463,5 +464,5 @@
 
         private void selectACComboBoxSavingUnixBuffer(AutoCompletingComboBox cb) {
-            // select compbobox with saving unix system selection (middle mouse paste)
+            // select combobox with saving unix system selection (middle mouse paste)
             Clipboard sysSel = Toolkit.getDefaultToolkit().getSystemSelection();
             if(sysSel != null) {
@@ -493,9 +494,9 @@
         protected FocusAdapter addFocusAdapter(final AutoCompletionManager autocomplete, final Comparator<AutoCompletionListItem> comparator) {
            // get the combo box' editor component
-           JTextComponent editor = (JTextComponent)values.getEditor()
-                   .getEditorComponent();
+           JTextComponent editor = (JTextComponent)values.getEditor().getEditorComponent();
            // Refresh the values model when focus is gained
            FocusAdapter focus = new FocusAdapter() {
-               @Override public void focusGained(FocusEvent e) {
+               @Override
+               public void focusGained(FocusEvent e) {
                    String key = keys.getEditor().getItem().toString();
 
@@ -665,6 +666,5 @@
                     public void actionPerformed(ActionEvent e) {
                         keys.setSelectedItem(t.getKey());
-                        // Update list of values (fix #7951)
-                        // fix #8298 - update list of values before setting value (?)
+                        // fix #7951, #8298 - update list of values before setting value (?)
                         focus.focusGained(null);
                         values.setSelectedItem(t.getValue());
Index: trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java	(revision 7538)
+++ trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java	(revision 7539)
@@ -38,4 +38,6 @@
     private final ArrayList<ModifierListener> modifierListeners = new ArrayList<>();
     private int previousModifiers;
+
+    private boolean enabled = true;
 
     /**
@@ -84,5 +86,5 @@
             public void actionPerformed(ActionEvent e) {
                 timer.stop();
-                if (set.remove(releaseEvent.getKeyCode())) {
+                if (set.remove(releaseEvent.getKeyCode()) && enabled) {
                     synchronized (AdvancedKeyPressDetector.this) {
                         for (KeyPressReleaseListener q: keyListeners) {
@@ -121,5 +123,5 @@
             if (timer.isRunning()) {
                 timer.stop();
-            } else if (set.add((e.getKeyCode()))) {
+            } else if (set.add((e.getKeyCode())) && enabled) {
                 synchronized (this) {
                     for (KeyPressReleaseListener q: keyListeners) {
@@ -131,5 +133,5 @@
             if (timer.isRunning()) {
                 timer.stop();
-                if (set.remove(e.getKeyCode())) {
+                if (set.remove(e.getKeyCode()) && enabled) {
                     synchronized (this) {
                         for (KeyPressReleaseListener q: keyListeners) {
@@ -178,3 +180,13 @@
         return set.contains(keyCode);
     }
+
+    /**
+     * Sets the enabled state of the key detector. We need to disable it when text fields that disable
+     * shortcuts gain focus.
+     * @param enabled if {@code true}, enables this key detector. If {@code false}, disables it
+     * @since 7539
+     */
+    public final void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
 }
Index: trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java	(revision 7538)
+++ trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java	(revision 7539)
@@ -19,4 +19,5 @@
 import java.awt.event.HierarchyEvent;
 import java.awt.event.HierarchyListener;
+import java.awt.event.KeyEvent;
 import java.awt.image.FilteredImageSource;
 import java.lang.reflect.InvocationTargetException;
@@ -330,3 +331,18 @@
         return new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
     }
+
+    /**
+     * Returns extended modifier key used as the appropriate accelerator key for menu shortcuts.
+     * It is advised everywhere to use {@link Toolkit#getMenuShortcutKeyMask()} to get the cross-platform modifier, but:
+     * <ul>
+     * <li>it returns KeyEvent.CTRL_MASK instead of KeyEvent.CTRL_DOWN_MASK. We used the extended
+     *    modifier for years, and Oracle recommends to use it instead, so it's best to keep it</li>
+     * <li>the method throws a HeadlessException ! So we would need to handle it for unit tests anyway</li>
+     * </ul>
+     * @return extended modifier key used as the appropriate accelerator key for menu shortcuts
+     * @since 7539
+     */
+    public static int getMenuShortcutKeyMaskEx() {
+        return Main.isPlatformOsx() ? KeyEvent.META_DOWN_MASK : KeyEvent.CTRL_DOWN_MASK;
+    }
 }
Index: trunk/src/org/openstreetmap/josm/gui/widgets/DisableShortcutsOnFocusGainedTextField.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/widgets/DisableShortcutsOnFocusGainedTextField.java	(revision 7538)
+++ trunk/src/org/openstreetmap/josm/gui/widgets/DisableShortcutsOnFocusGainedTextField.java	(revision 7539)
@@ -113,8 +113,10 @@
         disableMenuActions();
         unregisterActionShortcuts();
+        Main.map.keyDetector.setEnabled(false);
     }
 
     @Override
     public void focusLost(FocusEvent e) {
+        Main.map.keyDetector.setEnabled(true);
         restoreActionShortcuts();
         restoreMenuActions();
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 7538)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 7539)
@@ -18,7 +18,7 @@
 import java.util.Map;
 import java.util.Set;
+
 import javax.swing.AbstractAction;
 import javax.swing.JCheckBox;
-
 import javax.swing.JPanel;
 import javax.swing.JTable;
@@ -69,4 +69,5 @@
             this.num = num;
         }
+        @Override
         public String toString() {
             return tr("<delete from {0} objects>", num);
@@ -329,7 +330,9 @@
 
     /**
-     * Ask user and add the tags he confirm
+     * Ask user and add the tags he confirm.
      * @param keyValue is a table or {{tag1,val1},{tag2,val2},...}
      * @param sender is a string for skipping confirmations. Use epmty string for always confirmed adding.
+     * @param primitives OSM objects that will be modified
+     * @since 7521
      */
     public static void addTags(String[][] keyValue, String sender, Collection<? extends OsmPrimitive> primitives) {
Index: trunk/src/org/openstreetmap/josm/tools/InputMapUtils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/InputMapUtils.java	(revision 7538)
+++ trunk/src/org/openstreetmap/josm/tools/InputMapUtils.java	(revision 7539)
@@ -13,6 +13,6 @@
 
 /**
- * Tools to work with Swing InputMap
- *
+ * Tools to work with Swing InputMap.
+ * @since 5200
  */
 public final class InputMapUtils {
@@ -62,12 +62,18 @@
 
     /**
-     * Enable activating button on Enter (which is replaced with spacebar for certain Look-And-Feels)
+     * Enable activating button on Enter (which is replaced with spacebar for certain Look-And-Feels).
+     * @param b Button
      */
     public static void enableEnter(JButton b) {
          b.setFocusable(true);
          b.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter");
-         b.getActionMap().put("enter",b.getAction());
+         b.getActionMap().put("enter", b.getAction());
     }
 
+    /**
+     * Add an action activated with Enter key on a component.
+     * @param c The Swing component
+     * @param a action activated with Enter key
+     */
     public static void addEnterAction(JComponent c, Action a) {
          c.getActionMap().put("enter", a);
@@ -75,4 +81,9 @@
     }
 
+    /**
+     * Add an action activated with Spacebar key on a component.
+     * @param c The Swing component
+     * @param a action activated with Spacebar key
+     */
     public static void addSpacebarAction(JComponent c, Action a) {
          c.getActionMap().put("spacebar", a);
Index: trunk/src/org/openstreetmap/josm/tools/Shortcut.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 7538)
+++ trunk/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 7539)
@@ -19,4 +19,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 
 /**
@@ -27,10 +28,9 @@
  *       finally manages loading and saving shortcuts to/from the preferences.
  *
- * Action authors: You only need the {@link #registerShortcut} factory. Ignore everything
- *                 else.
+ * Action authors: You only need the {@link #registerShortcut} factory. Ignore everything else.
  *
  * All: Use only public methods that are also marked to be used. The others are
  *      public so the shortcut preferences can use them.
- *
+ * @since 1084
  */
 public final class Shortcut {
@@ -262,14 +262,24 @@
     }
 
+    /** None group: used with KeyEvent.CHAR_UNDEFINED if no shortcut is defined */
     public static final int NONE = 5000;
     public static final int MNEMONIC = 5001;
+    /** Reserved group: for system shortcuts only */
     public static final int RESERVED = 5002;
+    /** Direct group: no modifier */
     public static final int DIRECT = 5003;
+    /** Alt group */
     public static final int ALT = 5004;
+    /** Shift group */
     public static final int SHIFT = 5005;
+    /** Command group. Matches CTRL modifier on Windows/Linux but META modifier on OS X */
     public static final int CTRL = 5006;
+    /** Alt-Shift group */
     public static final int ALT_SHIFT = 5007;
+    /** Alt-Command group. Matches ALT-CTRL modifier on Windows/Linux but ALT-META modifier on OS X */
     public static final int ALT_CTRL = 5008;
+    /** Command-Shift group. Matches CTRL-SHIFT modifier on Windows/Linux but META-SHIFT modifier on OS X */
     public static final int CTRL_SHIFT = 5009;
+    /** Alt-Command-Shift group. Matches ALT-CTRL-SHIFT modifier on Windows/Linux but ALT-META-SHIFT modifier on OS X */
     public static final int ALT_CTRL_SHIFT = 5010;
 
@@ -285,4 +295,5 @@
         if (initdone) return;
         initdone = true;
+        int commandDownMask = GuiHelper.getMenuShortcutKeyMaskEx();
         groups.put(NONE, -1);
         groups.put(MNEMONIC, KeyEvent.ALT_DOWN_MASK);
@@ -290,9 +301,9 @@
         groups.put(ALT, KeyEvent.ALT_DOWN_MASK);
         groups.put(SHIFT, KeyEvent.SHIFT_DOWN_MASK);
-        groups.put(CTRL, KeyEvent.CTRL_DOWN_MASK);
+        groups.put(CTRL, commandDownMask);
         groups.put(ALT_SHIFT, KeyEvent.ALT_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK);
-        groups.put(ALT_CTRL, KeyEvent.ALT_DOWN_MASK|KeyEvent.CTRL_DOWN_MASK);
-        groups.put(CTRL_SHIFT, KeyEvent.CTRL_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK);
-        groups.put(ALT_CTRL_SHIFT, KeyEvent.ALT_DOWN_MASK|KeyEvent.CTRL_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK);
+        groups.put(ALT_CTRL, KeyEvent.ALT_DOWN_MASK|commandDownMask);
+        groups.put(CTRL_SHIFT, commandDownMask|KeyEvent.SHIFT_DOWN_MASK);
+        groups.put(ALT_CTRL_SHIFT, KeyEvent.ALT_DOWN_MASK|commandDownMask|KeyEvent.SHIFT_DOWN_MASK);
 
         // (1) System reserved shortcuts
