Index: /trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 4947)
+++ /trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 4948)
@@ -3,5 +3,4 @@
 
 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
-import org.openstreetmap.josm.gui.preferences.ToolbarPreferences.ActionParser;
 import static org.openstreetmap.josm.tools.I18n.tr;
 import static org.openstreetmap.josm.tools.I18n.trc;
@@ -35,7 +34,7 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.ActionParameter;
-import org.openstreetmap.josm.actions.ActionParameter.SearchSettingsActionParameter;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.actions.ParameterizedAction;
+import org.openstreetmap.josm.actions.ActionParameter.SearchSettingsActionParameter;
 import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -44,4 +43,5 @@
 import org.openstreetmap.josm.gui.ExtendedDialog;
 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
+import org.openstreetmap.josm.gui.preferences.ToolbarPreferences.ActionParser;
 import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
 import org.openstreetmap.josm.tools.GBC;
@@ -211,6 +211,4 @@
         final HistoryComboBox hcbSearchString = new HistoryComboBox();
         hcbSearchString.setText(initialValues.text);
-        hcbSearchString.getEditor().selectAll();
-        hcbSearchString.getEditor().getEditorComponent().requestFocusInWindow();
         hcbSearchString.setToolTipText(tr("Enter the search expression"));
         // we have to reverse the history, because ComboBoxHistory will reverse it again
@@ -251,5 +249,5 @@
             left.add(allElements, GBC.eol());
             left.add(regexSearch, GBC.eol());
-            left.add(addOnToolbar, GBC.eol()); 
+            left.add(addOnToolbar, GBC.eol());
         }
 
@@ -309,7 +307,7 @@
         initialValues.allElements = allElements.isSelected();
         initialValues.regexSearch = regexSearch.isSelected();
-        
+
         if (addOnToolbar.isSelected()) {
-            ToolbarPreferences.ActionDefinition aDef = 
+            ToolbarPreferences.ActionDefinition aDef =
                     new ToolbarPreferences.ActionDefinition(Main.main.menu.search);
             aDef.getParameters().put("searchExpression", initialValues);
@@ -317,5 +315,5 @@
             ActionParser actionParser = new ToolbarPreferences.ActionParser(null);
             String res = actionParser.saveAction(aDef);
-            
+
             Collection<String> t = new LinkedList<String>(ToolbarPreferences.getToolString());
             // add custom search button to toolbar preferences
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 4947)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 4948)
@@ -7,9 +7,12 @@
 import java.awt.BorderLayout;
 import java.awt.Component;
-import java.awt.Dialog.ModalityType;
 import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.GridBagLayout;
 import java.awt.Point;
+import java.awt.Toolkit;
+import java.awt.Dialog.ModalityType;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.Transferable;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -33,9 +36,9 @@
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.Vector;
+import java.util.Map.Entry;
 
 import javax.swing.AbstractAction;
@@ -85,6 +88,6 @@
 import org.openstreetmap.josm.data.osm.event.DataSetListenerAdapter;
 import org.openstreetmap.josm.data.osm.event.DatasetEventManager;
+import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
-import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
 import org.openstreetmap.josm.gui.DefaultNameFormatter;
 import org.openstreetmap.josm.gui.ExtendedDialog;
@@ -302,6 +305,15 @@
         final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION) {
             @Override public void selectInitialValue() {
+                // save unix system selection (middle mouse paste)
+                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();
+                }
             }
         };
@@ -498,6 +510,15 @@
         JOptionPane pane = new JOptionPane(p, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION){
             @Override public void selectInitialValue() {
+                // save unix system selection (middle mouse paste)
+                Clipboard sysSel = Toolkit.getDefaultToolkit().getSystemSelection();
+                if(sysSel != null) {
+                    Transferable old = sysSel.getContents(null);
                 keys.requestFocusInWindow();
                 keys.getEditor().selectAll();
+                    sysSel.setContents(old, null);
+                } else {
+                    keys.requestFocusInWindow();
+                    keys.getEditor().selectAll();
+                }
             }
         };
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java	(revision 4947)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java	(revision 4948)
@@ -3,4 +3,7 @@
 
 import java.awt.Component;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.Transferable;
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
@@ -28,5 +31,5 @@
 
     private boolean autocompleteEnabled = true;
-    
+
     private int maxTextLength = -1;
 
@@ -53,7 +56,6 @@
             if (selecting || (offs == 0 && str.equals(getText(0, getLength()))))
                 return;
-            if (maxTextLength > -1 && str.length()+getLength() > maxTextLength) {
-                return;
-            }
+            if (maxTextLength > -1 && str.length()+getLength() > maxTextLength)
+                return;
             boolean initial = (offs == 0 && getLength() == 0 && str.length() > 1);
             super.insertString(offs, str, a);
@@ -110,6 +112,13 @@
             }
             JTextComponent editor = (JTextComponent)comboBox.getEditor().getEditorComponent();
-            editor.setSelectionStart(start);
-            editor.setSelectionEnd(end);
+            // save unix system selection (middle mouse paste)
+            Clipboard sysSel = Toolkit.getDefaultToolkit().getSystemSelection();
+            if(sysSel != null) {
+                Transferable old = sysSel.getContents(null);
+                editor.select(start, end);
+                sysSel.setContents(old, null);
+            } else {
+                editor.select(start, end);
+            }
         }
 
@@ -125,7 +134,6 @@
             for (int i = 0, n = model.getSize(); i < n; i++) {
                 AutoCompletionListItem currentItem = (AutoCompletionListItem) model.getElementAt(i);
-                if (currentItem.getValue().equals(pattern)) {
+                if (currentItem.getValue().equals(pattern))
                     return currentItem;
-                }
                 if (!match && currentItem.getValue().startsWith(pattern)) {
                     if (bestItem == null || currentItem.getPriority().compareTo(bestItem.getPriority()) > 0) {
@@ -147,5 +155,13 @@
                     }
                     public void focusGained(FocusEvent e) {
+                        // save unix system selection (middle mouse paste)
+                        Clipboard sysSel = Toolkit.getDefaultToolkit().getSystemSelection();
+                        if(sysSel != null) {
+                            Transferable old = sysSel.getContents(null);
                         editor.selectAll();
+                            sysSel.setContents(old, null);
+                        } else {
+                            editor.selectAll();
+                        }
                     }
                 }
@@ -154,5 +170,5 @@
         setMaximumRowCount(maxsize);
     }
-    
+
     public void setMaxTextLength(int length)
     {
@@ -212,5 +228,9 @@
             model.addElement(new AutoCompletionListItem(elem, AutoCompletionItemPritority.UNKNOWN));
         }
+        // disable autocomplete to prevent unnecessary actions in
+        // AutoCompletingComboBoxDocument#insertString
+        autocompleteEnabled = false;
         this.getEditor().setItem(oldValue);
+        autocompleteEnabled = true;
     }
 
