Index: /applications/editors/josm/plugins/public_transport/.checkstyle
===================================================================
--- /applications/editors/josm/plugins/public_transport/.checkstyle	(revision 33053)
+++ /applications/editors/josm/plugins/public_transport/.checkstyle	(revision 33053)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+  <local-check-config name="JOSM" location="/JOSM/tools/checkstyle/josm_checks.xml" type="project" description="">
+    <additional-data name="protect-config-file" value="false"/>
+  </local-check-config>
+  <fileset name="all" enabled="true" check-config-name="JOSM" local="true">
+    <file-match-pattern match-pattern="." include-pattern="true"/>
+  </fileset>
+  <filter name="DerivedFiles" enabled="true"/>
+  <filter name="FilesFromPackage" enabled="true">
+    <filter-data value=".svn"/>
+    <filter-data value="data"/>
+    <filter-data value="images"/>
+    <filter-data value="resources"/>
+    <filter-data value="styles"/>
+    <filter-data value="scripts"/>
+  </filter>
+</fileset-config>
Index: /applications/editors/josm/plugins/public_transport/.project
===================================================================
--- /applications/editors/josm/plugins/public_transport/.project	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/.project	(revision 33053)
@@ -16,8 +16,14 @@
 			</arguments>
 		</buildCommand>
+		<buildCommand>
+			<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
 	</buildSpec>
 	<natures>
 		<nature>org.sonarlint.eclipse.core.sonarlintNature</nature>
 		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
 	</natures>
 </projectDescription>
Index: /applications/editors/josm/plugins/public_transport/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- /applications/editors/josm/plugins/public_transport/.settings/org.eclipse.jdt.ui.prefs	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/.settings/org.eclipse.jdt.ui.prefs	(revision 33053)
@@ -36,5 +36,5 @@
 sp_cleanup.remove_private_constructors=true
 sp_cleanup.remove_redundant_type_arguments=true
-sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces=true
 sp_cleanup.remove_trailing_whitespaces_all=true
 sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/AStarAlgorithm.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/AStarAlgorithm.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/AStarAlgorithm.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -11,10 +12,10 @@
     // AStarAlgorithm.
 
-    public static abstract class Vertex implements Comparable<Vertex> {
+    public abstract static class Vertex implements Comparable<Vertex> {
         @Override
         public abstract int compareTo(Vertex v);
-    };
+    }
 
-    public static abstract class Edge {
+    public abstract static class Edge {
         public abstract Vertex getBegin();
 
@@ -22,5 +23,5 @@
 
         public abstract double getLength();
-    };
+    }
 
     public abstract Vector<Edge> getNeighbors(Vertex vertex);
@@ -103,6 +104,7 @@
 
         Vector<Edge> result = new Vector<>();
-        for (int i = backwards.size() - 1; i >= 0; --i)
+        for (int i = backwards.size() - 1; i >= 0; --i) {
             result.add(backwards.elementAt(i));
+        }
         return result;
     }
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/AbstractGTFSCatchJoinCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/AbstractGTFSCatchJoinCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/AbstractGTFSCatchJoinCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -24,5 +25,5 @@
 
     private String type = null;
