Index: trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 6843)
+++ trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 6844)
@@ -333,9 +333,6 @@
             String res = actionParser.saveAction(aDef);
 
-            Collection<String> t = new LinkedList<String>(ToolbarPreferences.getToolString());
             // add custom search button to toolbar preferences
-            if (!t.contains(res)) t.add(res);
-            Main.pref.putCollection("toolbar", t);
-            Main.toolbar.refreshToolbarControl();
+            Main.toolbar.addCustomButton(res, -1, false);
         }
         return initialValues;
Index: trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java	(revision 6843)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java	(revision 6844)
@@ -469,11 +469,11 @@
      * Value: The action to execute.
      */
-    private Map<String, Action> actions = new HashMap<String, Action>();
-    private Map<String, Action> regactions = new HashMap<String, Action>();
-
-    private DefaultMutableTreeNode rootActionsNode = new DefaultMutableTreeNode(tr("Actions"));
+    private final Map<String, Action> actions = new HashMap<String, Action>();
+    private final Map<String, Action> regactions = new HashMap<String, Action>();
+
+    private final DefaultMutableTreeNode rootActionsNode = new DefaultMutableTreeNode(tr("Actions"));
 
     public JToolBar control = new JToolBar();
-    private Map<Object, ActionDefinition> buttonActions = new HashMap<Object, ActionDefinition>(30);
+    private final Map<Object, ActionDefinition> buttonActions = new HashMap<Object, ActionDefinition>(30);
 
     @Override
@@ -529,5 +529,5 @@
         private class ActionTransferable implements Transferable {
 
-            private DataFlavor[] flavors = new DataFlavor[] { ACTION_FLAVOR };
+            private final DataFlavor[] flavors = new DataFlavor[] { ACTION_FLAVOR };
 
             private final List<ActionDefinition> actions;
@@ -1056,4 +1056,27 @@
         control.repaint();
     }
+    
+    /**
+     * The method to add custom button on toolbar like search or preset buttons
+     * @param definitionText toolbar definition text to describe the new button,
+     * must be carefully generated by using {@link ActionParser}
+     * @param preferredIndex place to put the new button, give -1 for the end of toolbar
+     * @param removeIfExists if true and the button already exists, remove it
+     */
+    public void addCustomButton(String definitionText, int preferredIndex, boolean removeIfExists) {
+        LinkedList<String> t = new LinkedList<String>(getToolString());
+        if (t.contains(definitionText)) {
+            if (!removeIfExists) return; // do nothing
+            t.remove(definitionText);
+        } else {
+            if (preferredIndex>=0 && preferredIndex < t.size()) {
+                t.add(preferredIndex, definitionText); // add to specified place
+            } else {
+                t.add(definitionText); // add to the end
+            }
+        }
+        Main.pref.putCollection("toolbar", t);
+        Main.toolbar.refreshToolbarControl();
+    }
 
     private JButton addButtonAndShortcut(ActionDefinition action) {
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 6843)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 6844)
@@ -519,17 +519,6 @@
         public void actionPerformed(ActionEvent ae) {
             String res = getToolbarString();
-            LinkedList<String> t = new LinkedList<String>(ToolbarPreferences.getToolString());
-            if (t.contains(res)) {
-                t.remove(res);
-            } else {
-                if (toolbarIndex>=0) {
-                    t.add(toolbarIndex, res); // add to the old place
-                } else {
-                    t.add(res); // add to the end
-                }
-            }
-            Main.pref.putCollection("toolbar", t);
-            Main.toolbar.refreshToolbarControl();
-            }
+            Main.toolbar.addCustomButton(res, toolbarIndex, true);
+        }
     }
     
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java	(revision 6843)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java	(revision 6844)
@@ -5,4 +5,5 @@
 import java.awt.Component;
 import java.awt.Dimension;
+import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
@@ -17,5 +18,7 @@
 import java.util.EnumSet;
 import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
+import javax.swing.AbstractAction;
 import javax.swing.AbstractListModel;
 import javax.swing.Action;
@@ -27,4 +30,5 @@
 import javax.swing.JList;
 import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
 import javax.swing.JScrollPane;
 import javax.swing.event.DocumentEvent;
@@ -39,4 +43,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.preferences.BooleanProperty;
+import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference;
 import org.openstreetmap.josm.gui.tagging.TaggingPresetItems.Key;
@@ -45,4 +50,6 @@
 import org.openstreetmap.josm.gui.tagging.TaggingPresetItems.Roles;
 import org.openstreetmap.josm.gui.widgets.JosmTextField;
+import org.openstreetmap.josm.gui.widgets.ListPopupMenu;
+import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
 import static org.openstreetmap.josm.tools.I18n.tr;
 
@@ -70,5 +77,6 @@
     private final List<PresetClassification> classifications = new ArrayList<PresetClassification>();
     private ResultListModel lsResultModel = new ResultListModel();
-    
+    private JPopupMenu popupMenu;
+
     private ActionListener dblClickListener;
     private ActionListener clickListener;
@@ -288,6 +296,14 @@
 
         setPreferredSize(new Dimension(400, 300));
-        
         filterPresets();
+        popupMenu = new JPopupMenu();
+        popupMenu.add(new AbstractAction(tr("Add toolbar button")) {
+            @Override
+            public void actionPerformed(ActionEvent ae) {
+                String res = getSelectedPreset().getToolbarString();
+                Main.toolbar.addCustomButton(res, -1, false);
+            }
+        });
+        lsResult.addMouseListener(new PopupMenuLauncher(popupMenu));
     }
     
