Index: /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressEditContainer.java
===================================================================
--- /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressEditContainer.java	(revision 23852)
+++ /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressEditContainer.java	(revision 23853)
@@ -139,4 +139,6 @@
 			
 			if (sNode != null) {
+				// TODO: Check if sgemnt really belongs to the street, even if the
+				// names are the same.
 				sNode.addStreetSegment(newSegment);
 			} else {
Index: /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressNode.java
===================================================================
--- /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressNode.java	(revision 23852)
+++ /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/AddressNode.java	(revision 23853)
@@ -14,7 +14,4 @@
 package org.openstreetmap.josm.plugins.addressEdit;
 
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.command.ChangeCommand;
-import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 
Index: /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/StringUtils.java
===================================================================
--- /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/StringUtils.java	(revision 23853)
+++ /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/StringUtils.java	(revision 23853)
@@ -0,0 +1,150 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under 
+ * the terms of the GNU General Public License as published by the 
+ * Free Software Foundation, either version 3 of the License, or 
+ * (at your option) any later version. 
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
+ * See the GNU General Public License for more details. 
+ * 
+ * You should have received a copy of the GNU General Public License along with this program. 
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openstreetmap.josm.plugins.addressEdit;
+
+import java.util.List;
+
+public class StringUtils {
+	/**
+	 * Checks, if a string is either null or empty.
+	 * 
+	 * @param txt
+	 *            Text to check
+	 * @return True, if string is null or empty; otherwise false
+	 */
+	public static boolean isNullOrEmpty(String txt) {
+		return txt == null || txt.length() == 0;
+	}
+
+	/**
+	 * Gets the length of the longest common substring of a and b
+	 * 
+	 * @param a
+	 *            First string
+	 * @param b
+	 *            Second string
+	 * @return The length of the longest common substring or 0, if no common
+	 *         sequence exists or one of the arguments are invalid. For
+	 *         algorithm details please refer to {@link http
+	 *         ://www.ics.uci.edu/~eppstein/161/960229.html}
+	 */
+	public static int lcsLength(String a, String b) {
+		if (StringUtils.isNullOrEmpty(a))
+			return 0;
+		if (StringUtils.isNullOrEmpty(b))
+			return 0;
+
+		int[][] L = createLCSTable(a, b);
+		return L[0][0];
+	}
+
+	/**
+	 * Internal use only
+	 */
+	private static int[][] createLCSTable(String a, String b) {
+		if (StringUtils.isNullOrEmpty(a))
+			return null;
+		if (StringUtils.isNullOrEmpty(b))
+			return null;
+
+		int m = a.length();
+		int n = b.length();
+		int[][] l = new int[m + 1][n + 1];
+		for (int i = 0; i < l.length; i++) {
+			l[i] = new int[n + 1];
+		}
+
+		int i, j;
+		for (i = m - 1; i >= 0; i--) {
+			for (j = n - 1; j >= 0; j--) {
+				/*
+				 * if (i >= m || j >= n) { l[i][j] = 0; } else
+				 */if (a.charAt(i) == b.charAt(j)) {
+					l[i][j] = 1 + l[i + 1][j + 1];
+				} else {
+					l[i][j] = Math.max(l[i + 1][j], l[i][j + 1]);
+				}
+			}
+		}
+		return l;
+	}
+
+	/**
+	 * Gets the longest common substring of a and b.
+	 * 
+	 * @param a The first string.
+	 * @param b The second string.
+	 * @return
+	 */
+	public static String getLongestCommonSubstring(String a, String b) {
+		if (StringUtils.isNullOrEmpty(a))
+			return null;
+		if (StringUtils.isNullOrEmpty(b))
+			return null;
+
+		StringBuffer sb = new StringBuffer();
+		int[][] l = createLCSTable(a, b);
+		int m = a.length();
+		int n = b.length();
+		int i = 0;
+		int j = 0;
+		while (i < m && j < n) {
+			char aa = a.charAt(i);
+			char bb = b.charAt(j);
+			if (aa == bb) {
+				sb.append(aa);
+				i++;
+				j++;
+			} else if (l[i + 1][j] >= l[i][j + 1]) {
+				i++;
+			} else {
+				j++;
+			}
+		}
+
+		l = null;
+		return sb.toString();
+	}
+		
+	/**
+	 * @param needle The string to find the best match for.
+	 * @param haystack The list of strings to pick the the best match from.
+	 * @return The string of the list with the longest common substring to needle or
+	 * <tt>null</tt>, if either <tt>needle</tt> or <tt>haystack</tt> is empty or null.
+	 */
+	public static String findBestMatch(String needle, List<String> haystack) {
+		String bestMatch = null;
+		double maxRatio = Double.MIN_VALUE;
+				
+		if (StringUtils.isNullOrEmpty(needle)) {
+			return null;
+		}
+		if (haystack == null || haystack.size() == 0) {
+			return null;
+		}
+		
+		int lNeedle = needle.length();
+		for (String curString : haystack) {
+			int ll = lcsLength(needle, curString);
+			double ratio = ll / (double)lNeedle;
+			if (ratio > maxRatio) {
+				maxRatio = ratio;
+				bestMatch = curString;
+			}
+			
+		}
+		
+		return bestMatch;
+	}
+}
Index: /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/gui/AddressEditDialog.java
===================================================================
--- /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/gui/AddressEditDialog.java	(revision 23852)
+++ /applications/editors/josm/plugins/AddressEdit/src/org/openstreetmap/josm/plugins/addressEdit/gui/AddressEditDialog.java	(revision 23853)
@@ -34,4 +34,5 @@
 import javax.swing.JSeparator;
 import javax.swing.JSplitPane;
+import javax.swing.JTabbedPane;
 import javax.swing.JTable;
 import javax.swing.ListSelectionModel;
@@ -41,5 +42,4 @@
 import org.openstreetmap.gui.jmapviewer.JMapViewer;
 import org.openstreetmap.gui.jmapviewer.MapMarkerDot;
-import org.openstreetmap.josm.data.osm.BBox;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.Way;
@@ -49,5 +49,5 @@
 import org.openstreetmap.josm.plugins.addressEdit.INodeEntity;
 import org.openstreetmap.josm.plugins.addressEdit.StreetNode;
-import org.openstreetmap.josm.plugins.addressEdit.StreetSegmentNode;
+import org.openstreetmap.josm.plugins.addressEdit.StringUtils;
 
 public class AddressEditDialog extends JFrame implements ActionListener, ListSelectionListener, IAddressEditContainerListener {
@@ -64,5 +64,5 @@
 	private JTable unresolvedTable;
 	private JTable incompleteTable;
-	private JTable streetList;
+	private JTable streetTable;
 	
 	private AssignAddressToStreetAction resolveAction = new AssignAddressToStreetAction();
@@ -96,9 +96,9 @@
 			/* Panel for street table */
 			JPanel streetPanel = new JPanel(new BorderLayout());
-			streetList = new JTable(new StreetTableModel(editContainer));
-			streetList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-			streetList.getSelectionModel().addListSelectionListener(this);
-			
-			JScrollPane scroll1 = new JScrollPane(streetList);
+			streetTable = new JTable(new StreetTableModel(editContainer));
+			streetTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+			streetTable.getSelectionModel().addListSelectionListener(this);
+			
+			JScrollPane scroll1 = new JScrollPane(streetTable);
 			streetPanel.add(scroll1, BorderLayout.CENTER);
 			
@@ -112,4 +112,5 @@
 			unresolvedTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
 			unresolvedTable.getSelectionModel().addListSelectionListener(this);
+			unresolvedTable.getSelectionModel().addListSelectionListener(new IncompleteAddressListener());
 			
 			JScrollPane scroll2 = new JScrollPane(unresolvedTable);
@@ -138,13 +139,10 @@
 			incompletePanel.setMinimumSize(new Dimension(350, 200));
 			
+			
+			
 			/* Edit panel for incomplete addresses */
 			JPanel incompleteEditPanel = new JPanel();
 			incompleteEditPanel.setMinimumSize(new Dimension(350, 300));
-			
-			/* Combine panels */
-			JSplitPane unresSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, streetPanel, unresolvedPanel);
-			JSplitPane addrSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, incompleteEditPanel, incompletePanel);			
-			JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, unresSplitPane, addrSplitPane);
-			
+
 			/* Map Panel */
 			JPanel mapPanel = new JPanel(new BorderLayout());