-    
+
     private final boolean isCatch;
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/AbstractImporterDialog.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/AbstractImporterDialog.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/AbstractImporterDialog.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -20,6 +21,10 @@
 public abstract class AbstractImporterDialog<T extends JosmAction> {
 
-    private static final String[] stoptypes = new String[] { marktr("bus"), marktr("tram"),
-            marktr("light_rail"), marktr("subway"), marktr("rail") };
+    private static final String[] stoptypes = new String[] {
+            marktr("bus"),
+            marktr("tram"),
+            marktr("light_rail"),
+            marktr("subway"),
+            marktr("rail") };
 
     private final JDialog jDialog;
@@ -45,6 +50,7 @@
         cbStoptype = new JComboBox<>();
         cbStoptype.setEditable(false);
-        for (String type : stoptypes)
+        for (String type : stoptypes) {
             cbStoptype.addItem(new TransText(type));
+        }
         cbStoptype.setActionCommand(actionPrefix + ".settingsStoptype");
         cbStoptype.addActionListener(controller);
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSAddCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSAddCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSAddCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -30,9 +31,11 @@
         Vector<Integer> consideredLines = new Vector<>();
         if (selectedLines.length > 0) {
-            for (int i = 0; i < selectedLines.length; ++i)
+            for (int i = 0; i < selectedLines.length; ++i) {
                 consideredLines.add(selectedLines[i]);
+            }
         } else {
-            for (int i = 0; i < gtfsStopTM.getRowCount(); ++i)
+            for (int i = 0; i < gtfsStopTM.getRowCount(); ++i) {
                 consideredLines.add(Integer.valueOf(i));
+            }
         }
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSCatchCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSCatchCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSCatchCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSDeleteCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSDeleteCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSDeleteCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -30,9 +31,11 @@
         Vector<Integer> consideredLines = new Vector<>();
         if (selectedLines.length > 0) {
-            for (int i = 0; i < selectedLines.length; ++i)
+            for (int i = 0; i < selectedLines.length; ++i) {
                 consideredLines.add(selectedLines[i]);
+            }
         } else {
-            for (int i = 0; i < gtfsStopTM.getRowCount(); ++i)
+            for (int i = 0; i < gtfsStopTM.getRowCount(); ++i) {
                 consideredLines.add(Integer.valueOf(i));
+            }
         }
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSImporterAction.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSImporterAction.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSImporterAction.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -98,6 +99,6 @@
 
             refreshData();
-        }
-/*    else if ("stopImporter.settingsGPSTimeStart".equals(event.getActionCommand()))
+
+/*    } else if ("stopImporter.settingsGPSTimeStart".equals(event.getActionCommand()))
     {
       if ((!inEvent) && (dialog.gpsTimeStartValid()) && (currentTrack != null))
@@ -131,6 +132,6 @@
       Main.main.undoRedo.add(new TrackStoplistDetachCommand(this));
       dialog.getStoplistTable().clearSelection();
-    }*/
-        else if ("gtfsImporter.gtfsStopsAdd".equals(event.getActionCommand()))
+    */
+        } else if ("gtfsImporter.gtfsStopsAdd".equals(event.getActionCommand()))
             Main.main.undoRedo.add(new GTFSAddCommand(this));
         else if ("gtfsImporter.gtfsStopsDelete".equals(event.getActionCommand()))
@@ -155,6 +156,7 @@
                 data.clear();
 
