Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 5844)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 5845)
@@ -6,17 +6,18 @@
 import java.awt.Color;
 import java.awt.Component;
-import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
 import java.util.Collection;
+import java.util.HashMap;
 import javax.swing.AbstractAction;
-import javax.swing.DefaultCellEditor;
 
 import javax.swing.JPanel;
 import javax.swing.JTable;
-import javax.swing.JTextField;
 import javax.swing.KeyStroke;
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.ChangeEvent;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableCellEditor;
@@ -30,5 +31,4 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.gui.ExtendedDialog;
-import org.openstreetmap.josm.gui.util.TableCellEditorSupport;
 import org.openstreetmap.josm.gui.util.TableHelper;
 import org.openstreetmap.josm.tools.GBC;
@@ -50,4 +50,7 @@
     int[] count;
 
+    /**
+     * Class for displaying "delete from ... objects" in the table
+     */
     static class DeleteTagMarker {
         int num;
@@ -60,4 +63,50 @@
     }
     
+    /**
+     * Class for displaying list of existing tag values in the table
+     */
+    static class ExistingValues {
+        String tag;
+        HashMap<String, Integer> valueCount;
+        public ExistingValues(String tag) {
+            this.tag=tag; valueCount=new HashMap<String, Integer>();
+        }
+        
+        int addValue(String val) {
+            Integer c = valueCount.get(val);
+            int r = c==null? 1 : (c.intValue()+1);
+            valueCount.put(val, r);
+            return r;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder sb=new StringBuilder();
+            for (String k: valueCount.keySet()) {
+                if (sb.length()>0) sb.append(", ");
+                sb.append(k);
+            }
+            return sb.toString();
+        }
+
+        private String getToolTip() {
+            StringBuilder sb=new StringBuilder();
+            sb.append("<html>");
+            sb.append(tr("Old values of"));
+            sb.append(" <b>");
+            sb.append(tag);
+            sb.append("</b><br/>");
+            for (String k: valueCount.keySet()) {
+                sb.append("<b>");
+                sb.append(valueCount.get(k));
+                sb.append(" x </b>");
+                sb.append(k);
+                sb.append("<br/>");
+            }
+            sb.append("</html>");
+            return sb.toString();
+            
+        }
+    }
             
     public AddTagsDialog(String[][] tags) {
@@ -70,6 +119,6 @@
 
 
-        DefaultTableModel tm = new DefaultTableModel(new String[] {tr("Assume"), tr("Key"), tr("Value")}, tags.length) {
-            final Class<?> types[] = {Boolean.class, String.class, Object.class};
+        final DefaultTableModel tm = new DefaultTableModel(new String[] {tr("Assume"), tr("Key"), tr("Value"), tr("Existing values")}, tags.length) {
+            final Class<?> types[] = {Boolean.class, String.class, Object.class, ExistingValues.class};
             @Override
             public Class getColumnClass(int c) {
@@ -85,11 +134,15 @@
             count[i] = 0;
             String key = tags[i][0];
-            String value = tags[i][1];
+            String value = tags[i][1], oldValue;
             Boolean b = Boolean.TRUE;
+            ExistingValues old = new ExistingValues(key);
             for (OsmPrimitive osm : sel) {
-                if (osm.keySet().contains(key) && !osm.get(key).equals(value)) {
-                    b = Boolean.FALSE;
-                    count[i]++;
-                    break;
+                oldValue  = osm.get(key);
+                if (oldValue!=null) {
+                    old.addValue(oldValue);
+                    if (!oldValue.equals(value)) {
+                        b = Boolean.FALSE;
+                        count[i]++;
+                    }
                 }
             }
@@ -97,6 +150,7 @@
             tm.setValueAt(tags[i][0], i, 1);
             tm.setValueAt(tags[i][1].isEmpty() ? new DeleteTagMarker(count[i]) : tags[i][1], i, 2);
-        }
-
+            tm.setValueAt(old , i, 3);
+        }
+        
         propertyTable = new JTable(tm) {
 
@@ -120,8 +174,19 @@
             public TableCellEditor getCellEditor(int row, int column) {
                 Object value = getValueAt(row,column);
-                System.out.println(value);
                 if (value instanceof DeleteTagMarker) return null;
+                if (value instanceof ExistingValues) return null;
                 return getDefaultEditor(value.getClass());
             }
+
+            @Override
+            public String getToolTipText(MouseEvent event) {
+                int r = rowAtPoint(event.getPoint());
+                int c = columnAtPoint(event.getPoint());
+                Object o = getValueAt(r, c);
+                if (c==1 || c==2) return o.toString();
+                if (c==3) return ((ExistingValues)o).getToolTip();
+                return tr("Enable the checkbox to accept the value");
+            }
+            
         };
         
@@ -129,6 +194,7 @@
         // a checkbox has a size of 15 px
         propertyTable.getColumnModel().getColumn(0).setMaxWidth(15);
-        TableHelper.adjustColumnWidth(propertyTable, 1, 200);
-        TableHelper.adjustColumnWidth(propertyTable, 2, 700);
+        TableHelper.adjustColumnWidth(propertyTable, 1, 150);
+        TableHelper.adjustColumnWidth(propertyTable, 2, 400);
+        TableHelper.adjustColumnWidth(propertyTable, 3, 300);
         // get edit results if the table looses the focus, for example if a user clicks "add tags"
         propertyTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
@@ -139,5 +205,5 @@
             }
         });
