Index: trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 4586)
+++ trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 4587)
@@ -3,4 +3,5 @@
 
 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;
@@ -36,4 +37,5 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.gui.ExtendedDialog;
+import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
 import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
 import org.openstreetmap.josm.tools.GBC;
@@ -186,4 +188,5 @@
         allElements.setToolTipText(tr("Also include incomplete and deleted objects in search."));
         final JCheckBox regexSearch   = new JCheckBox(tr("regular expression"), initialValues.regexSearch);
+        final JCheckBox addOnToolbar  = new JCheckBox(tr("Add toolbar button"), false); 
 
         JPanel top = new JPanel(new GridBagLayout());
@@ -200,4 +203,5 @@
             left.add(allElements, GBC.eol());
             left.add(regexSearch, GBC.eol());
+            left.add(addOnToolbar, GBC.eol()); 
         }
 
@@ -293,4 +297,21 @@
         initialValues.allElements = allElements.isSelected();
         initialValues.regexSearch = regexSearch.isSelected();
+        
+        if (addOnToolbar.isSelected()) {
+            ToolbarPreferences.ActionDefinition aDef = 
+                    new ToolbarPreferences.ActionDefinition(Main.main.menu.search);
+            aDef.getParameters().put("searchExpression", initialValues);
+            // parametrized action definition is now composed
+            ActionParser actionParser = new ToolbarPreferences.ActionParser(null);
+            String res = actionParser.saveAction(aDef);
+            
+            Collection<String> t = new LinkedList<String>(Main.pref.getCollection("toolbar"));
+            if (t!=null) {
+                // add custom search button to toolbar preferences
+                if (!t.contains(res)) t.add(res);
+                Main.pref.putCollection("toolbar", t);
+                Main.toolbar.refreshToolbarControl();
+            }
+        }
         return initialValues;
     }