-            while (r.ready())
+            while (r.ready()) {
                 data.add(r.readLine());
+            }
         } catch (FileNotFoundException e) {
             Main.error(e);
@@ -254,9 +256,11 @@
         Vector<Integer> consideredLines = new Vector<>();
         if (selectedLines.length > 0) {
-            for (int i = 0; i < selectedLines.length; ++i)
+            for (int i = 0; i < selectedLines.length; ++i) {
                 consideredLines.add(selectedLines[i]);
+            }
         } else {
-            for (int i = 0; i < table.getRowCount(); ++i)
+            for (int i = 0; i < table.getRowCount(); ++i) {
                 consideredLines.add(Integer.valueOf(i));
+            }
         }
         return consideredLines;
@@ -278,5 +282,5 @@
 
     /**
-     * shows the nodes that correspond to the marked lines in the table. 
+     * shows the nodes that correspond to the marked lines in the table.
      * If no lines are marked in the table, show all nodes from the vector
      */
@@ -296,9 +300,9 @@
 
     /**
-     * marks the nodes that correspond to the marked lines in the table. 
+     * marks the nodes that correspond to the marked lines in the table.
      * If no lines are marked in the table, mark all nodes from the vector
      */
     public static void markNodesFromTable(JTable table, Vector<Node> nodes) {
-        OsmPrimitive[] osmp = { null };
+        OsmPrimitive[] osmp = {null};
         DataSet ds = Main.getLayerManager().getEditDataSet();
         ds.setSelected(osmp);
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSImporterDialog.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSImporterDialog.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSImporterDialog.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSJoinCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSJoinCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSJoinCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSStopTableModel.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSStopTableModel.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/GTFSStopTableModel.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -19,7 +20,7 @@
     private GTFSImporterAction controller = null;
 
-    public Vector<Node> nodes = new Vector<Node>();
-
-    public Vector<LatLon> coors = new Vector<LatLon>();
+    public Vector<Node> nodes = new Vector<>();
+
+    public Vector<LatLon> coors = new Vector<>();
 
     private int idCol = -1;
@@ -99,7 +100,8 @@
     }
 
-    /*
-     * tokenizes a line as follows: any comma outside a pair of double quotation marks is taken as field separator. In particular, neither \" nor \,
-     * have a special meaning. Returns the position of the next field separator, if any. Otherwise it returns -1. s - the string to tokenize. startPos
+    /**
+     * tokenizes a line as follows: any comma outside a pair of double quotation marks is taken as field separator.
+     * In particular, neither \" nor \, have a special meaning. Returns the position of the next field separator, if any.
+     * Otherwise it returns -1. s - the string to tokenize. startPos
      * - the position of the last field separator plus 1 or the value 0.
      */
@@ -130,5 +132,5 @@
 
     public void insertRow(int insPos, String s, Vector<Node> existingStops) {
-        String[] buf = { "", "", tr("pending") };
+        String[] buf = {"", "", tr("pending")};
         int pos = tokenize(s, 0);
         int oldPos = 0;
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/ItineraryTableModel.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/ItineraryTableModel.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/ItineraryTableModel.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -48,5 +49,5 @@
 
     public void insertRow(int insPos, Way way, String role) {
-        String[] buf = { "", "" };
+        String[] buf = {"", ""};
         String curName = way.get("name");
         if (way.isIncomplete())
@@ -99,5 +100,5 @@
                 --i;
             } else if ((i > 0) && gapRequired && (ways.elementAt(i - 1) != null)) {
-                String[] buf = { "", "" };
+                String[] buf = {"", ""};
                 buf[0] = tr("[gap]");
                 insertRow(i, buf);
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/PublicTransportAStar.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/PublicTransportAStar.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/PublicTransportAStar.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -32,5 +33,5 @@
             return node.equals(((NodeVertex) o).node);
         }
-        
+
         @Override
         public int hashCode() {
@@ -68,7 +69,7 @@
 
             double totalDistance = 0;
-            for (int i = min; i < max; ++i)
-                totalDistance += way.getNode(i).getCoor()
-                        .greatCircleDistance(way.getNode(i + 1).getCoor());
+            for (int i = min; i < max; ++i) {
+                totalDistance += way.getNode(i).getCoor().greatCircleDistance(way.getNode(i + 1).getCoor());
+            }
             return totalDistance;
         }
@@ -140,3 +141,3 @@
                 .greatCircleDistance(nodeVertex.node.getCoor());
     }
-};
+}
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/PublicTransportPlugin.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/PublicTransportPlugin.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/PublicTransportPlugin.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/RoutePatternAction.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/RoutePatternAction.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/RoutePatternAction.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -60,5 +61,5 @@
         RoutePatternAction root = null;
 
-        public RoutesLSL(RoutePatternAction rpa) {
+        RoutesLSL(RoutePatternAction rpa) {
             root = rpa;
         }
@@ -70,75 +71,4 @@
     }
 