-
+        
         // set the content of this AddTagsDialog consisting of the tableHeader and the table itself.
         JPanel tablePanel = new JPanel();
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java	(revision 5844)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java	(revision 5845)
@@ -4,4 +4,5 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.awt.Point;
 import java.util.HashMap;
 import org.openstreetmap.josm.Main;
@@ -10,4 +11,5 @@
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault;
@@ -64,9 +66,22 @@
         // Create a new node
         LatLon ll = new LatLon(lat, lon);
-        Node nnew = new Node(ll);
 
-        // Now execute the commands to add this node.
-        Main.main.undoRedo.add(new AddCommand(nnew));
-        Main.main.getCurrentDataSet().setSelected(nnew);
+        Node nd = null;
+        
+        if (Main.map != null &&  Main.map.mapView != null) {
+            Point p = Main.map.mapView.getPoint(ll);
+            nd = Main.map.mapView.getNearestNode(p, OsmPrimitive.isUsablePredicate);
+            if (nd!=null && nd.getCoor().greatCircleDistance(ll) > Main.pref.getDouble("remotecontrol.tolerance", 0.1)) {
+                nd = null; // node is too far
+            }
+        }
+
+        if (nd==null) {
+            nd = new Node(ll);
+            // Now execute the commands to add this node.
+            Main.main.undoRedo.add(new AddCommand(nd));
+        }
+        
+        Main.main.getCurrentDataSet().setSelected(nd);
         if (PermissionPrefWithDefault.CHANGE_VIEWPORT.isAllowed()) {
             AutoScaleAction.autoScale("selection");
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 5844)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 5845)
@@ -3,6 +3,8 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.awt.Point;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -15,4 +17,5 @@
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.util.GuiHelper;
@@ -31,4 +34,9 @@
     
     private final List<LatLon> allCoordinates = new ArrayList<LatLon>();
+
+    /**
+     * The place to remeber already added nodes (they are reused if needed @since 5845
+     */
+    HashMap<LatLon, Node> addedNodes;
 
     @Override
@@ -84,15 +92,49 @@
         }
     }
+    
+    /**
+     * Find the node with almost the same ccords in dataset or in already added nodes 
+     * @since 5845
+     **/
+    Node findOrCreateNode(LatLon ll,  List<Command> commands) {
+        Node nd = null;     
+         
+        if (Main.map != null && Main.map.mapView != null) {
+            Point p = Main.map.mapView.getPoint(ll);
+            nd = Main.map.mapView.getNearestNode(p, OsmPrimitive.isUsablePredicate);
+            if (nd!=null && nd.getCoor().greatCircleDistance(ll) > Main.pref.getDouble("remote.tolerance", 0.1)) {
+                nd = null; // node is too far
+            }
+        }
+        
+        Node prev = null;
+        for (LatLon lOld: addedNodes.keySet()) {
+            if (lOld.greatCircleDistance(ll) < Main.pref.getDouble("remotecontrol.tolerance", 0.1)) {
+                prev = addedNodes.get(lOld);
+                break;
+            }
+        }
 
+        if (prev!=null) {
+            nd = prev;
+        } else if (nd==null) {
+            nd = new Node(ll);
+            // Now execute the commands to add this node.
+            commands.add(new AddCommand(nd));
+            addedNodes.put(ll, nd);
+        }
+        return nd;
+    }
+    
     /*
      * This function creates the way with given coordinates of nodes
      */
     private void addWay() {
+        addedNodes = new HashMap<LatLon, Node>();
         Way way = new Way();
         List<Command> commands = new LinkedList<Command>();
         for (LatLon ll : allCoordinates) {
-            Node node = new Node(ll);
+            Node node = findOrCreateNode(ll, commands);
             way.addNode(node);
-            commands.add(new AddCommand(node));
         }
         allCoordinates.clear();
