Index: trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 5655)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 5656)
@@ -3,5 +3,4 @@
 
 import static org.openstreetmap.josm.tools.I18n.tr;
-import static org.openstreetmap.josm.tools.I18n.trn;
 
 import java.awt.Component;
@@ -131,5 +130,6 @@
                 int row = propertyTable.rowAtPoint(e.getPoint());
                 if (row > -1) {
-                    editHelper.editProperty(row);
+                    boolean focusOnKey = (propertyTable.columnAtPoint(e.getPoint()) == 0);
+                    editHelper.editProperty(row, focusOnKey);
                 } else {
                     editHelper.addProperty();
@@ -876,5 +876,5 @@
             if (propertyTable.getSelectedRowCount() == 1) {
                 int row = propertyTable.getSelectedRow();
-                editHelper.editProperty(row);
+                editHelper.editProperty(row, false);
             } else if (membershipTable.getSelectedRowCount() == 1) {
                 int row = membershipTable.getSelectedRow();
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java	(revision 5655)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java	(revision 5656)
@@ -24,4 +24,6 @@
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
 import java.awt.image.BufferedImage;
 import java.util.ArrayList;
@@ -138,6 +140,8 @@
     * Edit the value in the properties 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
+    * @since 5653
     */
-    public void editProperty(final int row) {
+    public void editProperty(final int row, boolean focusOnKey) {
         changedKey = null;
         sel = Main.main.getCurrentDataSet().getSelected();
@@ -148,5 +152,5 @@
         
         final EditTagDialog editDialog = new EditTagDialog(key, row, 
-                (Map<String, Integer>) propertyData.getValueAt(row, 1));
+                (Map<String, Integer>) propertyData.getValueAt(row, 1), focusOnKey);
         editDialog.showDialog();
         if (editDialog.getValue() !=1 ) return;
@@ -178,40 +182,8 @@
     }
 
-    /**
-     * Create a focus handling adapter and apply in to the editor component of value
-     * autocompletion box.
-     * @param keys Box for keys entering and autocompletion
-     * @param values Box for values entering and autocompletion
-     * @param autocomplete Manager handling the autocompletion
-     * @param comparator Class to decide what values are offered on autocompletion
-     * @return The created adapter
-     */
-    private FocusAdapter addFocusAdapter(final AutoCompletingComboBox keys, final AutoCompletingComboBox values,
-            final AutoCompletionManager autocomplete, final Comparator<AutoCompletionListItem> comparator) {
-        // get the combo box' editor component
-        JTextComponent editor = (JTextComponent)values.getEditor()
-                .getEditorComponent();
-        // Refresh the values model when focus is gained
-        FocusAdapter focus = new FocusAdapter() {
-            @Override public void focusGained(FocusEvent e) {
-                String key = keys.getEditor().getItem().toString();
-
-                List<AutoCompletionListItem> valueList = autocomplete.getValues(getAutocompletionKeys(key));
-                Collections.sort(valueList, comparator);
-
-                values.setPossibleACItems(valueList);
-                objKey=key;
-            }
-        };
-        editor.addFocusListener(focus);
-        return focus;
-    }
-    
-        
     public class EditTagDialog extends AbstractTagsDialog {
-        String oldValue;
-        String key;
-        Map<String, Integer> m;
-        int row;
+        final String key;
+        final Map<String, Integer> m;
+        final int row;
 
         Comparator<AutoCompletionListItem> usedValuesAwareComparator = new Comparator<AutoCompletionListItem>() {
@@ -249,5 +221,5 @@
             };
         
-        private EditTagDialog(String key, int row, Map<String, Integer> map) {
+        private EditTagDialog(String key, int row, Map<String, Integer> map, final boolean initialFocusOnKey) {
             super(Main.parent, trn("Change value?", "Change values?", map.size()), new String[] {tr("OK"),tr("Cancel")});
             setButtonIcons(new String[] {"ok","cancel"});
@@ -302,21 +274,18 @@
                 }
             });
-            addFocusAdapter(keys, values, autocomplete, usedValuesAwareComparator);
+            addFocusAdapter(autocomplete, usedValuesAwareComparator);
             
             setContent(mainPanel, false);
             
-            // TODO: Is it correct place for thois code - was in 
-            //  new JOptionPane(p, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION) {
-            //    @Override public void selectInitialValue() {
-            Clipboard sysSel = Toolkit.getDefaultToolkit().getSystemSelection();
-            if(sysSel != null) {
-                Transferable old = sysSel.getContents(null);
-                values.requestFocusInWindow();
-                values.getEditor().selectAll();
-                sysSel.setContents(old, null);
-            } else {
-                values.requestFocusInWindow();
-                values.getEditor().selectAll();
-            }
+            addWindowListener(new WindowAdapter() {
+                @Override
+                public void windowOpened(WindowEvent e) {
+                    if (initialFocusOnKey) {
+                        selectKeysComboBox();
+                    } else {
+                        selectValuesCombobox();
+                    }
+                }
+            });
         }
         
@@ -426,4 +395,56 @@
             super.setVisible(visible);
         }