-    private static class RouteReference implements Comparable<RouteReference> {
-        Relation route;
-
-        public RouteReference(Relation route) {
-            this.route = route;
-        }
-
-        @Override
-        public int compareTo(RouteReference rr) {
-            if (route.get("route") != null) {
-                if (rr.route.get("route") == null)
-                    return -1;
-                int result = route.get("route").compareTo(rr.route.get("route"));
-                if (result != 0)
-                    return result;
-            } else if (rr.route.get("route") != null)
-                return 1;
-            if (route.get("ref") != null) {
-                if (rr.route.get("ref") == null)
-                    return -1;
-                int result = route.get("ref").compareTo(rr.route.get("ref"));
-                if (result != 0)
-                    return result;
-            } else if (rr.route.get("ref") != null)
-                return 1;
-            if (route.get("to") != null) {
-                if (rr.route.get("to") == null)
-                    return -1;
-                int result = route.get("to").compareTo(rr.route.get("to"));
-                if (result != 0)
-                    return result;
-            } else if (rr.route.get("to") != null)
-                return 1;
-            if (route.get("direction") != null) {
-                if (rr.route.get("direction") == null)
-                    return -1;
-                int result = route.get("direction").compareTo(rr.route.get("direction"));
-                if (result != 0)
-                    return result;
-            } else if (rr.route.get("direction") != null)
-                return 1;
-            if (route.getId() < rr.route.getId())
-                return -1;
-            else if (route.getId() > rr.route.getId())
-                return 1;
-            return 0;
-        }
-
-        @Override
-        public String toString() {
-            String buf = route.get("route");
-            if ((route.get("ref") != null) && (route.get("ref") != "")) {
-                buf += " " + route.get("ref");
-            }
-            if ((route.get("loc_ref") != null) && (route.get("loc_ref") != "")) {
-                buf += " [" + route.get("loc_ref") + "]";
-            }
-
-            if ((route.get("to") != null) && (route.get("to") != "")) {
-                buf += ": " + route.get("to");
-            } else if ((route.get("direction") != null) && (route.get("direction") != "")) {
-                buf += " " + route.get("ref") + ": " + route.get("direction");
-            } else {
-                buf += " " + route.get("ref");
-            }
-            buf += tr(" [ID] {0}", Long.toString(route.getId()));
-
-            return buf;
-        }
-    }
-
     private static class TagTableModel extends DefaultTableModel implements TableModelListener {
         Relation relation = null;
@@ -148,5 +78,5 @@
         boolean hasFixedKeys = true;
 
-        public TagTableModel(boolean hasFixedKeys) {
+        TagTableModel(boolean hasFixedKeys) {
             this.hasFixedKeys = hasFixedKeys;
         }
@@ -221,5 +151,5 @@
         TreeMap<Integer, TableCellEditor> col2 = null;
 
-        public CustomCellEditorTable() {
+        CustomCellEditorTable() {
             col1 = new TreeMap<>();
             col2 = new TreeMap<>();
@@ -273,5 +203,5 @@
 
         public void insertRow(int insPos, Node node, String role, double distance) {
-            String[] buf = { "", "", "", "" };
+            String[] buf = {"", "", "", ""};
             String curName = node.get("name");
             if (curName != null) {
@@ -320,5 +250,5 @@
         public double distance;
 
-        public SegmentMetric(double fromLat, double fromLon, double toLat, double toLon,
+        SegmentMetric(double fromLat, double fromLon, double toLat, double toLon,
                 double distance) {
             this.distance = distance;
@@ -344,41 +274,4 @@
             d2 = d2 * Math.cos(fromLat * Math.PI / 180.0);
             o2 = o2 * Math.cos(fromLat * Math.PI / 180.0);
-        }
-    }
-
-    private static class StopReference implements Comparable<StopReference> {
-        public int index = 0;
-
-        public double pos = 0;
-
-        public double distance = 0;
-
-        public String name = "";
-
-        public String role = "";
-
-        public Node node;
-
-        public StopReference(int inIndex, double inPos, double inDistance, String inName,
-                String inRole, Node inNode) {
-            index = inIndex;
-            pos = inPos;
-            distance = inDistance;
-            name = inName;
-            role = inRole;
-            node = inNode;
-        }
-
-        @Override
-        public int compareTo(StopReference sr) {
-            if (this.index < sr.index)
-                return -1;
-            if (this.index > sr.index)
-                return 1;
-            if (this.pos < sr.pos)
-                return -1;
-            if (this.pos > sr.pos)
-                return 1;
-            return 0;
         }
     }
@@ -480,5 +373,5 @@
             relsList = new JList<>(relsListModel);
             JScrollPane rpListSP = new JScrollPane(relsList);
-            String[] data = { "1", "2", "3", "4", "5", "6" };
+            String[] data = {"1", "2", "3", "4", "5", "6"};
             relsListModel.copyInto(data);
             relsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@@ -1141,8 +1034,10 @@
 
             currentRoute.setMembers(null);
-            for (int i = itemsToReflect.size() - 1; i >= 0; --i)
+            for (int i = itemsToReflect.size() - 1; i >= 0; --i) {
                 currentRoute.addMember(itemsToReflect.elementAt(i));
-            for (int i = 0; i < otherItems.size(); ++i)
+            }
+            for (int i = 0; i < otherItems.size(); ++i) {
                 currentRoute.addMember(otherItems.elementAt(i));
+            }
 
             refreshData();
@@ -1155,5 +1050,6 @@
             // Temp
             /*
-             * if (firstNode != null) { Vector< AStarAlgorithm.Edge > path = new PublicTransportAStar(firstNode, lastNode).shortestPath(); Iterator<
+             * if (firstNode != null) {
+             * Vector< AStarAlgorithm.Edge > path = new PublicTransportAStar(firstNode, lastNode).shortestPath(); Iterator<
              * AStarAlgorithm.Edge > iter = path.iterator(); while (iter.hasNext()) { PublicTransportAStar.PartialWayEdge edge =
              * (PublicTransportAStar.PartialWayEdge)iter.next(); System.out.print(edge.way.getUniqueId()); System.out.print("\t");
@@ -1207,5 +1103,5 @@
             Main.map.mapView.zoomTo(box);
         } else if ("routePattern.itineraryMark".equals(event.getActionCommand())) {
-            OsmPrimitive[] osmp = { null };
+            OsmPrimitive[] osmp = {null};
             Main.getLayerManager().getEditDataSet().setSelected(osmp);
             markedWays.clear();
@@ -1266,6 +1162,7 @@
             if ((insPos > 0) && (insPos < itineraryData.getRowCount())) {
                 while ((insPos < itineraryData.getRowCount())
-                        && (itineraryData.ways.elementAt(insPos) == null))
+                        && (itineraryData.ways.elementAt(insPos) == null)) {
                     ++insPos;
+                }
                 itineraryTable.removeRowSelectionInterval(0, itineraryData.getRowCount() - 1);
                 if (insPos < itineraryData.getRowCount())
@@ -1436,5 +1333,5 @@
             Main.map.mapView.zoomTo(box);
         } else if ("routePattern.stoplistMark".equals(event.getActionCommand())) {
-            OsmPrimitive[] osmp = { null };
+            OsmPrimitive[] osmp = {null};
             Main.getLayerManager().getEditDataSet().setSelected(osmp);
             markedNodes.clear();
@@ -1497,6 +1394,7 @@
             if ((insPos > 0) && (insPos < stoplistData.getRowCount())) {
                 while ((insPos < stoplistData.getRowCount())
-                        && (stoplistData.nodes.elementAt(insPos) == null))
+                        && (stoplistData.nodes.elementAt(insPos) == null)) {
                     ++insPos;
+                }
                 stoplistTable.removeRowSelectionInterval(0, stoplistData.getRowCount() - 1);
                 if (insPos < stoplistData.getRowCount())
@@ -1726,6 +1624,7 @@
 
             Iterator<RouteReference> iter = relRefs.iterator();
-            while (iter.hasNext())
+            while (iter.hasNext()) {
                 relsListModel.addElement(iter.next());
+            }
         } else {
             JOptionPane.showMessageDialog(null,
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/RouteReference.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/RouteReference.java	(revision 33053)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/RouteReference.java	(revision 33053)
@@ -0,0 +1,77 @@
+// License: GPL. For details, see LICENSE file.
+package public_transport;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import org.openstreetmap.josm.data.osm.Relation;
+
+public class RouteReference implements Comparable<RouteReference> {
+    Relation route;
+
+    public RouteReference(Relation route) {
+        this.route = route;
+    }
+
+    @Override
+    public int compareTo(RouteReference rr) {
+        if (route.get("route") != null) {
+            if (rr.route.get("route") == null)
+                return -1;
+            int result = route.get("route").compareTo(rr.route.get("route"));
+            if (result != 0)
+                return result;
+        } else if (rr.route.get("route") != null)
+            return 1;
+        if (route.get("ref") != null) {
+            if (rr.route.get("ref") == null)
+                return -1;
+            int result = route.get("ref").compareTo(rr.route.get("ref"));
+            if (result != 0)
+                return result;
+        } else if (rr.route.get("ref") != null)
+            return 1;
+        if (route.get("to") != null) {
+            if (rr.route.get("to") == null)
+                return -1;
+            int result = route.get("to").compareTo(rr.route.get("to"));
+            if (result != 0)
+                return result;
+        } else if (rr.route.get("to") != null)
+            return 1;
+        if (route.get("direction") != null) {
+            if (rr.route.get("direction") == null)
+                return -1;
+            int result = route.get("direction").compareTo(rr.route.get("direction"));
+            if (result != 0)
+                return result;
+        } else if (rr.route.get("direction") != null)
+            return 1;
+        if (route.getId() < rr.route.getId())
+            return -1;
+        else if (route.getId() > rr.route.getId())
+            return 1;
+        return 0;
+    }
+
+    @Override
+    public String toString() {
+        String buf = route.get("route");
+        if ((route.get("ref") != null) && (route.get("ref") != "")) {
+            buf += " " + route.get("ref");
+        }
+        if ((route.get("loc_ref") != null) && (route.get("loc_ref") != "")) {
+            buf += " [" + route.get("loc_ref") + "]";
+        }
+
+        if ((route.get("to") != null) && (route.get("to") != "")) {
+            buf += ": " + route.get("to");
+        } else if ((route.get("direction") != null) && (route.get("direction") != "")) {
+            buf += " " + route.get("ref") + ": " + route.get("direction");
+        } else {
+            buf += " " + route.get("ref");
+        }
+        buf += tr(" [ID] {0}", Long.toString(route.getId()));
+
+        return buf;
+    }
+}
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/SettingsStoptypeCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/SettingsStoptypeCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/SettingsStoptypeCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -14,5 +15,5 @@
 public class SettingsStoptypeCommand extends Command {
     private static class HighwayRailway {
-        public HighwayRailway(Node node) {
+        HighwayRailway(Node node) {
             this.node = node;
             highway = node.get("highway");
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterAction.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterAction.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterAction.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -199,6 +200,7 @@
 
             Iterator<TrackReference> iter = trackRefs.iterator();
-            while (iter.hasNext())
+            while (iter.hasNext()) {
                 tracksListModel.addElement(iter.next());
+            }
 
             waypointTM = new WaypointTableModel(this);
@@ -277,9 +279,11 @@
         Vector<Integer> consideredLines = new Vector<>();
         if (selectedLines.length > 0) {
-            for (int i = 0; i < selectedLines.length; ++i)
+            for (int i = 0; i < selectedLines.length; ++i) {
                 consideredLines.add(selectedLines[i]);
+            }
         } else {
-            for (int i = 0; i < table.getRowCount(); ++i)
+            for (int i = 0; i < table.getRowCount(); ++i) {
                 consideredLines.add(Integer.valueOf(i));
+            }
         }
         return consideredLines;
@@ -321,5 +325,5 @@
      */
     public static void markNodesFromTable(JTable table, Vector<Node> nodes) {
-        OsmPrimitive[] osmp = { null };
+        OsmPrimitive[] osmp = {null};
         DataSet ds = Main.getLayerManager().getEditDataSet();
         ds.setSelected(osmp);
@@ -415,5 +419,5 @@
         private String defaultShelter = null;
 
-        public FocusWaypointShelterAction(String defaultShelter) {
+        FocusWaypointShelterAction(String defaultShelter) {
             this.defaultShelter = defaultShelter;
         }
@@ -461,5 +465,5 @@
         private String defaultShelter = null;
 
-        public FocusTrackStoplistShelterAction(String defaultShelter) {
+        FocusTrackStoplistShelterAction(String defaultShelter) {
             this.defaultShelter = defaultShelter;
         }
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterDialog.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterDialog.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/StopImporterDialog.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -68,5 +69,5 @@
         tracksList = new JList<>(tracksListModel);
         JScrollPane rpListSP = new JScrollPane(tracksList);
-        String[] data = { "1", "2", "3", "4", "5", "6" };
+        String[] data = {"1", "2", "3", "4", "5", "6"};
         tracksListModel.copyInto(data);
         tracksList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@@ -537,5 +538,5 @@
         StopImporterAction root = null;
 
-        public TracksLSL(StopImporterAction sia) {
+        TracksLSL(StopImporterAction sia) {
             root = sia;
         }
@@ -549,4 +550,4 @@
                 root.tracksSelectionChanged(-1);
         }
-    };
+    }
 }
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/StopReference.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/StopReference.java	(revision 33053)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/StopReference.java	(revision 33053)
@@ -0,0 +1,41 @@
+// License: GPL. For details, see LICENSE file.
+package public_transport;
+
+import org.openstreetmap.josm.data.osm.Node;
+
+public class StopReference implements Comparable<StopReference> {
+    public int index = 0;
+
+    public double pos = 0;
+
+    public double distance = 0;
+
+    public String name = "";
+
+    public String role = "";
+
+    public Node node;
+
+    public StopReference(int inIndex, double inPos, double inDistance, String inName,
+            String inRole, Node inNode) {
+        index = inIndex;
+        pos = inPos;
+        distance = inDistance;
+        name = inName;
+        role = inRole;
+        node = inNode;
+    }
+
+    @Override
+    public int compareTo(StopReference sr) {
+        if (this.index < sr.index)
+            return -1;
+        if (this.index > sr.index)
+            return 1;
+        if (this.pos < sr.pos)
+            return -1;
+        if (this.pos > sr.pos)
+            return 1;
+        return 0;
+    }
+}
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/TrackReference.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/TrackReference.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/TrackReference.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -181,3 +182,3 @@
         }
     }
-};
+}
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistAddCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistAddCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistAddCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDeleteCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDeleteCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDeleteCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -47,6 +48,7 @@
             }
         } else {
-            for (int i = 0; i < stoplistTM.getRowCount(); ++i)
+            for (int i = 0; i < stoplistTM.getRowCount(); ++i) {
                 workingLines.add(Integer.valueOf(i));
+            }
         }
     }