@@ -152,11 +150,17 @@
 			mapPanel.add(mapViewer, BorderLayout.CENTER);
 			mapPanel.setMinimumSize(new Dimension(200, 200));
-			mapLabel = createHeaderLabel(tr("Map"));
-			mapPanel.add(mapLabel, BorderLayout.NORTH);
-			mapPanel.add(new JSeparator(), BorderLayout.SOUTH);
 			mapViewer.setVisible(false);
 			
+			JTabbedPane tab = new JTabbedPane();
+			tab.addTab(tr("Properties"), incompleteEditPanel);
+			tab.addTab(tr("Map"), mapPanel);
+			
+			/* Combine panels */
+			JSplitPane unresSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, streetPanel, unresolvedPanel);
+			JSplitPane addrSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tab, incompletePanel);			
+			JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, unresSplitPane, addrSplitPane);
+			
 			this.getContentPane().add(pane, BorderLayout.CENTER);
-			this.getContentPane().add(mapPanel, BorderLayout.EAST);
+			//this.getContentPane().add(mapPanel, BorderLayout.SOUTH);
 		} else {
 			this.getContentPane().add(new JLabel(tr("(No data)")), BorderLayout.CENTER);
@@ -218,5 +222,5 @@
 		
 		AddressEditSelectionEvent ev = new AddressEditSelectionEvent(e.getSource(),
-				streetList, unresolvedTable, incompleteTable, editContainer);
+				streetTable, unresolvedTable, incompleteTable, editContainer);
 		
 		for (AbstractAddressEditAction action : actions) {
@@ -274,4 +278,41 @@
 		updateHeaders();
 	}
+	
+	/**
+	 * Special listener to react on selection changes in the incomplete address list. 
+	 * It searches the street table for the streets which matches best matching to the
+	 * street name given in the address.
+	 *   
+	 * @author Oliver Wieland <oliver.wieland@online.de> 
+	 */
+	
+	class IncompleteAddressListener implements ListSelectionListener {
+
+		@Override
+		public void valueChanged(ListSelectionEvent e) {
+			if (unresolvedTable.getSelectedRowCount() == 1) {
+				String streetOfAddr = (String) unresolvedTable.
+											getModel().getValueAt(unresolvedTable.getSelectedRow(), 0);
+				
+				int maxScore = 0, score = 0, row = -1;
+				for (int i = 0; i < streetTable.getRowCount(); i++) {
+					String streetName = (String) streetTable.getModel().getValueAt(i, 1);
+					
+					score = StringUtils.lcsLength(streetOfAddr, streetName);
+					if (score > maxScore) {
+						maxScore = score;
+						row = i; 
+					}
+				}
+				
+				if (row > 0) {
+					streetTable.getSelectionModel().clearSelection();
+					streetTable.getSelectionModel().addSelectionInterval(row, row);
+					streetTable.scrollRectToVisible(streetTable.getCellRect(row, 0, true));
+				}
+			}			
+		}
+		
+	}
 
 }
