Index: plications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/DirectionTest.java
===================================================================
--- /applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/DirectionTest.java	(revision 32567)
+++ 	(revision )
@@ -1,199 +1,0 @@
-package org.openstreetmap.josm.plugins.pt_assistant.validation;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.openstreetmap.josm.command.ChangeCommand;
-import org.openstreetmap.josm.command.Command;
-import org.openstreetmap.josm.command.SequenceCommand;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
-import org.openstreetmap.josm.data.osm.OsmUtils;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.osm.RelationMember;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.data.validation.Severity;
-import org.openstreetmap.josm.data.validation.Test;
-import org.openstreetmap.josm.data.validation.TestError;
-import org.openstreetmap.josm.gui.dialogs.relation.sort.WayConnectionType;
-import org.openstreetmap.josm.gui.dialogs.relation.sort.WayConnectionTypeCalculator;
-import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils;
-
-public class DirectionTest extends Test {
-
-	public static final int ERROR_CODE_DIRECTION = 3731;
-	public static final int ERROR_CODE_UNSPLIT_ROUNDABOUT = 3732;
-	public static final int ERROR_CODE_SPLIT_ROUNDABOUT = 3733;
-
-	public DirectionTest() {
-		super(tr("Direction Test"), tr("Checks if the route runs against the direction of underlying one-way roads"));
-
-	}
-
-	@Override
-	public void visit(Relation r) {
-
-		if (!RouteUtils.isTwoDirectionRoute(r)) {
-			return;
-		}
-
-		if (RouteUtils.hasIncompleteMembers(r)) {
-			return;
-		}
-
-		if (!r.hasTag("route", "bus") && !r.hasTag("route", "trolleybus") && !r.hasTag("route", "share_taxi")) {
-			return;
-		}
-		
-		List<RelationMember> waysToCheck = new ArrayList<>();
-
-		for (RelationMember rm : r.getMembers()) {
-			if (RouteUtils.isPTWay(rm) && rm.getType().equals(OsmPrimitiveType.WAY)) {
-				waysToCheck.add(rm);
-			}
-		}
-
-		if (waysToCheck.isEmpty()) {
-			return;
-		}
-		
-		
-
-		WayConnectionTypeCalculator connectionTypeCalculator = new WayConnectionTypeCalculator();
-		final List<WayConnectionType> links = connectionTypeCalculator.updateLinks(waysToCheck);
-
-		for (int i = 0; i < links.size(); i++) {
-			if ((OsmUtils.isTrue(waysToCheck.get(i).getWay().get("oneway"))
-					&& links.get(i).direction.equals(WayConnectionType.Direction.BACKWARD))
-					|| (OsmUtils.isReversed(waysToCheck.get(i).getWay().get("oneway"))
-							&& links.get(i).direction.equals(WayConnectionType.Direction.FORWARD))) {
-
-				// At this point, the PTWay is going against the oneway
-				// direction. Check if this road allows buses to disregard
-				// the oneway restriction:
-
-				if (!waysToCheck.get(i).getWay().hasTag("busway", "lane")
-						&& !waysToCheck.get(i).getWay().hasTag("busway:left", "lane")
-						&& !waysToCheck.get(i).getWay().hasTag("busway:right", "lane")
-						&& !waysToCheck.get(i).getWay().hasTag("oneway:bus", "no")
-						&& !waysToCheck.get(i).getWay().hasTag("busway", "opposite_lane")
-						&& !waysToCheck.get(i).getWay().hasTag("oneway:psv", "no")
-						&& !waysToCheck.get(i).getWay().hasTag("trolley_wire", "backward")) {
-					List<Relation> primitives = new ArrayList<>(1);
-					primitives.add(r);
-					List<Way> highlighted = new ArrayList<>(1);
-					highlighted.add(waysToCheck.get(i).getWay());
-					errors.add(new TestError(this, Severity.WARNING,
-							tr("PT: Route passes a oneway road in the wrong direction"), ERROR_CODE_DIRECTION, primitives,
-							highlighted));
-					return;
-				}
-
-			}
-
-//			if (links.get(i).direction.equals(WayConnectionType.Direction.ROUNDABOUT_LEFT)
-//					|| links.get(i).direction.equals(WayConnectionType.Direction.ROUNDABOUT_RIGHT)) {
-//				errors.add(new TestError(this, Severity.WARNING, tr("PT: Route passes on an unsplit roundabout"),
-//						ERROR_CODE_UNSPLIT_ROUNDABOUT, waysToCheck.get(i).getWay()));
-//				return;
-//			}
-			
-//			if (waysToCheck.get(i).getWay().hasTag("junction", "roundabout")) {
-//				JOptionPane.showMessageDialog(null, waysToCheck.get(i).getWay().getId() + " linkPrev: " + links.get(i).linkPrev + ", linkNext: " + links.get(i).linkNext);
-////				Node firstNode = waysToCheck.get(i).getWay().firstNode();
-////				Node lastNode = waysToCheck.get(index)
-////				if (i == 0 && waysToCheck.size() > 1) {
-////					// if this is the very first way:
-////					
-////				}
-//			}
-			
-
-		}
-
-	}
-
-	@Override
-	public Command fixError(TestError testError) {
-
-		List<Command> commands = new ArrayList<>(50);
-
-		if (testError.getTester().getClass().equals(DirectionTest.class) && testError.isFixable()) {
-		    Collection<? extends OsmPrimitive> primitives = testError.getPrimitives();
-			Relation originalRelation = (Relation) primitives.iterator().next();
-			Collection<?> highlightedList = testError.getHighlighted();
-			Way wayToRemove = (Way) highlightedList.iterator().next();
-
-			Relation modifiedRelation = new Relation(originalRelation);
-			List<RelationMember> modifiedRelationMembers = new ArrayList<>(originalRelation.getMembersCount() - 1);
-
-			// copy PT stops first, PT ways last:
-			for (RelationMember rm : originalRelation.getMembers()) {
-				if (RouteUtils.isPTStop(rm)) {
-
-					if (rm.getRole().equals("stop_position")) {
-						if (rm.getType().equals(OsmPrimitiveType.NODE)) {
-							RelationMember newMember = new RelationMember("stop", rm.getNode());
-							modifiedRelationMembers.add(newMember);
-						} else { // if it is a way:
-							RelationMember newMember = new RelationMember("stop", rm.getWay());
-							modifiedRelationMembers.add(newMember);
-						}
-					} else {
-						// if the relation member does not have the role
-						// "stop_position":
-						modifiedRelationMembers.add(rm);
-					}
-
-				}
-			}
-
-			// now copy PT ways:
-			for (RelationMember rm : originalRelation.getMembers()) {
-				if (RouteUtils.isPTWay(rm)) {
-					Way wayToCheck = rm.getWay();
-					if (wayToCheck != wayToRemove) {
-						if (rm.getRole().equals("forward") || rm.getRole().equals("backward")) {
-							RelationMember modifiedMember = new RelationMember("", wayToCheck);
-							modifiedRelationMembers.add(modifiedMember);
-						} else {
-							modifiedRelationMembers.add(rm);
-						}
-					}
-				}
-			}
-
-			modifiedRelation.setMembers(modifiedRelationMembers);
-
-			ChangeCommand changeCommand = new ChangeCommand(originalRelation, modifiedRelation);
-			commands.add(changeCommand);
-
-		}
-
-		if (commands.isEmpty()) {
-			return null;
-		}
-
-		if (commands.size() == 1) {
-			return commands.get(0);
-		}
-
-		return new SequenceCommand(tr("Remove way from route if it does not match the route type"), commands);
-
-	}
-
-	/**
-	 * Checks if the test error is fixable
-	 */
-	@Override
-	public boolean isFixable(TestError testError) {
-		if (testError.getCode() == ERROR_CODE_DIRECTION) {
-			return true;
-		}
-		return false;
-	}
-
-}
Index: plications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/GapTest.java
===================================================================
--- /applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/GapTest.java	(revision 32567)
+++ 	(revision )
@@ -1,315 +1,0 @@
-package org.openstreetmap.josm.plugins.pt_assistant.validation;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.openstreetmap.josm.command.ChangeCommand;
-import org.openstreetmap.josm.command.Command;
-import org.openstreetmap.josm.command.SequenceCommand;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.osm.RelationMember;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.data.validation.Severity;
-import org.openstreetmap.josm.data.validation.Test;
-import org.openstreetmap.josm.data.validation.TestError;
-import org.openstreetmap.josm.gui.dialogs.relation.sort.RelationSorter;
-import org.openstreetmap.josm.gui.dialogs.relation.sort.WayConnectionType;
-import org.openstreetmap.josm.gui.dialogs.relation.sort.WayConnectionTypeCalculator;
-import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils;
-
-public class GapTest extends Test {
-
-	public static final int ERROR_CODE_SORTING = 3711;
-	public static final int ERROR_CODE_OVERSHOOT = 3712;
-	public static final int ERROR_CODE_SPLITTING = 3713;
-	public static final int ERROR_CODE_OTHER_GAP = 3719;
-
-	public GapTest() {
-		super(tr("Gaps"), tr("Checks if there are gaps in the route relation."));
-	}
-
-	@Override
-	public void visit(Relation r) {
-		
-		if (!RouteUtils.isTwoDirectionRoute(r)) {
-			return;
-		}
-
-		if (RouteUtils.hasIncompleteMembers(r)) {
-			return;
-		}
-		
-		List<RelationMember> members = r.getMembers();
-		final List<RelationMember> waysToCheck = new ArrayList<>();
-		for (RelationMember member : members) {
-
-			if (RouteUtils.isPTWay(member)) {
-				waysToCheck.add(member);
-			}
-		}
-
-		if (waysToCheck.isEmpty()) {
-			return;
-		}
-
-		if (hasGap(waysToCheck)) {
-			RelationSorter sorter = new RelationSorter();
-			List<RelationMember> correctedList = sorter.sortMembers(waysToCheck);
-
-			if (!hasGap(correctedList)) {
-				errors.add(new TestError(this, Severity.WARNING,
-						tr("PT: Route contains a gap that can be fixed by sorting"), ERROR_CODE_SORTING, r));
-			} else {
-				// List<RelationMember> overshoots =
-				// this.getOvershoots(correctedList);
-				// if (!overshoots.isEmpty()) {
-				// // TODO: make sure that duplicates are removed first
-				// for (RelationMember overshoot : overshoots) {
-				// List<Relation> primitives = new ArrayList<>(1);
-				// primitives.add(r);
-				// List<Way> highlighted = new ArrayList<>(1);
-				// highlighted.add(overshoot.getWay());
-				// errors.add(new TestError(this, Severity.WARNING, tr("PT:
-				// Route contains an overshoot"),
-				// ERROR_CODE_OVERSHOOT, primitives, highlighted));
-				// }
-				//
-				// } else {
-					errors.add(new TestError(this, Severity.WARNING,
-							tr("PT: Route contains a gap that cannot be fixed by sorting the ways"),
-							ERROR_CODE_OTHER_GAP, r));
-//				}
-			}
-
-		}
-
-	}
-
-	/**
-	 * Checks if there is a gap for a given list of ways. It does not check if
-	 * the way actually stands for a public transport platform - that should be
-	 * checked beforehand.
-	 * 
-	 * @param waysToCheck
-	 * @return
-	 */
-	private boolean hasGap(List<RelationMember> waysToCheck) {
-		WayConnectionTypeCalculator connectionTypeCalculator = new WayConnectionTypeCalculator();
-		final List<WayConnectionType> links = connectionTypeCalculator.updateLinks(waysToCheck);
-		for (int i = 0; i < links.size(); i++) {
-			final WayConnectionType link = links.get(i);
-			final boolean hasError = !(i == 0 || link.linkPrev) || !(i == links.size() - 1 || link.linkNext)
-					|| link.direction == null || WayConnectionType.Direction.NONE.equals(link.direction);
-			if (hasError) {
-				return true;
-
-			}
-		}
-
-		return false;
-	}
-
-	/**
-	 * Checks if there is a single "hanging" way (perhaps left after a way
-	 * split) that can be easily removed.
-	 * 
-	 * @param sortedWays
-	 *            is a list of ways only that should be sorted with the
-	 *            RelationSorter before this method is called. No error occurs
-	 *            if they are unsorted, but the method call is pointless if they
-	 *            are in a wrong order.
-	 * @return true is there is such a way, false otherwise
-	 */
-	@SuppressWarnings("unused")
-	private List<RelationMember> getOvershoots(List<RelationMember> sortedWays) {
-
-		List<RelationMember> overshoots = new ArrayList<>();
-
-		if (sortedWays.size() < 5) {
-			// the route has to have at least five ways to be able to have an
-			// overshoot. I assume that the overshoot cannot touch the very
-			// first or the very last way in a route because then it would not
-			// be clear which of the ways would be an overshoot.
-			/*-
-			 *  x              x             x
-			 *   \ A           |D           / G
-			 *    \            |           /
-			 *     x-----------x----------x
-			 *    /      C     |    F      \
-			 *   / B           |E           \ H
-			 *  x			   x             x
-			 *  
-			 *  Example: ways D and E can be overshoots (from the point of 
-			 *  view of this method), but ways A, B, G and H cannot. 
-			 *  Therefore, a relation must have at least 4 "good" ways 
-			 *  in order to be able to have an overshoot.
-			 */
-
-			return overshoots;
-		}
-
-		for (int i = 2; i < sortedWays.size() - 3; i++) {
-			Way prev = sortedWays.get(i - 1).getWay();
-			Way curr = sortedWays.get(i).getWay();
-			Way next = sortedWays.get(i + 1).getWay();
-			boolean firstNodeConnectedToPrev = (curr.firstNode() == prev.firstNode()
-					|| curr.firstNode() == prev.lastNode());
-			boolean lastNodeConnectedToPrev = (curr.lastNode() == prev.firstNode()
-					|| curr.lastNode() == prev.lastNode());
-			boolean firstNodeConnectedToNext = (curr.firstNode() == next.firstNode()
-					|| curr.firstNode() == next.lastNode());
-			boolean lastNodeConnectedToNext = (curr.lastNode() == next.firstNode()
-					|| curr.lastNode() == next.lastNode());
-			if ((firstNodeConnectedToPrev && firstNodeConnectedToNext)
-					|| (lastNodeConnectedToPrev && lastNodeConnectedToNext)) {
-				overshoots.add(sortedWays.get(i));
-			}
-
-		}
-
-		return overshoots;
-	}
-
-	@Override
-	public Command fixError(TestError testError) {
-
-		List<Command> commands = new ArrayList<>(50);
-
-		if (testError.getTester().getClass().equals(GapTest.class) && testError.isFixable()) {
-
-			// If this is an error that can be fixed simply by sorting the ways:
-			if (testError.getCode() == ERROR_CODE_SORTING) {
-				for (OsmPrimitive primitive : testError.getPrimitives()) {
-					Relation relation = (Relation) primitive;
-					// separate ways from stops (because otherwise the order of
-					// stops/platforms can be messed up by the sorter:
-					List<RelationMember> members = relation.getMembers();
-					final List<RelationMember> stops = new ArrayList<>();
-					final List<RelationMember> ways = new ArrayList<>();
-					for (RelationMember member : members) {
-						if (RouteUtils.isPTWay(member)) {
-							if (member.getRole().equals("")) {
-								ways.add(member);
-							} else {
-								RelationMember modifiedMember = new RelationMember("", member.getWay());
-								ways.add(modifiedMember);
-							}
-
-						} else { // stops:
-							if (member.getRole().equals("stop_positon")) {
-								// it is not expected that stop_positions could
-								// be relations
-								if (member.getType().equals(OsmPrimitiveType.NODE)) {
-									RelationMember modifiedMember = new RelationMember("stop", member.getNode());
-									stops.add(modifiedMember);
-								} else { // if it is a primitive of type way:
-									RelationMember modifiedMember = new RelationMember("stop", member.getWay());
-									stops.add(modifiedMember);
-								}
-							} else { // if it is not a stop_position:
-								stops.add(member);
-							}
-
-						}
-					}
-
-					// sort the ways:
-					RelationSorter sorter = new RelationSorter();
-					List<RelationMember> sortedWays = sorter.sortMembers(ways);
-
-					// create a new relation to pass to the command:
-					Relation sortedRelation = new Relation(relation);
-					List<RelationMember> sortedRelationMembers = new ArrayList<>(members.size());
-					for (RelationMember rm : stops) {
-						sortedRelationMembers.add(rm);
-					}
-					for (RelationMember rm : sortedWays) {
-						sortedRelationMembers.add(rm);
-					}
-					sortedRelation.setMembers(sortedRelationMembers);
-
-					ChangeCommand changeCommand = new ChangeCommand(relation, sortedRelation);
-
-					commands.add(changeCommand);
-
-				}
-
-			}
-
-			// if the error is a single overshoot:
-//			if (testError.getCode() == ERROR_CODE_OVERSHOOT) {
-//
-//				for (OsmPrimitive primitive : testError.getPrimitives()) {
-//					Relation originalRelation = (Relation) primitive;
-//					Relation modifiedRelation = new Relation(originalRelation);
-//					List<RelationMember> modifiedMembers = new ArrayList<>();
-//					// add stops of a public transport route first:
-//					for (RelationMember rm : originalRelation.getMembers()) {
-//						if (RouteUtils.isPTStop(rm)) {
-//							if (rm.hasRole("stop_position")) {
-//								// it is not expected that stop_positions could
-//								// be relations
-//								if (rm.getType().equals(OsmPrimitiveType.NODE)) {
-//									RelationMember modifiedMember = new RelationMember("stop", rm.getNode());
-//									modifiedMembers.add(modifiedMember);
-//								} else { // if it is a primitive of type "way":
-//									RelationMember modifiedMember = new RelationMember("stop", rm.getWay());
-//									modifiedMembers.add(modifiedMember);
-//								}
-//							} else {
-//								modifiedMembers.add(rm);
-//							}
-//
-//						}
-//
-//					}
-//					// add ways of a public transport route (if they are not
-//					// overshoots):
-//					for (RelationMember rm : originalRelation.getMembers()) {
-//						if (RouteUtils.isPTWay(rm) && !overshootList.contains(rm)) {
-//
-//							if (rm.getRole().equals("")) {
-//								modifiedMembers.add(rm);
-//							} else {
-//								RelationMember modifiedMember = new RelationMember("", rm.getWay());
-//								modifiedMembers.add(modifiedMember);
-//							}
-//						}
-//					}
-//					modifiedRelation.setMembers(modifiedMembers);
-//
-//					ChangeCommand changeCommand = new ChangeCommand(originalRelation, modifiedRelation);
-//					commands.add(changeCommand);
-//				}
-//
-//			}
-		}
-
-		if (commands.isEmpty()) {
-			return null;
-		}
-
-		if (commands.size() == 1) {
-			return commands.get(0);
-		}
-
-		return new SequenceCommand(tr("Fix gaps in public transport route"), commands);
-
-	}
-
-	/**
-	 * Checks if the test error is fixable
-	 */
-	@Override
-	public boolean isFixable(TestError testError) {
-		if (testError.getCode() == ERROR_CODE_SORTING ) {
-			return true;
-		}
-		return false;
-	}
-
-}
Index: plications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PTAssitantValidatorTest.java
===================================================================
--- /applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PTAssitantValidatorTest.java	(revision 32567)
+++ 	(revision )
@@ -1,360 +1,0 @@
-package org.openstreetmap.josm.plugins.pt_assistant.validation;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
-
-import org.openstreetmap.josm.command.Command;
-import org.openstreetmap.josm.command.SequenceCommand;
-import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.validation.Severity;
-import org.openstreetmap.josm.data.validation.Test;
-import org.openstreetmap.josm.data.validation.TestError;
-import org.openstreetmap.josm.plugins.pt_assistant.actions.FixTask;
-import org.openstreetmap.josm.plugins.pt_assistant.actions.IncompleteMembersDownloadThread;
-import org.openstreetmap.josm.plugins.pt_assistant.gui.IncompleteMembersDownloadDialog;
-import org.openstreetmap.josm.plugins.pt_assistant.gui.PTAssistantLayer;
-import org.openstreetmap.josm.plugins.pt_assistant.gui.ProceedDialog;
-import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils;
-
-public class PTAssitantValidatorTest extends Test {
-
-	public static final int ERROR_CODE_SORTING = 3711;
-	public static final int ERROR_CODE_ROAD_TYPE = 3721;
-	public static final int ERROR_CODE_CONSTRUCTION = 3722;
-	public static final int ERROR_CODE_DIRECTION = 3731;
-	public static final int ERROR_CODE_END_STOP = 3141;
-	public static final int ERROR_CODE_SPLIT_WAY = 3142;
-	public static final int ERROR_CODE_RELAITON_MEMBER_ROLES = 3143;
-
-	private PTAssistantLayer layer;
-
-	public PTAssitantValidatorTest() {
-		super(tr("Public Transport Assistant tests"),
-				tr("Check if route relations are compatible with public transport version 2"));
-
-		layer = new PTAssistantLayer();
-		DataSet.addSelectionListener(layer);
-
-	}
-
-	@Override
-	public void visit(Relation r) {
-
-		if (!RouteUtils.isTwoDirectionRoute(r)) {
-			return;
-		}
-
-		// Download incomplete members. If the download does not work, return
-		// and do not do any testing.
-		if (r.hasIncompleteMembers()) {
-
-			boolean downloadSuccessful = this.downloadIncompleteMembers();
-			if (!downloadSuccessful) {
-				return;
-			}
-
-		}
-
-		if (r.hasIncompleteMembers()) {
-			return;
-		}
-
-		// Check individual ways using the oneway direction test and the road
-		// type test:
-		WayChecker wayChecker = new WayChecker(r, this);
-		if (!r.hasIncompleteMembers()) {
-			wayChecker.performDirectionTest();
-			wayChecker.performRoadTypeTest();
-		}
-		this.errors.addAll(wayChecker.getErrors());
-
-		if (this.errors.isEmpty()) {
-			proceedWithSorting(r);
-		} else {
-			this.proceedAfterWayCheckerErrors(r);
-		}
-
-	}
-
-	/**
-	 * Downloads incomplete relation members in an extra thread (user input
-	 * required)
-	 * 
-	 * @return true if successful, false if not successful
-	 */
-	private boolean downloadIncompleteMembers() {
-
-		final int[] userSelection = { 0 };
-
-		try {
-
-			if (SwingUtilities.isEventDispatchThread()) {
-
-				userSelection[0] = showIncompleteMembersDownloadDialog();
-
-			} else {
-
-				SwingUtilities.invokeAndWait(new Runnable() {
-					@Override
-					public void run() {
-						try {
-							userSelection[0] = showIncompleteMembersDownloadDialog();
-						} catch (InterruptedException e) {
-							e.printStackTrace();
-						}
-
-					}
-				});
-
-			}
-
-		} catch (InterruptedException | InvocationTargetException e) {
-			return false;
-		}
-
-		if (userSelection[0] == JOptionPane.YES_OPTION) {
-
-			Thread t = new IncompleteMembersDownloadThread();
-			t.start();
-			synchronized (t) {
-				try {
-					t.wait();
-				} catch (InterruptedException e) {
-					return false;
-				}
-			}
-
-		}
-
-		return true;
-
-	}
-
-	/**
-	 * Shows the dialog asking the user about an incomplete member download
-	 * 
-	 * @return user's selection
-	 * @throws InterruptedException
-	 */
-	private int showIncompleteMembersDownloadDialog() throws InterruptedException {
-
-		IncompleteMembersDownloadDialog incompleteMembersDownloadDialog = new IncompleteMembersDownloadDialog();
-		return incompleteMembersDownloadDialog.getUserSelection();
-
-	}
-
-	/**
-	 * Gets user input after errors were detected by WayChecker (direction
-	 * errors and road type errors)
-	 */
-	private void proceedAfterWayCheckerErrors(Relation r) {
-
-		// count errors of each type:
-		int numberOfDirectionErrors = 0;
-		int numberOfRoadTypeErrors = 0;
-		for (TestError e : this.errors) {
-			if (e.getCode() == ERROR_CODE_DIRECTION) {
-				numberOfDirectionErrors++;
-			}
-			if (e.getCode() == ERROR_CODE_ROAD_TYPE) {
-				numberOfRoadTypeErrors++;
-			}
-		}
-
-		final int[] userInput = { 0 };
-		final long idParameter = r.getId();
-		final int directionErrorParameter = numberOfDirectionErrors;
-		final int roadTypeErrorParameter = numberOfRoadTypeErrors;
-
-		if (SwingUtilities.isEventDispatchThread()) {
-
-			userInput[0] = showProceedDialog(idParameter, directionErrorParameter, roadTypeErrorParameter);
-
-		} else {
-
-			try {
-				SwingUtilities.invokeAndWait(new Runnable() {
-					@Override
-					public void run() {
-						userInput[0] = showProceedDialog(idParameter, roadTypeErrorParameter, roadTypeErrorParameter);
-
-					}
-				});
-			} catch (InvocationTargetException | InterruptedException e1) {
-				// TODO Auto-generated catch block
-				e1.printStackTrace();
-			}
-
-		}
-
-		if (userInput[0] == 0) {
-			this.fixErrorFromPlugin(this.errors);
-			proceedWithSorting(r);
-			return;
-		}
-
-		if (userInput[0] == 1) {
-			// TODO
-			JOptionPane.showMessageDialog(null, "This is not implemented yet!");
-			return;
-		}
-
-		if (userInput[0] == 2) {
-			// TODO: should the errors be removed from the error list?
-			proceedWithSorting(r);
-		}
-
-		// if userInput==-1 (i.e. no input), do nothing and stop testing of the
-		// route.
-
-	}
-
-	private int showProceedDialog(long id, int numberOfDirectionErrors, int numberOfRoadTypeErrors) {
-
-		ProceedDialog proceedDialog = new ProceedDialog(id, numberOfDirectionErrors, numberOfRoadTypeErrors);
-		return proceedDialog.getUserSelection();
-
-	}
-
-	/**
-	 * Carries out the second stage of the testing: sorting
-	 * 
-	 * @param r
-	 */
-	private void proceedWithSorting(Relation r) {
-
-		// Check if the relation is correct, or only has a wrong sorting order:
-		RouteChecker routeChecker = new RouteChecker(r, this);
-		routeChecker.performSortingTest();
-		List<TestError> routeCheckerErrors = routeChecker.getErrors();
-
-		/*- At this point, there are 3 variants: 
-		 * 
-		 * 1) There are no errors => route is correct
-		 * 2) There is only a sorting error (can only be 1), but otherwise
-		 * correct.
-		 * 3) There are some other errors/gaps that cannot be fixed by
-		 * sorting => start further test (stop-by-stop) 
-		 * 
-		 * */
-
-		if (!routeCheckerErrors.isEmpty()) {
-			// Variant 2
-			// If there is only the sorting error, add it and stop testing.
-			this.errors.addAll(routeChecker.getErrors());
-			return;
-		}
-
-		if (!routeChecker.getHasGap()) {
-			// Variant 1
-			// TODO: add the segments of this route to the list correct route
-			// segments
-		}
-
-		// Variant 3:
-		proceedAfterSorting(r);
-
-	}
-
-	private void proceedAfterSorting(Relation r) {
-
-		SegmentChecker segmentChecker = new SegmentChecker(r, this);
-
-		// Check if the creation of the route data model in the segment checker
-		// worked. If it did not, it means the roles in the route relation do
-		// not match the tags of the route members.
-		if (!segmentChecker.getErrors().isEmpty()) {
-			this.errors.addAll(segmentChecker.getErrors());
-		}
-
-		segmentChecker.performFirstStopTest();
-		segmentChecker.performLastStopTest();
-
-		// TODO: perform segment test
-		this.errors.addAll(segmentChecker.getErrors());
-		// performDummyTest(r);
-	}
-
-	/**
-	 * Checks if the test error is fixable
-	 */
-	@Override
-	public boolean isFixable(TestError testError) {
-		if (testError.getCode() == ERROR_CODE_DIRECTION || testError.getCode() == ERROR_CODE_ROAD_TYPE
-				|| testError.getCode() == ERROR_CODE_CONSTRUCTION || testError.getCode() == ERROR_CODE_SORTING) {
-			return true;
-		}
-		return false;
-	}
-
-	@Override
-	public Command fixError(TestError testError) {
-
-		List<Command> commands = new ArrayList<>();
-
-		if (testError.getCode() == ERROR_CODE_ROAD_TYPE || testError.getCode() == ERROR_CODE_CONSTRUCTION) {
-			commands.add(WayChecker.fixErrorByRemovingWay(testError));
-		}
-
-		if (testError.getCode() == ERROR_CODE_DIRECTION) {
-			commands.add(WayChecker.fixErrorByZooming(testError));
-
-		}
-
-		if (testError.getCode() == ERROR_CODE_SORTING) {
-			commands.add(RouteChecker.fixSortingError(testError));
-		}
-
-		if (commands.isEmpty()) {
-			return null;
-		}
-
-		if (commands.size() == 1) {
-			return commands.get(0);
-		}
-
-		return new SequenceCommand(tr("Fix error"), commands);
-	}
-
-	/**
-	 * This method is the counterpart of the fixError(TestError testError)
-	 * method. The fixError method is invoked from the core validator (e.g. when
-	 * user presses the "Fix" button in the validator). This method is invoken
-	 * when the fix is initiated from within the plugin (e.g. automated fixes).
-	 * 
-	 * @return
-	 */
-	private void fixErrorFromPlugin(List<TestError> testErrors) {
-
-		// run fix task asynchronously
-		FixTask fixTask = new FixTask(testErrors);
-		// Main.worker.submit(fixTask);
-
-		Thread t = new Thread(fixTask);
-		t.start();
-		try {
-			t.join();
-			errors.removeAll(testErrors);
-
-		} catch (InterruptedException e) {
-			JOptionPane.showMessageDialog(null, "Error occurred during fixing");
-		}
-
-	}
-
-	@SuppressWarnings("unused")
-	private void performDummyTest(Relation r) {
-		List<Relation> primitives = new ArrayList<>(1);
-		primitives.add(r);
-		errors.add(
-				new TestError(this, Severity.WARNING, tr("PT: dummy test warning"), ERROR_CODE_DIRECTION, primitives));
-	}
-
-}
Index: plications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PlatformsFirstTest.java
===================================================================
--- /applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PlatformsFirstTest.java	(revision 32567)
+++ 	(revision )
@@ -1,49 +1,0 @@
-package org.openstreetmap.josm.plugins.pt_assistant.validation;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.List;
-
-import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.osm.RelationMember;
-import org.openstreetmap.josm.data.validation.Severity;
-import org.openstreetmap.josm.data.validation.Test;
-import org.openstreetmap.josm.data.validation.TestError;
-import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils;
-
-public class PlatformsFirstTest extends Test {
-
-	public static final int ERROR_CODE = 3701;
-
-	/**
-	 * Constructs a new {@code InternetTags} test.
-	 */
-	public PlatformsFirstTest() {
-		super(tr("Platforms first"), tr("Checks if platforms are listed before ways in the route relation."));
-	}
-
-	@Override
-	public void visit(Relation r) {
-
-		if (RouteUtils.isTwoDirectionRoute(r)) {
-
-			List<RelationMember> members = r.getMembers();
-			RelationMember prevMember = null;
-			for (RelationMember currMember : members) {
-				if (prevMember != null) {
-					// check if the current member is a platform, while the
-					// previous member is a way:
-					if (currMember.hasRole("platform") && prevMember.getType().equals(OsmPrimitiveType.WAY)
-							&& prevMember.hasRole("")) {
-						this.errors.add(new TestError(this, Severity.WARNING,
-								tr("PT: route relation(s) contain(s) way(s) before platform(s) in the members list"),
-								ERROR_CODE, r));
-						return;
-					}
-				}
-				prevMember = currMember;
-			}
-		}
-	}
-}
Index: plications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/RoadTypeTest.java
===================================================================
--- /applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/RoadTypeTest.java	(revision 32567)
+++ 	(revision )
@@ -1,213 +1,0 @@
-package org.openstreetmap.josm.plugins.pt_assistant.validation;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.openstreetmap.josm.command.ChangeCommand;
-import org.openstreetmap.josm.command.Command;
-import org.openstreetmap.josm.command.SequenceCommand;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.osm.RelationMember;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.data.validation.Severity;
-import org.openstreetmap.josm.data.validation.Test;
-import org.openstreetmap.josm.data.validation.TestError;
-import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils;
-
-public class RoadTypeTest extends Test {
-
-	public static final int ERROR_CODE_ROAD_TYPE = 3721;
-	public static final int ERROR_CODE_CONSTRUCTION = 3722;
-
-	public RoadTypeTest() {
-		super(tr("Road Type Test"),
-				tr("Checks if the course of the route relation is compatible with the type of the road it passes on."));
-	}
-
-	@SuppressWarnings("deprecation")
-	@Override
-	public void visit(Relation r) {
-
-		if (!RouteUtils.isTwoDirectionRoute(r)) {
-			return;
-		}
-		
-		if (RouteUtils.hasIncompleteMembers(r)) {
-			return;
-		}
-		
-		List<RelationMember> members = r.getMembers();
-
-		for (RelationMember rm : members) {
-			if (RouteUtils.isPTWay(rm) && rm.getType().equals(OsmPrimitiveType.WAY)) {
-
-				Way way = rm.getWay();
-				// at this point, the relation has already been checked to
-				// be a route of public_transport:version 2
-				boolean isCorrectRoadType = true;
-				boolean isUnderConstruction = false;
-
-				if (r.hasTag("route", "bus") || r.hasTag("route", "share_taxi")) {
-					if (!RouteUtils.isWaySuitableForBuses(way)) {
-						isCorrectRoadType = false;
-					}
-					if (way.hasTag("highway", "construction") && way.hasKey("construction")) {
-						isUnderConstruction = true;
-					}
-				} else if (r.hasTag("route", "trolleybus")) {
-					if (!(RouteUtils.isWaySuitableForBuses(way) && way.hasTag("trolley_wire", "yes"))) {
-						isCorrectRoadType = false;
-					}
-					if (way.hasTag("highway", "construction") && way.hasKey("construction")) {
-						isUnderConstruction = true;
-					}
-				} else if (r.hasTag("route", "tram")) {
-					if (!way.hasTag("railway", "tram")) {
-						isCorrectRoadType = false;
-					}
-					if (way.hasTag("railway", "construction") && way.hasKey("construction")) {
-						isUnderConstruction = true;
-					}
-				} else if (r.hasTag("route", "subway")) {
-					if (!r.hasTag("railway", "subway")) {
-						isCorrectRoadType = false;
-					}
-					if (way.hasTag("railway", "construction") && way.hasKey("construction")) {
-						isUnderConstruction = true;
-					}
-				} else if (r.hasTag("route", "light_rail")) {
-					if (!r.hasTag("raiilway", "subway")) {
-						isCorrectRoadType = false;
-					}
-					if (way.hasTag("railway", "construction") && way.hasKey("construction")) {
-						isUnderConstruction = true;
-					}
-				} else if (r.hasTag("route", "light_rail")) {
-					if (!r.hasTag("railway", "light_rail")) {
-						isCorrectRoadType = false;
-					}
-					if (way.hasTag("railway", "construction") && way.hasKey("construction")) {
-						isUnderConstruction = true;
-					}
-				} else if (r.hasTag("route", "train")) {
-					if (!r.hasTag("railway", "train")) {
-						isCorrectRoadType = false;
-					}
-					if (way.hasTag("railway", "construction") && way.hasKey("construction")) {
-						isUnderConstruction = true;
-					}
-				}
-
-				if (!isCorrectRoadType && !isUnderConstruction) {
-
-					List<Relation> primitives = new ArrayList<>(1);
-					primitives.add(r);
-					List<Way> highlighted = new ArrayList<>(1);
-					highlighted.add(way);
-					errors.add(new TestError(this, Severity.WARNING,
-							tr("PT: Route type does not match the type of the road it passes on"), ERROR_CODE_ROAD_TYPE,
-							primitives, highlighted));
-				}
-				
-				if (isUnderConstruction) {
-					List<Relation> primitives = new ArrayList<>(1);
-					primitives.add(r);
-					List<Way> highlighted = new ArrayList<>(1);
-					highlighted.add(way);
-					TestError e = new TestError(this, Severity.WARNING,
-							tr("PT: Road is under construction"),
-							PTAssitantValidatorTest.ERROR_CODE_CONSTRUCTION, primitives, highlighted);
-					errors.add(e);
-				}
-
-			}
-		}
-
-	}
-
-	@Override
-	public Command fixError(TestError testError) {
-
-		List<Command> commands = new ArrayList<>(50);
-
-		if (testError.getTester().getClass().equals(RoadTypeTest.class) && testError.isFixable()) {
-			Collection<? extends OsmPrimitive> primitives = testError.getPrimitives();
-			Relation originalRelation = (Relation) primitives.iterator().next();
-			Collection<?> highlighted = testError.getHighlighted();
-			Way wayToRemove = (Way) highlighted.iterator().next();
-
-			Relation modifiedRelation = new Relation(originalRelation);
-			List<RelationMember> modifiedRelationMembers = new ArrayList<>(originalRelation.getMembersCount() - 1);
-
-			// copy PT stops first, PT ways last:
-			for (RelationMember rm : originalRelation.getMembers()) {
-				if (RouteUtils.isPTStop(rm)) {
-
-					if (rm.getRole().equals("stop_position")) {
-						if (rm.getType().equals(OsmPrimitiveType.NODE)) {
-							RelationMember newMember = new RelationMember("stop", rm.getNode());
-							modifiedRelationMembers.add(newMember);
-						} else { // if it is a way:
-							RelationMember newMember = new RelationMember("stop", rm.getWay());
-							modifiedRelationMembers.add(newMember);
-						}
-					} else {
-						// if the relation member does not have the role
-						// "stop_position":
-						modifiedRelationMembers.add(rm);
-					}
-
-				}
-			}
-
-			// now copy PT ways:
-			for (RelationMember rm : originalRelation.getMembers()) {
-				if (RouteUtils.isPTWay(rm)) {
-					Way wayToCheck = rm.getWay();
-					if (wayToCheck != wayToRemove) {
-						if (rm.getRole().equals("forward") || rm.getRole().equals("backward")) {
-							RelationMember modifiedMember = new RelationMember("", wayToCheck);
-							modifiedRelationMembers.add(modifiedMember);
-						} else {
-							modifiedRelationMembers.add(rm);
-						}
-					}
-				}
-			}
-
-			modifiedRelation.setMembers(modifiedRelationMembers);
-
-			ChangeCommand changeCommand = new ChangeCommand(originalRelation, modifiedRelation);
-			commands.add(changeCommand);
-
-		}
-
-		if (commands.isEmpty()) {
-			return null;
-		}
-
-		if (commands.size() == 1) {
-			return commands.get(0);
-		}
-
-		return new SequenceCommand(tr("Remove way from route if it does not match the route type"), commands);
-
-	}
-
-	/**
-	 * Checks if the test error is fixable
-	 */
-	@Override
-	public boolean isFixable(TestError testError) {
-		if (testError.getCode() == ERROR_CODE_ROAD_TYPE || testError.getCode() == ERROR_CODE_CONSTRUCTION) {
-			return true;
-		}
-		return false;
-	}
-
-}
Index: plications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/GapTestTest.java
===================================================================
--- /applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/GapTestTest.java	(revision 32567)
+++ 	(revision )
@@ -1,83 +1,0 @@
-package org.openstreetmap.josm.plugins.pt_assistant.validation;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.util.List;
-
-import org.junit.Test;
-import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.validation.TestError;
-import org.openstreetmap.josm.plugins.pt_assistant.AbstractTest;
-import org.openstreetmap.josm.plugins.pt_assistant.ImportUtils;
-
-public class GapTestTest extends AbstractTest {
-
-    @Test
-    public void sortingTestBeforeFile() {
-        File file = new File(AbstractTest.PATH_TO_DL131_BEFORE);
-        DataSet ds = ImportUtils.importOsmFile(file, "testLayer");
-
-        GapTest gapTest = new GapTest();
-        for (Relation r : ds.getRelations()) {
-            gapTest.visit(r);
-        }
-
-        List<TestError> errors = gapTest.getErrors();
-
-        assertEquals(errors.size(), 1);
-        assertEquals(errors.iterator().next().getCode(), GapTest.ERROR_CODE_SORTING);
-        assertEquals(errors.iterator().next().getTester().getClass().getName(), GapTest.class.getName());
-    }
-
-    @Test
-    public void sortingTestAfterFile() {
-        File file = new File(AbstractTest.PATH_TO_DL131_AFTER);
-        DataSet ds = ImportUtils.importOsmFile(file, "testLayer");
-
-        GapTest gapTest = new GapTest();
-        for (Relation r : ds.getRelations()) {
-            gapTest.visit(r);
-        }
-
-        List<TestError> errors = gapTest.getErrors();
-
-        assertEquals(errors.size(), 0);
-    }
-
-    // TODO: this test will only pass after the functionality for recognizing
-    // and closing the gap is implemented.
-//    @Test
-//    public void overshootTestBeforeFile() {
-//        File file = new File(AbstractTest.PATH_TO_DL286_BEFORE);
-//        DataSet ds = ImportUtils.importOsmFile(file, "testLayer");
-//
-//        GapTest gapTest = new GapTest();
-//        for (Relation r : ds.getRelations()) {
-//            gapTest.visit(r);
-//        }
-//
-//        List<TestError> errors = gapTest.getErrors();
-//
-//        assertEquals(errors.size(), 1);
-//        assertEquals(errors.get(0).getCode(), GapTest.ERROR_CODE_OVERSHOOT);
-//
-//    }
-
-    @Test
-    public void overshootTestAfterFile() {
-        File file = new File(AbstractTest.PATH_TO_DL286_AFTER);
-        DataSet ds = ImportUtils.importOsmFile(file, "testLayer");
-
-        GapTest gapTest = new GapTest();
-        for (Relation r : ds.getRelations()) {
-            gapTest.visit(r);
-        }
-
-        List<TestError> errors = gapTest.getErrors();
-
-        assertEquals(errors.size(), 0);
-    }
-
-}
Index: plications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/PlatformsFirstTestTest.java
===================================================================
--- /applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/PlatformsFirstTestTest.java	(revision 32567)
+++ 	(revision )
@@ -1,46 +1,0 @@
-package org.openstreetmap.josm.plugins.pt_assistant.validation;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.util.List;
-
-import org.junit.Test;
-import org.openstreetmap.josm.data.osm.DataSet;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.validation.TestError;
-import org.openstreetmap.josm.plugins.pt_assistant.AbstractTest;
-import org.openstreetmap.josm.plugins.pt_assistant.ImportUtils;
-
-public class PlatformsFirstTestTest extends AbstractTest {
-
-    @Test
-    public void testBeforeFile() {
-        DataSet ds = ImportUtils.importOsmFile(new File(AbstractTest.PATH_TO_DL131_BEFORE), "testLayer");
-        
-        PlatformsFirstTest pf = new PlatformsFirstTest();
-        for (Relation r: ds.getRelations()) {
-            pf.visit(r);
-        }
-        List<TestError> errors = pf.getErrors();
-
-        assertEquals(errors.size(), 1);
-        assertEquals(errors.iterator().next().getCode(), PlatformsFirstTest.ERROR_CODE); 
-        assertEquals(errors.iterator().next().getTester().getClass().getName(), PlatformsFirstTest.class.getName());
-    
-    }
-    
-    @Test
-    public void testAfterFile() {
-        DataSet ds = ImportUtils.importOsmFile(new File(AbstractTest.PATH_TO_DL131_AFTER), "testLayer");
-        
-        PlatformsFirstTest pf = new PlatformsFirstTest();
-        for (Relation r: ds.getRelations()) {
-            pf.visit(r);
-        }
-        List<TestError> errors = pf.getErrors();
-        assertEquals(errors.size(), 0);
-        
-        
-    }
-}