@@ -91,3 +93,3 @@
         return tr("Public Transport: Delete track stop");
     }
-};
+}
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDetachCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDetachCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistDetachCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -26,9 +27,11 @@
         Vector<Integer> consideredLines = new Vector<>();
         if (selectedLines.length > 0) {
-            for (int i = 0; i < selectedLines.length; ++i)
+            for (int i = 0; i < selectedLines.length; ++i) {
                 consideredLines.add(selectedLines[i]);
+            }
         } else {
-            for (int i = 0; i < stoplistTM.getRowCount(); ++i)
+            for (int i = 0; i < stoplistTM.getRowCount(); ++i) {
                 consideredLines.add(Integer.valueOf(i));
+            }
         }
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistNameCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistNameCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistNameCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistRelocateCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistRelocateCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistRelocateCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistSortCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistSortCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistSortCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -36,9 +37,11 @@
         int[] selectedLines = controller.getDialog().getStoplistTable().getSelectedRows();
         if (selectedLines.length > 0) {
-            for (int i = 0; i < selectedLines.length; ++i)
+            for (int i = 0; i < selectedLines.length; ++i) {
                 workingLines.add(selectedLines[i]);
+            }
         } else {
-            for (int i = 0; i < stoplistTM.getRowCount(); ++i)
+            for (int i = 0; i < stoplistTM.getRowCount(); ++i) {
                 workingLines.add(Integer.valueOf(i));
+            }
         }
     }