+        
+        private void selectACComboBoxSavingUnixBuffer(AutoCompletingComboBox cb) {
+            // select compbobox with saving unix system selection (middle mouse paste)
+            Clipboard sysSel = Toolkit.getDefaultToolkit().getSystemSelection();
+            if(sysSel != null) {
+                Transferable old = sysSel.getContents(null);
+                cb.requestFocusInWindow();
+                cb.getEditor().selectAll();
+                sysSel.setContents(old, null);
+            } else {
+                cb.requestFocusInWindow();
+                cb.getEditor().selectAll();
+            }
+        }
+        
+        public void selectKeysComboBox() {
+            selectACComboBoxSavingUnixBuffer(keys);
+        }
+        
+        public void selectValuesCombobox()   {
+            selectACComboBoxSavingUnixBuffer(values);
+        }
+        
+        /**
+        * Create a focus handling adapter and apply in to the editor component of value
+        * autocompletion box.
+        * @param keys Box for keys entering and autocompletion
+        * @param values Box for values entering and autocompletion
+        * @param autocomplete Manager handling the autocompletion
+        * @param comparator Class to decide what values are offered on autocompletion
+        * @return The created adapter
+        */
+        protected FocusAdapter addFocusAdapter(final AutoCompletionManager autocomplete, final Comparator<AutoCompletionListItem> comparator) {
+           // get the combo box' editor component
+           JTextComponent editor = (JTextComponent)values.getEditor()
+                   .getEditorComponent();
+           // Refresh the values model when focus is gained
+           FocusAdapter focus = new FocusAdapter() {
+               @Override public void focusGained(FocusEvent e) {
+                   String key = keys.getEditor().getItem().toString();
+
+                   List<AutoCompletionListItem> valueList = autocomplete.getValues(getAutocompletionKeys(key));
+                   Collections.sort(valueList, comparator);
+
+                   values.setPossibleACItems(valueList);
+                   objKey=key;
+               }
+           };
+           editor.addFocusListener(focus);
+           return focus;
+       }
+        
     }
 
@@ -485,5 +506,5 @@
             }
 
-            FocusAdapter focus = addFocusAdapter(keys, values, autocomplete, defaultACItemComparator);
+            FocusAdapter focus = addFocusAdapter(autocomplete, defaultACItemComparator);
             // fire focus event in advance or otherwise the popup list will be too small at first
             focus.focusGained(null);
@@ -501,4 +522,5 @@
                     public void actionPerformed(ActionEvent e) {
                         performTagAdding();
+                        selectKeysComboBox();
                     }
                 });
@@ -508,17 +530,5 @@
             setContent(mainPanel, false);
             
-            // TODO: Is it correct place for this code - was in 
-            //  new JOptionPane(p, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION) {
-            //    @Override public void selectInitialValue() {
-            Clipboard sysSel = Toolkit.getDefaultToolkit().getSystemSelection();
-            if(sysSel != null) {
-                Transferable old = sysSel.getContents(null);
-                values.requestFocusInWindow();
-                values.getEditor().selectAll();
-                sysSel.setContents(old, null);
-            } else {
-                values.requestFocusInWindow();
-                values.getEditor().selectAll();
-            }
+            selectKeysComboBox();
         }
 
@@ -547,4 +557,5 @@
                         focus.focusGained(null);
                         values.setSelectedItem(t.getValue());
+                        selectValuesCombobox();
                     }
                 };
@@ -583,4 +594,5 @@
                             if (e.isShiftDown()) {
                                 performTagAdding();
+                                selectKeysComboBox();
                             }
                         }
