Index: src/org/openstreetmap/josm/actions/ReorderAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/ReorderAction.java	(revision 221)
+++ src/org/openstreetmap/josm/actions/ReorderAction.java	(revision 222)
@@ -2,9 +2,9 @@
 
 import static org.openstreetmap.josm.tools.I18n.tr;
+import static org.openstreetmap.josm.tools.I18n.trn;
 
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -14,14 +14,22 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.command.ChangeCommand;
+import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.command.SequenceCommand;
+import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Segment;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
 
 public class ReorderAction extends JosmAction {
 
 	public ReorderAction() {
-		super(tr("Reorder segments"), "reorder", tr("Try to reorder segments of a way so that they are in a line. May try to flip segments around to match a line."), KeyEvent.VK_R, KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK, true);
+		super(tr("Reorder Segments"), "reorder", tr("Try to reorder segments of a way so that they are in a line. May try to flip segments around to match a line."), KeyEvent.VK_R, KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK, true);
     }
 	
+	/**
+	 * This method first sorts all the segments in a way, then makes sure that all 
+	 * the segments are facing the same direction as the first one.
+	 */
 	public void actionPerformed(ActionEvent e) {
 		Collection<Way> ways = new LinkedList<Way>();
@@ -29,38 +37,126 @@
 			if (osm instanceof Way)
 				ways.add((Way)osm);
+		
 		if (ways.size() < 1) {
 			JOptionPane.showMessageDialog(Main.parent, tr("Please select at least one way."));
 			return;
 		}
+		
 		if (ways.size() > 1) {
-			int answer = JOptionPane.showConfirmDialog(Main.parent, tr("You selected more than one way. Reorder the segments of {0} ways?"), tr("Reorder segments"), JOptionPane.OK_CANCEL_OPTION);
+			int answer = JOptionPane.showConfirmDialog(Main.parent, 
+				trn(null, "You selected more than one way. Reorder the segments of {0} ways?", ways.size(), ways.size()), 
+				tr("Reorder segments"), JOptionPane.OK_CANCEL_OPTION);
 			if (answer != JOptionPane.OK_OPTION)
 				return;
 		}
+		boolean doneSomething = false;
 		for (Way way : ways) {
-			Way newWay = new Way(way);
-			newWay.segments.clear();
-			newWay.segments.addAll(sortSegments(new HashSet<Segment>(way.segments)));
-			Main.main.editLayer().add(new ChangeCommand(way, newWay));
-			Main.map.mapView.repaint();
+			if (!way.isIncomplete() && way.segments.size() > 1)
+			{			
+				doneSomething = true;
+				final LinkedList<Segment> sel = new LinkedList<Segment>(sortSegments(new LinkedList<Segment>(way.segments)));   	
+	
+		    	Collection<Command> c = new LinkedList<Command>();
+	
+		    	boolean direction = false;
+		    	// work out the "average" direction of the way, we use this to direct the rest of the segments
+		    	int dirCounter = 0;
+		    	for(int i = 0; i < sel.size() - 1; i++)
+		    	{
+		    		Segment firstSegment = sel.get(i);
+		    		Segment secondSegment = sel.get(i+1);
+		    		if ( firstSegment.to == secondSegment.from || firstSegment.to == secondSegment.to ) // direction = true when 'from' is the first node in the Way
+		    			dirCounter++;
+		    		else
+		    			dirCounter--;
+		    	}
+		    	if ( dirCounter <= 0 )
+		    		direction = false;
+		    	else
+		    		direction = true;
+		    	
+	    		Node lastNode = null;
+
+	    		// we need to calculate what the first node in the way is, we work from there
+	    		Segment firstSegment = sel.getFirst();
+	    		Segment secondSegment = sel.get(1);
+	    		if (firstSegment.to == secondSegment.from || firstSegment.to == secondSegment.to)
+	    			lastNode = firstSegment.from;
+	    		else
+	    			lastNode = firstSegment.to;
+	    		
+	    		// go through each segment and flip them if required
+	    		for (Segment s : sel) {
+	    			Segment snew = new Segment(s);
+	    			boolean segDirection = s.from == lastNode;
+	    			// segDirection = true when the 'from' node occurs before the 'to' node in the Way 
+	    			if (direction != segDirection)
+	    			{    			
+	    				// reverse the segment's direction
+	    				Node n = snew.from;
+	    				snew.from = snew.to;
+	    				snew.to = n;
+	    				c.add(new ChangeCommand(s, snew));
+	    			}	
+	    			
+		    		if (direction) // if its facing forwards,
+		    			lastNode = snew.to; // our next node is the 'to' one
+		    		else
+		    			lastNode = snew.from; // otherwise its the 'from' one
+		    	}
+
+		    	LinkedList<Segment> segments = new LinkedList<Segment>();
+		    	
+		    	// Now we recreate the segment list, in the correct order of the direction
+	    		for (Segment s : sel) 
+	    			if (!direction) 
+	    				segments.addFirst(s);
+	    			else
+	    				segments.addLast(s);
+	    			
+	    		// Check if the new segment list is actually different from the old one
+	    		// before we go and add a change command for it
+	    		for(int i = 0; i < segments.size(); i++)
+	    			if (way.segments.get(i) != segments.get(i))
+	    			{
+				    	Way newWay = new Way(way);
+				    	newWay.segments.clear();
+						newWay.segments.addAll(segments);
+						c.add(new ChangeCommand(way, newWay));
+						break;
+	    			}
+	
+	    		// Check we've got some change commands before we add a sequence command
+	    		if (c.size() != 0) {
+	    			NameVisitor v = new NameVisitor();
+	    			way.visit(v);
+	    			Main.main.editLayer().add(new SequenceCommand(tr("Reorder segments for way {0}",v.name), c));
+	    		}
+			}
 		}
+		if (!doneSomething) {
+			JOptionPane.showMessageDialog(Main.parent, 
+					trn("The selected way is incomplete or has only one segment.",
+							"None of the selected ways are complete and have more than one segment.",
+							ways.size()));
+		}
+		Main.map.repaint();
 	}
 
 	/**
-	 * sort the segments in best possible order. This is done by:
-	 * 0  if no elements in list, quit
-	 * 1  taking the first ls as pivot, remove it from list
-	 * 2  searching for a connection at from or to of pivot
-	 * 3  if found, attach it, remove it from list, goto 2
-	 * 4  if not found, save the pivot-string and goto 0
+	 * This sort is based on the sort in the old ReorderAction, but it works 
+	 * irresepective of the direction of the segments. This produces a sort 
+	 * that can be useful even if the segments are facing the wrong direction.
 	 */
-	public static LinkedList<Segment> sortSegments(HashSet<Segment> segmentSet) {
+	public static LinkedList<Segment> sortSegments(LinkedList<Segment> segments) {
+		
 		LinkedList<Segment> sortedSegments = new LinkedList<Segment>();
-		LinkedList<Segment> segments = new LinkedList<Segment>(segmentSet);
+		
 		while (!segments.isEmpty()) {
 			LinkedList<Segment> pivotList = new LinkedList<Segment>();
 			pivotList.add(segments.getFirst());
 			segments.removeFirst();
-			for (boolean found = true; found;) {
+			boolean found;
+			do {
 				found = false;
 				for (Iterator<Segment> it = segments.iterator(); it.hasNext();) {
@@ -68,18 +164,18 @@
 					if (ls.incomplete)
 						continue; // incomplete segments are never added to a new way
-					if (ls.from == pivotList.getLast().to) {
+					if (ls.from == pivotList.getLast().to || ls.to == pivotList.getLast().to || ls.from == pivotList.getLast().from || ls.to == pivotList.getLast().from) {
 						pivotList.addLast(ls);
 						it.remove();
 						found = true;
-					} else if (ls.to == pivotList.getFirst().from) {
+					} else if (ls.to == pivotList.getFirst().from || ls.from == pivotList.getFirst().from || ls.to == pivotList.getFirst().to || ls.from == pivotList.getFirst().to) {
 						pivotList.addFirst(ls);
-						it.remove();
+						it.remove(); 
 						found = true;
 					}
 				}
-			}
+			} while (found);
 			sortedSegments.addAll(pivotList);
 		}
 	    return sortedSegments;
-    }
+	}
 }
Index: src/org/openstreetmap/josm/actions/ReverseSegmentAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/ReverseSegmentAction.java	(revision 221)
+++ src/org/openstreetmap/josm/actions/ReverseSegmentAction.java	(revision 222)
@@ -26,5 +26,5 @@
 
     public ReverseSegmentAction() {
-    	super(tr("Reverse Segments"), "segmentflip", tr("Revert the direction of all selected Segments."), KeyEvent.VK_R, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK, true);
+    	super(tr("Reverse segments"), "segmentflip", tr("Reverse the direction of all selected Segments."), KeyEvent.VK_R, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK, true);
     }
 
Index: src/org/openstreetmap/josm/actions/mapmode/AddWayAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/mapmode/AddWayAction.java	(revision 221)
+++ src/org/openstreetmap/josm/actions/mapmode/AddWayAction.java	(revision 222)
@@ -92,5 +92,5 @@
 				for (Segment seg : way.segments) {
 					if (seg.incomplete) {
-						JOptionPane.showMessageDialog(Main.parent,tr("Warning: This way is incomplete. Try to download it, before adding segments."));
+						JOptionPane.showMessageDialog(Main.parent,tr("Warning: This way is incomplete. Try to download it before adding segments."));
 						return;
 					}
@@ -140,5 +140,5 @@
 			for (Segment seg : way.segments) {
 				if (seg.incomplete) {
-					JOptionPane.showMessageDialog(Main.parent, tr("Warning: This way is incomplete. Try to download it, before adding segments."));
+					JOptionPane.showMessageDialog(Main.parent, tr("Warning: This way is incomplete. Try to download it before adding segments."));
 					break;
 				}
@@ -188,5 +188,6 @@
 			return null;
 
-		LinkedList<Segment> sortedSegments = ReorderAction.sortSegments(segmentSet);
+		LinkedList<Segment> rawSegments = new LinkedList<Segment>(segmentSet);
+		LinkedList<Segment> sortedSegments = ReorderAction.sortSegments(rawSegments);
 
 		if (wayToAdd != null) {