@@ -102,5 +105,5 @@
         public double startTime = 0;
 
-        public NodeSortEntry(Node node, String time, String name, TransText shelter,
+        NodeSortEntry(Node node, String time, String name, TransText shelter,
                 double startTime) {
             this.node = node;
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistTableModel.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistTableModel.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/TrackStoplistTableModel.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -93,5 +94,5 @@
 
     public void insertRow(int insPos, Node node, String time, String name, TransText shelter) {
-        Object[] buf = { time, name, shelter };
+        Object[] buf = {time, name, shelter};
         if (insPos == -1) {
             nodes.addElement(node);
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/TrackSuggestStopsCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/TrackSuggestStopsCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/TrackSuggestStopsCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -73,6 +74,7 @@
         while (siter.hasNext()) {
             Iterator<WayPoint> witer = siter.next().getWayPoints().iterator();
-            while (witer.hasNext())
+            while (witer.hasNext()) {
                 wayPoints.add(witer.next());
+            }
         }
         Vector<Double> wayPointsDist = new Vector<>(wayPoints.size());
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/TransText.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/TransText.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/TransText.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointTableModel.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointTableModel.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointTableModel.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -62,5 +63,5 @@
         Node node = controller.createNode(wp.getCoor(), name);
 
-        Object[] buf = { time, name, new TransText(null) };
+        Object[] buf = {time, name, new TransText(null)};
         if (insPos == -1) {
             nodes.addElement(node);
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsDetachCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsDetachCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsDetachCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -26,9 +27,11 @@
         Vector<Integer> consideredLines = new Vector<>();
         if (selectedLines.length > 0) {
-            for (int i = 0; i < selectedLines.length; ++i)
+            for (int i = 0; i < selectedLines.length; ++i) {
                 consideredLines.add(selectedLines[i]);
+            }
         } else {
-            for (int i = 0; i < waypointTM.getRowCount(); ++i)
+            for (int i = 0; i < waypointTM.getRowCount(); ++i) {
                 consideredLines.add(Integer.valueOf(i));
+            }
         }
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsDisableCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsDisableCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsDisableCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -27,9 +28,11 @@
         Vector<Integer> consideredLines = new Vector<>();
         if (selectedLines.length > 0) {
-            for (int i = 0; i < selectedLines.length; ++i)
+            for (int i = 0; i < selectedLines.length; ++i) {
                 consideredLines.add(selectedLines[i]);
+            }
         } else {
-            for (int i = 0; i < waypointTM.getRowCount(); ++i)
+            for (int i = 0; i < waypointTM.getRowCount(); ++i) {
                 consideredLines.add(Integer.valueOf(i));
+            }
         }
 
@@ -79,3 +82,3 @@
         return tr("Public Transport: Disable waypoints");
     }
-};
+}
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsEnableCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsEnableCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsEnableCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
@@ -27,9 +28,11 @@
         Vector<Integer> consideredLines = new Vector<>();
         if (selectedLines.length > 0) {
-            for (int i = 0; i < selectedLines.length; ++i)
+            for (int i = 0; i < selectedLines.length; ++i) {
                 consideredLines.add(selectedLines[i]);
+            }
         } else {
-            for (int i = 0; i < waypointTM.getRowCount(); ++i)
+            for (int i = 0; i < waypointTM.getRowCount(); ++i) {
                 consideredLines.add(Integer.valueOf(i));
+            }
         }
 
Index: /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsNameCommand.java
===================================================================
--- /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsNameCommand.java	(revision 33052)
+++ /applications/editors/josm/plugins/public_transport/src/public_transport/WaypointsNameCommand.java	(revision 33053)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package public_transport;
 
