Index: applications/editors/josm/plugins/livegps/src/livegps/AppendableGpxTrackSegment.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/livegps/AppendableGpxTrackSegment.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/livegps/AppendableGpxTrackSegment.java	(revision 23191)
@@ -14,49 +14,49 @@
 public class AppendableGpxTrackSegment implements GpxTrackSegment {
 
-	private WayPoint[] wayPoints = new WayPoint[16];
-	private int size;
-	private Bounds bounds;
-	private double length;
+    private WayPoint[] wayPoints = new WayPoint[16];
+    private int size;
+    private Bounds bounds;
+    private double length;
 
-	public Bounds getBounds() {
-		return bounds;
-	}
+    public Bounds getBounds() {
+        return bounds;
+    }
 
-	public Collection<WayPoint> getWayPoints() {
-		return new CopyList<WayPoint>(wayPoints, size);
-	}
+    public Collection<WayPoint> getWayPoints() {
+        return new CopyList<WayPoint>(wayPoints, size);
+    }
 
-	public void addWaypoint(WayPoint p) {
-		if (wayPoints.length == size) {
-			WayPoint[] newWaypoints = new WayPoint[wayPoints.length * 2];
-			System.arraycopy(wayPoints, 0, newWaypoints, 0, wayPoints.length);
-			wayPoints = newWaypoints;
-		}
+    public void addWaypoint(WayPoint p) {
+        if (wayPoints.length == size) {
+            WayPoint[] newWaypoints = new WayPoint[wayPoints.length * 2];
+            System.arraycopy(wayPoints, 0, newWaypoints, 0, wayPoints.length);
+            wayPoints = newWaypoints;
+        }
 
-		if (size > 0) {
-			Double distance = wayPoints[size - 1].getCoor().greatCircleDistance(p.getCoor());
-			if (!distance.isNaN() && !distance.isInfinite()) {
-				length += distance;
-			}
-		}
+        if (size > 0) {
+            Double distance = wayPoints[size - 1].getCoor().greatCircleDistance(p.getCoor());
+            if (!distance.isNaN() && !distance.isInfinite()) {
+                length += distance;
+            }
+        }
 
-		if (bounds == null) {
-			bounds = new Bounds(p.getCoor());
-		} else {
-			bounds.extend(p.getCoor());
-		}
+        if (bounds == null) {
+            bounds = new Bounds(p.getCoor());
+        } else {
+            bounds.extend(p.getCoor());
+        }
 
-		wayPoints[size] = p;
-		size++;
-	}
+        wayPoints[size] = p;
+        size++;
+    }
 
-	public double length() {
-		return length;
-	}
+    public double length() {
+        return length;
+    }
 
-	@Override
-	public int getUpdateCount() {
-		return size;
-	}
+    @Override
+    public int getUpdateCount() {
+        return size;
+    }
 
 }
Index: applications/editors/josm/plugins/livegps/src/livegps/ILiveGpsSuppressor.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/livegps/ILiveGpsSuppressor.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/livegps/ILiveGpsSuppressor.java	(revision 23191)
@@ -3,18 +3,18 @@
 /**
  * Interface for class LiveGpsSuppressor, only has a query if currently an update is allowed.
- * 
- * @author casualwalker 
+ *
+ * @author casualwalker
  *
  */
 public interface ILiveGpsSuppressor {
 
-	/**
-	 * Query, if an update is currently allowed.
-	 * When it is allowed, it will disable the allowUpdate flag as a side effect.
-	 * (this means, one thread got to issue an update event)
-	 *
-	 * @return true, if an update is currently allowed; false, if the update shall be suppressed.
-	 */
-	boolean isAllowUpdate();
+    /**
+     * Query, if an update is currently allowed.
+     * When it is allowed, it will disable the allowUpdate flag as a side effect.
+     * (this means, one thread got to issue an update event)
+     *
+     * @return true, if an update is currently allowed; false, if the update shall be suppressed.
+     */
+    boolean isAllowUpdate();
 
 }
Index: applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java	(revision 23191)
@@ -22,312 +22,312 @@
 
 public class LiveGpsAcquirer implements Runnable {
-	private String gpsdHost;
-	private int gpsdPort;
-
-	private Socket gpsdSocket;
-	private BufferedReader gpsdReader;
-	private boolean connected = false;
-	private boolean shutdownFlag = false;
-	private boolean JSONProtocol = true;
-
-	private final List<PropertyChangeListener> propertyChangeListener = new ArrayList<PropertyChangeListener>();
-	private PropertyChangeEvent lastStatusEvent;
-	private PropertyChangeEvent lastDataEvent;
-
-	/**
-	 * Constructor, initializes the configurable settings.
-	 */
-	public LiveGpsAcquirer() {
-		super();
-
-		gpsdHost = Main.pref.get("livegps.gpsd.host", "localhost");
-		gpsdPort = Main.pref.getInteger("livegps.gpsd.port", 2947);
-		// put the settings back in to the preferences, makes keys appear.
-		Main.pref.put("livegps.gpsd.host", gpsdHost);
-		Main.pref.putInteger("livegps.gpsd.port", gpsdPort);
-	}
-
-	/**
-	 * Adds a property change listener to the acquirer.
-	 * @param listener the new listener
-	 */
-	public void addPropertyChangeListener(PropertyChangeListener listener) {
-		if (!propertyChangeListener.contains(listener)) {
-			propertyChangeListener.add(listener);
-		}
-	}
-
-	/**
-	 * Remove a property change listener from the acquirer.
-	 * @param listener the new listener
-	 */
-	public void removePropertyChangeListener(PropertyChangeListener listener) {
-		if (propertyChangeListener.contains(listener)) {
-			propertyChangeListener.remove(listener);
-		}
-	}
-
-	/**
-	 * Fire a gps status change event. Fires events with key "gpsstatus" and a {@link LiveGpsStatus}
-	 * object as value.
-	 * The status event may be sent any time.
-	 * @param status the status.
-	 * @param statusMessage the status message.
-	 */
-	public void fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus status,
-			String statusMessage) {
-		PropertyChangeEvent event = new PropertyChangeEvent(this, "gpsstatus",
-				null, new LiveGpsStatus(status, statusMessage));
-
-		if (!event.equals(lastStatusEvent)) {
-			firePropertyChangeEvent(event);
-			lastStatusEvent = event;
-		}
-	}
-
-	/**
-	 * Fire a gps data change event to all listeners. Fires events with key "gpsdata" and a
-	 * {@link LiveGpsData} object as values.
-	 * This event is only sent, when the suppressor permits it. This
-	 * event will cause the UI to re-draw itself, which has some performance penalty,
-	 * @param oldData the old gps data.
-	 * @param newData the new gps data.
-	 */
-	public void fireGpsDataChangeEvent(LiveGpsData oldData, LiveGpsData newData) {
-		PropertyChangeEvent event = new PropertyChangeEvent(this, "gpsdata",
-				oldData, newData);
-
-		if (!event.equals(lastDataEvent)) {
-			firePropertyChangeEvent(event);
-			lastDataEvent = event;
-		}
-	}
-
-	/**
-	 * Fires the given event to all listeners.
-	 * @param event the event to fire.
-	 */
-	protected void firePropertyChangeEvent(PropertyChangeEvent event) {
-		for (PropertyChangeListener listener : propertyChangeListener) {
-			listener.propertyChange(event);
-		}
-	}
-
-	public void run() {
-		LiveGpsData oldGpsData = null;
-		LiveGpsData gpsData = null;
-
-		shutdownFlag = false;
-		while (!shutdownFlag) {
-
-			try {
-				if (!connected)
-					connect();
-
-				if (connected) {
-					String line;
-
-					// <FIXXME date="23.06.2007" author="cdaller">
-					// TODO this read is blocking if gps is connected but has no
-					// fix, so gpsd does not send positions
-					line = gpsdReader.readLine();
-					// </FIXXME>
-					if (line == null)
-						break;
-
-					if (JSONProtocol == true)
-						gpsData = ParseJSON(line);
-					else
-						gpsData = ParseOld(line);
-
-					if (gpsData == null)
-						continue;
-
-					fireGpsDataChangeEvent(oldGpsData, gpsData);
-					oldGpsData = gpsData;
-				} else {
-					fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.DISCONNECTED, tr("Not connected"));
-					try {
-						Thread.sleep(1000);
-					} catch (InterruptedException ignore) {}
-				}
-			} catch (IOException iox) {
-				connected = false;
-				if (gpsData != null) {
-					gpsData.setFix(false);
-					fireGpsDataChangeEvent(oldGpsData, gpsData);
-				}
-				fireGpsStatusChangeEvent(
-						LiveGpsStatus.GpsStatus.CONNECTION_FAILED,
-						tr("Connection Failed"));
-				try {
-					Thread.sleep(1000);
-				} catch (InterruptedException ignore) {} ;
-				// send warning to layer
-			}
-		}
-
-		fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.DISCONNECTED,
-				tr("Not connected"));
-		if (gpsdSocket != null) {
-			try {
-				gpsdSocket.close();
-				gpsdSocket = null;
-				System.out.println("LiveGps: Disconnected from gpsd");
-			} catch (Exception e) {
-				System.out.println("LiveGps: Unable to close socket; reconnection may not be possible");
-			}
-		}
-	}
-
-	public void shutdown() {
-		shutdownFlag = true;
-	}
-
-	private void connect() throws IOException {
-		JSONObject greeting;
-		String line, type, release;
-
-		System.out.println("LiveGps: trying to connect to gpsd at " + gpsdHost + ":" + gpsdPort);
-		fireGpsStatusChangeEvent( LiveGpsStatus.GpsStatus.CONNECTING, tr("Connecting"));
-
-		InetAddress[] addrs = InetAddress.getAllByName(gpsdHost);
-		for (int i = 0; i < addrs.length && gpsdSocket == null; i++) {
-			try {
-				gpsdSocket = new Socket(addrs[i], gpsdPort);
-				break;
-			} catch (Exception e) {
-				System.out.println("LiveGps: Could not open connection to gpsd: " + e);
-				gpsdSocket = null;
-			}
-		}
-
-		if (gpsdSocket == null)
-			return;
-
-		fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTING, tr("Connecting"));
-
-		/*
-		 * First emit the "w" symbol. The older version will activate, the newer one will ignore it.
-		 */
-		gpsdSocket.getOutputStream().write(new byte[] { 'w', 13, 10 });
-
-		gpsdReader = new BufferedReader(new InputStreamReader(gpsdSocket.getInputStream()));
-		line = gpsdReader.readLine();
-		if (line == null)
-			return;
-
-		try {
-			greeting = new JSONObject(line);
-			type = greeting.getString("class");
-			if (type.equals("VERSION")) {
-				release = greeting.getString("release");
-				System.out.println("LiveGps: Connected to gpsd " + release);
-			} else
-				System.out.println("LiveGps: Unexpected JSON in gpsd greeting: " + line);
-		} catch (JSONException jex) {
-			if (line.startsWith("GPSD,")) {
-				connected = true;
-				JSONProtocol = false;
-				System.out.println("LiveGps: Connected to old gpsd protocol version.");
-				fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTED, tr("Connected"));
-			}
-		}
-
-		if (JSONProtocol == true) {
-			JSONObject Watch = new JSONObject();
-			try { 
-				Watch.put("enable", true);
-				Watch.put("json", true);
-			} catch (JSONException je) {};
-
-			String Request = "?WATCH=" + Watch.toString() + ";\n";
-			gpsdSocket.getOutputStream().write(Request.getBytes());
-
-			connected = true;
-			fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTED, tr("Connected"));
-		}
-	}
-
-	private LiveGpsData ParseJSON(String line) {
-		JSONObject report;
-		String type;
-		double lat = 0;
-		double lon = 0;
-		float speed = 0;
-		float course = 0;
-
-		try {
-			report = new JSONObject(line);
-			type = report.getString("class");
-		} catch (JSONException jex) {
-			System.out.println("LiveGps: line read from gpsd is not a JSON object:" + line);
-			return null;
-		}
-		if (!type.equals("TPV"))
-			return null;
-
-		try {
-			lat = report.getDouble("lat");
-			lon = report.getDouble("lon");
-			speed = (new Float(report.getDouble("speed"))).floatValue();
-			course = (new Float(report.getDouble("track"))).floatValue();
-
-			return new LiveGpsData(lat, lon, course, speed, true);
-		} catch (JSONException je) {}
-
-		return null;
-	}
-
-	private LiveGpsData ParseOld(String line) {
-		String words[];
-		double lat = 0;
-		double lon = 0;
-		float speed = 0;
-		float course = 0;
-
-		words = line.split(",");
-		if ((words.length == 0) || (!words[0].equals("GPSD")))
-			return null;
-
-		for (int i = 1; i < words.length; i++) {
-			if ((words[i].length() < 2) || (words[i].charAt(1) != '=')) {
-				// unexpected response.
-				continue;
-			}
-
-			char what = words[i].charAt(0);
-			String value = words[i].substring(2);
-			switch (what) {
-			case 'O':
-				// full report, tab delimited.
-				String[] status = value.split("\\s+");
-				if (status.length >= 5) {
-					lat = Double.parseDouble(status[3]);
-					lon = Double.parseDouble(status[4]);
-					try {
-						speed = Float.parseFloat(status[9]);
-						course = Float.parseFloat(status[8]);
-					} catch (NumberFormatException nex) {}
-					return new LiveGpsData(lat, lon, course, speed, true);
-				}
-				break;
-			case 'P':
-				// position report, tab delimited.
-				String[] pos = value.split("\\s+");
-				if (pos.length >= 2) {
-					lat = Double.parseDouble(pos[0]);
-					lon = Double.parseDouble(pos[1]);
-					speed = Float.NaN;
-					course = Float.NaN;
-					return new LiveGpsData(lat, lon, course, speed, true);
-				}
-				break;
-			default:
-				// not interested
-			}
-		}
-
-		return null;
-	}
+    private String gpsdHost;
+    private int gpsdPort;
+
+    private Socket gpsdSocket;
+    private BufferedReader gpsdReader;
+    private boolean connected = false;
+    private boolean shutdownFlag = false;
+    private boolean JSONProtocol = true;
+
+    private final List<PropertyChangeListener> propertyChangeListener = new ArrayList<PropertyChangeListener>();
+    private PropertyChangeEvent lastStatusEvent;
+    private PropertyChangeEvent lastDataEvent;
+
+    /**
+     * Constructor, initializes the configurable settings.
+     */
+    public LiveGpsAcquirer() {
+        super();
+
+        gpsdHost = Main.pref.get("livegps.gpsd.host", "localhost");
+        gpsdPort = Main.pref.getInteger("livegps.gpsd.port", 2947);
+        // put the settings back in to the preferences, makes keys appear.
+        Main.pref.put("livegps.gpsd.host", gpsdHost);
+        Main.pref.putInteger("livegps.gpsd.port", gpsdPort);
+    }
+
+    /**
+     * Adds a property change listener to the acquirer.
+     * @param listener the new listener
+     */
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        if (!propertyChangeListener.contains(listener)) {
+            propertyChangeListener.add(listener);
+        }
+    }
+
+    /**
+     * Remove a property change listener from the acquirer.
+     * @param listener the new listener
+     */
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        if (propertyChangeListener.contains(listener)) {
+            propertyChangeListener.remove(listener);
+        }
+    }
+
+    /**
+     * Fire a gps status change event. Fires events with key "gpsstatus" and a {@link LiveGpsStatus}
+     * object as value.
+     * The status event may be sent any time.
+     * @param status the status.
+     * @param statusMessage the status message.
+     */
+    public void fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus status,
+            String statusMessage) {
+        PropertyChangeEvent event = new PropertyChangeEvent(this, "gpsstatus",
+                null, new LiveGpsStatus(status, statusMessage));
+
+        if (!event.equals(lastStatusEvent)) {
+            firePropertyChangeEvent(event);
+            lastStatusEvent = event;
+        }
+    }
+
+    /**
+     * Fire a gps data change event to all listeners. Fires events with key "gpsdata" and a
+     * {@link LiveGpsData} object as values.
+     * This event is only sent, when the suppressor permits it. This
+     * event will cause the UI to re-draw itself, which has some performance penalty,
+     * @param oldData the old gps data.
+     * @param newData the new gps data.
+     */
+    public void fireGpsDataChangeEvent(LiveGpsData oldData, LiveGpsData newData) {
+        PropertyChangeEvent event = new PropertyChangeEvent(this, "gpsdata",
+                oldData, newData);
+
+        if (!event.equals(lastDataEvent)) {
+            firePropertyChangeEvent(event);
+            lastDataEvent = event;
+        }
+    }
+
+    /**
+     * Fires the given event to all listeners.
+     * @param event the event to fire.
+     */
+    protected void firePropertyChangeEvent(PropertyChangeEvent event) {
+        for (PropertyChangeListener listener : propertyChangeListener) {
+            listener.propertyChange(event);
+        }
+    }
+
+    public void run() {
+        LiveGpsData oldGpsData = null;
+        LiveGpsData gpsData = null;
+
+        shutdownFlag = false;
+        while (!shutdownFlag) {
+
+            try {
+                if (!connected)
+                    connect();
+
+                if (connected) {
+                    String line;
+
+                    // <FIXXME date="23.06.2007" author="cdaller">
+                    // TODO this read is blocking if gps is connected but has no
+                    // fix, so gpsd does not send positions
+                    line = gpsdReader.readLine();
+                    // </FIXXME>
+                    if (line == null)
+                        break;
+
+                    if (JSONProtocol == true)
+                        gpsData = ParseJSON(line);
+                    else
+                        gpsData = ParseOld(line);
+
+                    if (gpsData == null)
+                        continue;
+
+                    fireGpsDataChangeEvent(oldGpsData, gpsData);
+                    oldGpsData = gpsData;
+                } else {
+                    fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.DISCONNECTED, tr("Not connected"));
+                    try {
+                        Thread.sleep(1000);
+                    } catch (InterruptedException ignore) {}
+                }
+            } catch (IOException iox) {
+                connected = false;
+                if (gpsData != null) {
+                    gpsData.setFix(false);
+                    fireGpsDataChangeEvent(oldGpsData, gpsData);
+                }
+                fireGpsStatusChangeEvent(
+                        LiveGpsStatus.GpsStatus.CONNECTION_FAILED,
+                        tr("Connection Failed"));
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException ignore) {} ;
+                // send warning to layer
+            }
+        }
+
+        fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.DISCONNECTED,
+                tr("Not connected"));
+        if (gpsdSocket != null) {
+            try {
+                gpsdSocket.close();
+                gpsdSocket = null;
+                System.out.println("LiveGps: Disconnected from gpsd");
+            } catch (Exception e) {
+                System.out.println("LiveGps: Unable to close socket; reconnection may not be possible");
+            }
+        }
+    }
+
+    public void shutdown() {
+        shutdownFlag = true;
+    }
+
+    private void connect() throws IOException {
+        JSONObject greeting;
+        String line, type, release;
+
+        System.out.println("LiveGps: trying to connect to gpsd at " + gpsdHost + ":" + gpsdPort);
+        fireGpsStatusChangeEvent( LiveGpsStatus.GpsStatus.CONNECTING, tr("Connecting"));
+
+        InetAddress[] addrs = InetAddress.getAllByName(gpsdHost);
+        for (int i = 0; i < addrs.length && gpsdSocket == null; i++) {
+            try {
+                gpsdSocket = new Socket(addrs[i], gpsdPort);
+                break;
+            } catch (Exception e) {
+                System.out.println("LiveGps: Could not open connection to gpsd: " + e);
+                gpsdSocket = null;
+            }
+        }
+
+        if (gpsdSocket == null)
+            return;
+
+        fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTING, tr("Connecting"));
+
+        /*
+         * First emit the "w" symbol. The older version will activate, the newer one will ignore it.
+         */
+        gpsdSocket.getOutputStream().write(new byte[] { 'w', 13, 10 });
+
+        gpsdReader = new BufferedReader(new InputStreamReader(gpsdSocket.getInputStream()));
+        line = gpsdReader.readLine();
+        if (line == null)
+            return;
+
+        try {
+            greeting = new JSONObject(line);
+            type = greeting.getString("class");
+            if (type.equals("VERSION")) {
+                release = greeting.getString("release");
+                System.out.println("LiveGps: Connected to gpsd " + release);
+            } else
+                System.out.println("LiveGps: Unexpected JSON in gpsd greeting: " + line);
+        } catch (JSONException jex) {
+            if (line.startsWith("GPSD,")) {
+                connected = true;
+                JSONProtocol = false;
+                System.out.println("LiveGps: Connected to old gpsd protocol version.");
+                fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTED, tr("Connected"));
+            }
+        }
+
+        if (JSONProtocol == true) {
+            JSONObject Watch = new JSONObject();
+            try {
+                Watch.put("enable", true);
+                Watch.put("json", true);
+            } catch (JSONException je) {};
+
+            String Request = "?WATCH=" + Watch.toString() + ";\n";
+            gpsdSocket.getOutputStream().write(Request.getBytes());
+
+            connected = true;
+            fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTED, tr("Connected"));
+        }
+    }
+
+    private LiveGpsData ParseJSON(String line) {
+        JSONObject report;
+        String type;
+        double lat = 0;
+        double lon = 0;
+        float speed = 0;
+        float course = 0;
+
+        try {
+            report = new JSONObject(line);
+            type = report.getString("class");
+        } catch (JSONException jex) {
+            System.out.println("LiveGps: line read from gpsd is not a JSON object:" + line);
+            return null;
+        }
+        if (!type.equals("TPV"))
+            return null;
+
+        try {
+            lat = report.getDouble("lat");
+            lon = report.getDouble("lon");
+            speed = (new Float(report.getDouble("speed"))).floatValue();
+            course = (new Float(report.getDouble("track"))).floatValue();
+
+            return new LiveGpsData(lat, lon, course, speed, true);
+        } catch (JSONException je) {}
+
+        return null;
+    }
+
+    private LiveGpsData ParseOld(String line) {
+        String words[];
+        double lat = 0;
+        double lon = 0;
+        float speed = 0;
+        float course = 0;
+
+        words = line.split(",");
+        if ((words.length == 0) || (!words[0].equals("GPSD")))
+            return null;
+
+        for (int i = 1; i < words.length; i++) {
+            if ((words[i].length() < 2) || (words[i].charAt(1) != '=')) {
+                // unexpected response.
+                continue;
+            }
+
+            char what = words[i].charAt(0);
+            String value = words[i].substring(2);
+            switch (what) {
+            case 'O':
+                // full report, tab delimited.
+                String[] status = value.split("\\s+");
+                if (status.length >= 5) {
+                    lat = Double.parseDouble(status[3]);
+                    lon = Double.parseDouble(status[4]);
+                    try {
+                        speed = Float.parseFloat(status[9]);
+                        course = Float.parseFloat(status[8]);
+                    } catch (NumberFormatException nex) {}
+                    return new LiveGpsData(lat, lon, course, speed, true);
+                }
+                break;
+            case 'P':
+                // position report, tab delimited.
+                String[] pos = value.split("\\s+");
+                if (pos.length >= 2) {
+                    lat = Double.parseDouble(pos[0]);
+                    lon = Double.parseDouble(pos[1]);
+                    speed = Float.NaN;
+                    course = Float.NaN;
+                    return new LiveGpsData(lat, lon, course, speed, true);
+                }
+                break;
+            default:
+                // not interested
+            }
+        }
+
+        return null;
+    }
 }
Index: applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java	(revision 23191)
@@ -23,161 +23,161 @@
 
 public class LiveGpsLayer extends GpxLayer implements PropertyChangeListener {
-	public static final String LAYER_NAME = tr("LiveGPS layer");
-	public static final String KEY_LIVEGPS_COLOR = "color.livegps.position";
-	LatLon lastPos;
-	WayPoint lastPoint;
-	private final AppendableGpxTrackSegment trackSegment;
-	float speed;
-	float course;
-	// JLabel lbl;
-	boolean autocenter;
-	private SimpleDateFormat dateFormat = new SimpleDateFormat(
-	"yyyy-MM-dd'T'HH:mm:ss.SSS");
+    public static final String LAYER_NAME = tr("LiveGPS layer");
+    public static final String KEY_LIVEGPS_COLOR = "color.livegps.position";
+    LatLon lastPos;
+    WayPoint lastPoint;
+    private final AppendableGpxTrackSegment trackSegment;
+    float speed;
+    float course;
+    // JLabel lbl;
+    boolean autocenter;
+    private SimpleDateFormat dateFormat = new SimpleDateFormat(
+    "yyyy-MM-dd'T'HH:mm:ss.SSS");
 
-	/**
-	 * The suppressor is queried, if the GUI shall be re-drawn.
-	 */
-	private ILiveGpsSuppressor suppressor;
+    /**
+     * The suppressor is queried, if the GUI shall be re-drawn.
+     */
+    private ILiveGpsSuppressor suppressor;
 
-	public LiveGpsLayer(GpxData data) {
-		super(data, LAYER_NAME);
-		trackSegment = new AppendableGpxTrackSegment();
+    public LiveGpsLayer(GpxData data) {
+        super(data, LAYER_NAME);
+        trackSegment = new AppendableGpxTrackSegment();
 
-		Map<String, Object> attr = new HashMap<String, Object>();
-		attr.put("desc", "josm live gps");
+        Map<String, Object> attr = new HashMap<String, Object>();
+        attr.put("desc", "josm live gps");
 
-		GpxTrack trackBeingWritten = new SingleSegmentGpxTrack(trackSegment, attr);
-		data.tracks.add(trackBeingWritten);
-	}
+        GpxTrack trackBeingWritten = new SingleSegmentGpxTrack(trackSegment, attr);
+        data.tracks.add(trackBeingWritten);
+    }
 
-	void setCurrentPosition(double lat, double lon) {
-		// System.out.println("adding pos " + lat + "," + lon);
-		LatLon thisPos = new LatLon(lat, lon);
-		if ((lastPos != null) && (thisPos.equalsEpsilon(lastPos))) {
-			// no change in position
-			// maybe show a "paused" cursor or some such
-			return;
-		}
+    void setCurrentPosition(double lat, double lon) {
+        // System.out.println("adding pos " + lat + "," + lon);
+        LatLon thisPos = new LatLon(lat, lon);
+        if ((lastPos != null) && (thisPos.equalsEpsilon(lastPos))) {
+            // no change in position
+            // maybe show a "paused" cursor or some such
+            return;
+        }
 
-		lastPos = thisPos;
-		lastPoint = new WayPoint(thisPos);
-		lastPoint.attr.put("time", dateFormat.format(new Date()));
-		trackSegment.addWaypoint(lastPoint);
-		if (autocenter && allowRedraw()) {
-			center();
-		}
+        lastPos = thisPos;
+        lastPoint = new WayPoint(thisPos);
+        lastPoint.attr.put("time", dateFormat.format(new Date()));
+        trackSegment.addWaypoint(lastPoint);
+        if (autocenter && allowRedraw()) {
+            center();
+        }
 
-		// Main.map.repaint();
-	}
+        // Main.map.repaint();
+    }
 
-	public void center() {
-		if (lastPoint != null)
-			Main.map.mapView.zoomTo(lastPoint.getCoor());
-	}
+    public void center() {
+        if (lastPoint != null)
+            Main.map.mapView.zoomTo(lastPoint.getCoor());
+    }
 
-	// void setStatus(String status)
-	// {
-	// this.status = status;
-	// Main.map.repaint();
-	// System.out.println("LiveGps status: " + status);
-	// }
+    // void setStatus(String status)
+    // {
+    // this.status = status;
+    // Main.map.repaint();
+    // System.out.println("LiveGps status: " + status);
+    // }
 
-	void setSpeed(float metresPerSecond) {
-		speed = metresPerSecond;
-		// Main.map.repaint();
-	}
+    void setSpeed(float metresPerSecond) {
+        speed = metresPerSecond;
+        // Main.map.repaint();
+    }
 
-	void setCourse(float degrees) {
-		course = degrees;
-		// Main.map.repaint();
-	}
+    void setCourse(float degrees) {
+        course = degrees;
+        // Main.map.repaint();
+    }
 
-	public void setAutoCenter(boolean ac) {
-		autocenter = ac;
-	}
+    public void setAutoCenter(boolean ac) {
+        autocenter = ac;
+    }
 
-	@Override
-	public void paint(Graphics2D g, MapView mv, Bounds bounds) {
-		// System.out.println("in paint");
-		// System.out.println("in synced paint");
-		super.paint(g, mv, bounds);
-		// int statusHeight = 50;
-		// Rectangle mvs = mv.getBounds();
-		// mvs.y = mvs.y + mvs.height - statusHeight;
-		// mvs.height = statusHeight;
-		// g.setColor(new Color(1.0f, 1.0f, 1.0f, 0.8f));
-		// g.fillRect(mvs.x, mvs.y, mvs.width, mvs.height);
+    @Override
+    public void paint(Graphics2D g, MapView mv, Bounds bounds) {
+        // System.out.println("in paint");
+        // System.out.println("in synced paint");
+        super.paint(g, mv, bounds);
+        // int statusHeight = 50;
+        // Rectangle mvs = mv.getBounds();
+        // mvs.y = mvs.y + mvs.height - statusHeight;
+        // mvs.height = statusHeight;
+        // g.setColor(new Color(1.0f, 1.0f, 1.0f, 0.8f));
+        // g.fillRect(mvs.x, mvs.y, mvs.width, mvs.height);
 
-		if (lastPoint != null) {
-			Point screen = mv.getPoint(lastPoint.getCoor());
-			g.setColor(Main.pref.getColor(KEY_LIVEGPS_COLOR, Color.RED));
-			g.drawOval(screen.x - 10, screen.y - 10, 20, 20);
-			g.drawOval(screen.x - 9, screen.y - 9, 18, 18);
-		}
+        if (lastPoint != null) {
+            Point screen = mv.getPoint(lastPoint.getCoor());
+            g.setColor(Main.pref.getColor(KEY_LIVEGPS_COLOR, Color.RED));
+            g.drawOval(screen.x - 10, screen.y - 10, 20, 20);
+            g.drawOval(screen.x - 9, screen.y - 9, 18, 18);
+        }
 
-		// lbl.setText("gpsd: "+status+" Speed: " + speed +
-		// " Course: "+course);
-		// lbl.setBounds(0, 0, mvs.width-10, mvs.height-10);
-		// Graphics sub = g.create(mvs.x+5, mvs.y+5, mvs.width-10,
-		// mvs.height-10);
-		// lbl.paint(sub);
+        // lbl.setText("gpsd: "+status+" Speed: " + speed +
+        // " Course: "+course);
+        // lbl.setBounds(0, 0, mvs.width-10, mvs.height-10);
+        // Graphics sub = g.create(mvs.x+5, mvs.y+5, mvs.width-10,
+        // mvs.height-10);
+        // lbl.paint(sub);
 
-		// if(status != null) {
-		// g.setColor(Color.WHITE);
-		// g.drawString("gpsd: " + status, 5, mv.getBounds().height - 15);
-		// // lower left corner
-		// }
-	}
+        // if(status != null) {
+        // g.setColor(Color.WHITE);
+        // g.drawString("gpsd: " + status, 5, mv.getBounds().height - 15);
+        // // lower left corner
+        // }
+    }
 
-	/* (non-Javadoc)
-	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
-	 */
-	public void propertyChange(PropertyChangeEvent evt) {
-		if (!isVisible()) {
-			return;
-		}
-		if ("gpsdata".equals(evt.getPropertyName())) {
-			LiveGpsData data = (LiveGpsData) evt.getNewValue();
-			if (data.isFix()) {
-				setCurrentPosition(data.getLatitude(), data.getLongitude());
-				if (!Float.isNaN(data.getSpeed())) {
-					setSpeed(data.getSpeed());
-				}
-				if (!Float.isNaN(data.getCourse())) {
-					setCourse(data.getCourse());
-				}
-				if (!autocenter && allowRedraw()) {
-					Main.map.repaint();
-				}
-			}
-		}
-	}
+    /* (non-Javadoc)
+     * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+     */
+    public void propertyChange(PropertyChangeEvent evt) {
+        if (!isVisible()) {
+            return;
+        }
+        if ("gpsdata".equals(evt.getPropertyName())) {
+            LiveGpsData data = (LiveGpsData) evt.getNewValue();
+            if (data.isFix()) {
+                setCurrentPosition(data.getLatitude(), data.getLongitude());
+                if (!Float.isNaN(data.getSpeed())) {
+                    setSpeed(data.getSpeed());
+                }
+                if (!Float.isNaN(data.getCourse())) {
+                    setCourse(data.getCourse());
+                }
+                if (!autocenter && allowRedraw()) {
+                    Main.map.repaint();
+                }
+            }
+        }
+    }
 
-	/**
-	 * @param suppressor the suppressor to set
-	 */
-	public void setSuppressor(ILiveGpsSuppressor suppressor) {
-		this.suppressor = suppressor;
-	}
+    /**
+     * @param suppressor the suppressor to set
+     */
+    public void setSuppressor(ILiveGpsSuppressor suppressor) {
+        this.suppressor = suppressor;
+    }
 
-	/**
-	 * @return the suppressor
-	 */
-	public ILiveGpsSuppressor getSuppressor() {
-		return suppressor;
-	}
+    /**
+     * @return the suppressor
+     */
+    public ILiveGpsSuppressor getSuppressor() {
+        return suppressor;
+    }
 
-	/**
-	 * Check, if a redraw is currently allowed.
-	 *
-	 * @return true, if a redraw is permitted, false, if a re-draw
-	 * should be suppressed.
-	 */
-	private boolean allowRedraw() {
-		if (this.suppressor != null) {
-			return this.suppressor.isAllowUpdate();
-		} else {
-			return true;
-		}
-	}
+    /**
+     * Check, if a redraw is currently allowed.
+     *
+     * @return true, if a redraw is permitted, false, if a re-draw
+     * should be suppressed.
+     */
+    private boolean allowRedraw() {
+        if (this.suppressor != null) {
+            return this.suppressor.isAllowUpdate();
+        } else {
+            return true;
+        }
+    }
 }
Index: applications/editors/josm/plugins/livegps/src/livegps/LiveGpsPlugin.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/livegps/LiveGpsPlugin.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/livegps/LiveGpsPlugin.java	(revision 23191)
@@ -28,238 +28,238 @@
 
 public class LiveGpsPlugin extends Plugin implements LayerChangeListener {
-	private LiveGpsAcquirer acquirer = null;
-	private Thread acquirerThread = null;
-	private JMenu lgpsmenu;
-	private JCheckBoxMenuItem lgpscapture;
-	private JCheckBoxMenuItem lgpsautocenter;
-	private LiveGpsDialog lgpsdialog;
-	List<PropertyChangeListener> listenerQueue;
-
-	private GpxData data = new GpxData();
-	private LiveGpsLayer lgpslayer = null;
-
-	/**
-	 * The LiveGpsSuppressor is queried, if an event shall be suppressed.
-	 */
-	private LiveGpsSuppressor suppressor;
-
-	/**
-	 * separate thread, where the LiveGpsSuppressor executes.
-	 */
-	private Thread suppressorThread;
-
-	public class CaptureAction extends JosmAction {
-		public CaptureAction() {
-			super(
-					tr("Capture GPS Track"),
-					"capturemenu",
-					tr("Connect to gpsd server and show current position in LiveGPS layer."),
-					Shortcut.registerShortcut("menu:livegps:capture", tr(
-							"Menu: {0}", tr("Capture GPS Track")),
-							KeyEvent.VK_R, Shortcut.GROUP_MENU), true);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			enableTracking(lgpscapture.isSelected());
-		}
-	}
-
-	public class CenterAction extends JosmAction {
-		public CenterAction() {
-			super(tr("Center Once"), "centermenu",
-					tr("Center the LiveGPS layer to current position."),
-					Shortcut.registerShortcut("edit:centergps", tr("Edit: {0}",
-							tr("Center Once")), KeyEvent.VK_HOME,
-							Shortcut.GROUP_EDIT), true);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			if (lgpslayer != null) {
-				lgpslayer.center();
-			}
-		}
-	}
-
-	public class AutoCenterAction extends JosmAction {
-		public AutoCenterAction() {
-			super(
-					tr("Auto-Center"),
-					"autocentermenu",
-					tr("Continuously center the LiveGPS layer to current position."),
-					Shortcut.registerShortcut("menu:livegps:autocenter", tr(
-							"Menu: {0}", tr("Capture GPS Track")),
-							KeyEvent.VK_HOME, Shortcut.GROUP_MENU), true);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			if (lgpslayer != null) {
-				setAutoCenter(lgpsautocenter.isSelected());
-			}
-		}
-	}
-
-	public void activeLayerChange(Layer oldLayer, Layer newLayer) {
-	}
-
-	public void layerAdded(Layer newLayer) {
-	}
-
-	public void layerRemoved(Layer oldLayer) {
-		if (oldLayer == lgpslayer) {
-			enableTracking(false);
-			lgpscapture.setSelected(false);
-			removePropertyChangeListener(lgpslayer);
-			MapView.removeLayerChangeListener(this);
-			lgpslayer = null;
-		}
-	}
-
-	public LiveGpsPlugin(PluginInformation info) {
-		super(info);
-		MainMenu menu = Main.main.menu;
-		lgpsmenu = menu.addMenu(marktr("LiveGPS"), KeyEvent.VK_G,
-				menu.defaultMenuPos, ht("/Plugin/LiveGPS"));
-
-		JosmAction captureAction = new CaptureAction();
-		lgpscapture = new JCheckBoxMenuItem(captureAction);
-		lgpsmenu.add(lgpscapture);
-		lgpscapture.setAccelerator(captureAction.getShortcut().getKeyStroke());
-
-		JosmAction centerAction = new CenterAction();
-		JMenuItem centerMenu = new JMenuItem(centerAction);
-		lgpsmenu.add(centerMenu);
-		centerMenu.setAccelerator(centerAction.getShortcut().getKeyStroke());
-
-		JosmAction autoCenterAction = new AutoCenterAction();
-		lgpsautocenter = new JCheckBoxMenuItem(autoCenterAction);
-		lgpsmenu.add(lgpsautocenter);
-		lgpsautocenter.setAccelerator(autoCenterAction.getShortcut()
-				.getKeyStroke());
-	}
-
-	/**
-	 * Set to <code>true</code> if the current position should always be in the center of the map.
-	 * @param autoCenter if <code>true</code> the map is always centered.
-	 */
-	public void setAutoCenter(boolean autoCenter) {
-		lgpsautocenter.setSelected(autoCenter); // just in case this method was
-		// not called from the menu
-		if (lgpslayer != null) {
-			lgpslayer.setAutoCenter(autoCenter);
-			if (autoCenter)
-				lgpslayer.center();
-		}
-	}
-
-	/**
-	 * Returns <code>true</code> if autocenter is selected.
-	 * @return <code>true</code> if autocenter is selected.
-	 */
-	public boolean isAutoCenter() {
-		return lgpsautocenter.isSelected();
-	}
-
-	/**
-	 * Enable or disable gps tracking
-	 * @param enable if <code>true</code> tracking is started.
-	 */
-	public void enableTracking(boolean enable) {
-		if ((acquirer != null) && (!enable)) {
-			acquirer.shutdown();
-			acquirerThread = null;
-
-			// also stop the suppressor
-			if (suppressor != null) {
-				suppressor.shutdown();
-				suppressorThread = null;
-				if (lgpslayer != null) {
-					lgpslayer.setSuppressor(null);
-				}
-			}
-		} else if (enable) {
-			// also start the suppressor
-			if (suppressor == null) {
-				suppressor = new LiveGpsSuppressor();
-			}
-			if (suppressorThread == null) {
-				suppressorThread = new Thread(suppressor);
-				suppressorThread.start();
-			}
-
-			if (acquirer == null) {
-				acquirer = new LiveGpsAcquirer();
-				if (lgpslayer == null) {
-					lgpslayer = new LiveGpsLayer(data);
-					Main.main.addLayer(lgpslayer);
-					MapView.addLayerChangeListener(this);
-					lgpslayer.setAutoCenter(isAutoCenter());
-				}
-				// connect layer with acquirer:
-				addPropertyChangeListener(lgpslayer);
-
-				// connect layer with suppressor:
-				lgpslayer.setSuppressor(suppressor);
-				// add all listeners that were added before the acquirer
-				// existed:
-				if (listenerQueue != null) {
-					for (PropertyChangeListener listener : listenerQueue) {
-						addPropertyChangeListener(listener);
-					}
-					listenerQueue.clear();
-				}
-			}
-			if (acquirerThread == null) {
-				acquirerThread = new Thread(acquirer);
-				acquirerThread.start();
-			}
-
-		}
-	}
-
-	/**
-	 * Add a listener for gps events.
-	 * @param listener the listener.
-	 */
-	public void addPropertyChangeListener(PropertyChangeListener listener) {
-		if (acquirer != null) {
-			acquirer.addPropertyChangeListener(listener);
-		} else {
-			if (listenerQueue == null) {
-				listenerQueue = new ArrayList<PropertyChangeListener>();
-			}
-			listenerQueue.add(listener);
-		}
-	}
-
-	/**
-	 * Remove a listener for gps events.
-	 * @param listener the listener.
-	 */
-	public void removePropertyChangeListener(PropertyChangeListener listener) {
-		if (acquirer != null)
-			acquirer.removePropertyChangeListener(listener);
-		else if (listenerQueue != null && listenerQueue.contains(listener))
-			listenerQueue.remove(listener);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.openstreetmap.josm.plugins.Plugin#mapFrameInitialized(org.openstreetmap.josm.gui.MapFrame, org.openstreetmap.josm.gui.MapFrame)
-	 */
-	@Override
-	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-		if (newFrame != null) {
-			// add dialog
-			newFrame.addToggleDialog(lgpsdialog = new LiveGpsDialog(newFrame));
-			// connect listeners with acquirer:
-			addPropertyChangeListener(lgpsdialog);
-		}
-	}
-
-	/**
-	 * @return the lgpsmenu
-	 */
-	public JMenu getLgpsMenu() {
-		return this.lgpsmenu;
-	}
+    private LiveGpsAcquirer acquirer = null;
+    private Thread acquirerThread = null;
+    private JMenu lgpsmenu;
+    private JCheckBoxMenuItem lgpscapture;
+    private JCheckBoxMenuItem lgpsautocenter;
+    private LiveGpsDialog lgpsdialog;
+    List<PropertyChangeListener> listenerQueue;
+
+    private GpxData data = new GpxData();
+    private LiveGpsLayer lgpslayer = null;
+
+    /**
+     * The LiveGpsSuppressor is queried, if an event shall be suppressed.
+     */
+    private LiveGpsSuppressor suppressor;
+
+    /**
+     * separate thread, where the LiveGpsSuppressor executes.
+     */
+    private Thread suppressorThread;
+
+    public class CaptureAction extends JosmAction {
+        public CaptureAction() {
+            super(
+                    tr("Capture GPS Track"),
+                    "capturemenu",
+                    tr("Connect to gpsd server and show current position in LiveGPS layer."),
+                    Shortcut.registerShortcut("menu:livegps:capture", tr(
+                            "Menu: {0}", tr("Capture GPS Track")),
+                            KeyEvent.VK_R, Shortcut.GROUP_MENU), true);
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            enableTracking(lgpscapture.isSelected());
+        }
+    }
+
+    public class CenterAction extends JosmAction {
+        public CenterAction() {
+            super(tr("Center Once"), "centermenu",
+                    tr("Center the LiveGPS layer to current position."),
+                    Shortcut.registerShortcut("edit:centergps", tr("Edit: {0}",
+                            tr("Center Once")), KeyEvent.VK_HOME,
+                            Shortcut.GROUP_EDIT), true);
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            if (lgpslayer != null) {
+                lgpslayer.center();
+            }
+        }
+    }
+
+    public class AutoCenterAction extends JosmAction {
+        public AutoCenterAction() {
+            super(
+                    tr("Auto-Center"),
+                    "autocentermenu",
+                    tr("Continuously center the LiveGPS layer to current position."),
+                    Shortcut.registerShortcut("menu:livegps:autocenter", tr(
+                            "Menu: {0}", tr("Capture GPS Track")),
+                            KeyEvent.VK_HOME, Shortcut.GROUP_MENU), true);
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            if (lgpslayer != null) {
+                setAutoCenter(lgpsautocenter.isSelected());
+            }
+        }
+    }
+
+    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
+    }
+
+    public void layerAdded(Layer newLayer) {
+    }
+
+    public void layerRemoved(Layer oldLayer) {
+        if (oldLayer == lgpslayer) {
+            enableTracking(false);
+            lgpscapture.setSelected(false);
+            removePropertyChangeListener(lgpslayer);
+            MapView.removeLayerChangeListener(this);
+            lgpslayer = null;
+        }
+    }
+
+    public LiveGpsPlugin(PluginInformation info) {
+        super(info);
+        MainMenu menu = Main.main.menu;
+        lgpsmenu = menu.addMenu(marktr("LiveGPS"), KeyEvent.VK_G,
+                menu.defaultMenuPos, ht("/Plugin/LiveGPS"));
+
+        JosmAction captureAction = new CaptureAction();
+        lgpscapture = new JCheckBoxMenuItem(captureAction);
+        lgpsmenu.add(lgpscapture);
+        lgpscapture.setAccelerator(captureAction.getShortcut().getKeyStroke());
+
+        JosmAction centerAction = new CenterAction();
+        JMenuItem centerMenu = new JMenuItem(centerAction);
+        lgpsmenu.add(centerMenu);
+        centerMenu.setAccelerator(centerAction.getShortcut().getKeyStroke());
+
+        JosmAction autoCenterAction = new AutoCenterAction();
+        lgpsautocenter = new JCheckBoxMenuItem(autoCenterAction);
+        lgpsmenu.add(lgpsautocenter);
+        lgpsautocenter.setAccelerator(autoCenterAction.getShortcut()
+                .getKeyStroke());
+    }
+
+    /**
+     * Set to <code>true</code> if the current position should always be in the center of the map.
+     * @param autoCenter if <code>true</code> the map is always centered.
+     */
+    public void setAutoCenter(boolean autoCenter) {
+        lgpsautocenter.setSelected(autoCenter); // just in case this method was
+        // not called from the menu
+        if (lgpslayer != null) {
+            lgpslayer.setAutoCenter(autoCenter);
+            if (autoCenter)
+                lgpslayer.center();
+        }
+    }
+
+    /**
+     * Returns <code>true</code> if autocenter is selected.
+     * @return <code>true</code> if autocenter is selected.
+     */
+    public boolean isAutoCenter() {
+        return lgpsautocenter.isSelected();
+    }
+
+    /**
+     * Enable or disable gps tracking
+     * @param enable if <code>true</code> tracking is started.
+     */
+    public void enableTracking(boolean enable) {
+        if ((acquirer != null) && (!enable)) {
+            acquirer.shutdown();
+            acquirerThread = null;
+
+            // also stop the suppressor
+            if (suppressor != null) {
+                suppressor.shutdown();
+                suppressorThread = null;
+                if (lgpslayer != null) {
+                    lgpslayer.setSuppressor(null);
+                }
+            }
+        } else if (enable) {
+            // also start the suppressor
+            if (suppressor == null) {
+                suppressor = new LiveGpsSuppressor();
+            }
+            if (suppressorThread == null) {
+                suppressorThread = new Thread(suppressor);
+                suppressorThread.start();
+            }
+
+            if (acquirer == null) {
+                acquirer = new LiveGpsAcquirer();
+                if (lgpslayer == null) {
+                    lgpslayer = new LiveGpsLayer(data);
+                    Main.main.addLayer(lgpslayer);
+                    MapView.addLayerChangeListener(this);
+                    lgpslayer.setAutoCenter(isAutoCenter());
+                }
+                // connect layer with acquirer:
+                addPropertyChangeListener(lgpslayer);
+
+                // connect layer with suppressor:
+                lgpslayer.setSuppressor(suppressor);
+                // add all listeners that were added before the acquirer
+                // existed:
+                if (listenerQueue != null) {
+                    for (PropertyChangeListener listener : listenerQueue) {
+                        addPropertyChangeListener(listener);
+                    }
+                    listenerQueue.clear();
+                }
+            }
+            if (acquirerThread == null) {
+                acquirerThread = new Thread(acquirer);
+                acquirerThread.start();
+            }
+
+        }
+    }
+
+    /**
+     * Add a listener for gps events.
+     * @param listener the listener.
+     */
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        if (acquirer != null) {
+            acquirer.addPropertyChangeListener(listener);
+        } else {
+            if (listenerQueue == null) {
+                listenerQueue = new ArrayList<PropertyChangeListener>();
+            }
+            listenerQueue.add(listener);
+        }
+    }
+
+    /**
+     * Remove a listener for gps events.
+     * @param listener the listener.
+     */
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        if (acquirer != null)
+            acquirer.removePropertyChangeListener(listener);
+        else if (listenerQueue != null && listenerQueue.contains(listener))
+            listenerQueue.remove(listener);
+    }
+
+    /* (non-Javadoc)
+     * @see org.openstreetmap.josm.plugins.Plugin#mapFrameInitialized(org.openstreetmap.josm.gui.MapFrame, org.openstreetmap.josm.gui.MapFrame)
+     */
+    @Override
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+        if (newFrame != null) {
+            // add dialog
+            newFrame.addToggleDialog(lgpsdialog = new LiveGpsDialog(newFrame));
+            // connect listeners with acquirer:
+            addPropertyChangeListener(lgpsdialog);
+        }
+    }
+
+    /**
+     * @return the lgpsmenu
+     */
+    public JMenu getLgpsMenu() {
+        return this.lgpsmenu;
+    }
 
 }
Index: applications/editors/josm/plugins/livegps/src/livegps/LiveGpsSuppressor.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/livegps/LiveGpsSuppressor.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/livegps/LiveGpsSuppressor.java	(revision 23191)
@@ -18,119 +18,119 @@
 public class LiveGpsSuppressor implements Runnable, ILiveGpsSuppressor {
 
-	/**
-	 * Default sleep time is 5 seconds.
-	 */
-	private static final int DEFAULT_SLEEP_TIME = 5;
+    /**
+     * Default sleep time is 5 seconds.
+     */
+    private static final int DEFAULT_SLEEP_TIME = 5;
 
-	/**
-	 * The currently used sleepTime.
-	 */
-	private int sleepTime = DEFAULT_SLEEP_TIME;
+    /**
+     * The currently used sleepTime.
+     */
+    private int sleepTime = DEFAULT_SLEEP_TIME;
 
-	/**
-	 * The flag allowUpdate is enabled once during the sleepTime.
-	 */
-	private boolean allowUpdate = false;
+    /**
+     * The flag allowUpdate is enabled once during the sleepTime.
+     */
+    private boolean allowUpdate = false;
 
-	/**
-	 * Controls if this thread is still in used.
-	 */
-	private boolean shutdownFlag = false;
+    /**
+     * Controls if this thread is still in used.
+     */
+    private boolean shutdownFlag = false;
 
-	/**
-	 * Run thread enables the allowUpdate flag once during its cycle.
-	 * @see java.lang.Runnable#run()
-	 */
-	public void run() {
-		initSleepTime();
+    /**
+     * Run thread enables the allowUpdate flag once during its cycle.
+     * @see java.lang.Runnable#run()
+     */
+    public void run() {
+        initSleepTime();
 
-		shutdownFlag = false;
-		// stop the thread, when explicitely shut down or when disabled by
-		// config setting
-		while (!shutdownFlag && isEnabled()) {
-			setAllowUpdate(true);
+        shutdownFlag = false;
+        // stop the thread, when explicitely shut down or when disabled by
+        // config setting
+        while (!shutdownFlag && isEnabled()) {
+            setAllowUpdate(true);
 
-			try {
-				Thread.sleep(getSleepTime());
-			} catch (InterruptedException e) {
-				// TODO I never knew, how to handle this??? Probably just carry
-				// on
-			}
-		}
+            try {
+                Thread.sleep(getSleepTime());
+            } catch (InterruptedException e) {
+                // TODO I never knew, how to handle this??? Probably just carry
+                // on
+            }
+        }
 
-	}
+    }
 
-	/**
-	 * Retrieve the sleepTime from the configuration.
-	 * If no such configuration key exists, it will be initialized here.
-	 */
-	private void initSleepTime() {
-		// fetch it from the user setting, or use the default value.
-		int sleepSeconds = 0;
-		sleepSeconds = Main.pref.getInteger("livegps.refreshinterval",
-				DEFAULT_SLEEP_TIME);
-		// creates the setting, if none present.
-		Main.pref.putInteger("livegps.refreshinterval", sleepSeconds);
+    /**
+     * Retrieve the sleepTime from the configuration.
+     * If no such configuration key exists, it will be initialized here.
+     */
+    private void initSleepTime() {
+        // fetch it from the user setting, or use the default value.
+        int sleepSeconds = 0;
+        sleepSeconds = Main.pref.getInteger("livegps.refreshinterval",
+                DEFAULT_SLEEP_TIME);
+        // creates the setting, if none present.
+        Main.pref.putInteger("livegps.refreshinterval", sleepSeconds);
 
-		// convert seconds into milliseconds internally.
-		this.sleepTime = sleepSeconds * 1000;
-	}
+        // convert seconds into milliseconds internally.
+        this.sleepTime = sleepSeconds * 1000;
+    }
 
-	/**
-	 * Set the allowUpdate flag. May only privately accessible!
-	 * @param allowUpdate the allowUpdate to set
-	 */
-	private synchronized void setAllowUpdate(boolean allowUpdate) {
-		this.allowUpdate = allowUpdate;
-	}
+    /**
+     * Set the allowUpdate flag. May only privately accessible!
+     * @param allowUpdate the allowUpdate to set
+     */
+    private synchronized void setAllowUpdate(boolean allowUpdate) {
+        this.allowUpdate = allowUpdate;
+    }
 
-	/**
-	 * Query, if an update is currently allowed.
-	 * When it is allowed, it will disable the allowUpdate flag as a side effect.
-	 * (this means, one thread got to issue an update event)
-	 *
-	 * @return true, if an update is currently allowed; false, if the update shall be suppressed.
-	 * @see livegps.ILiveGpsSuppressor#isAllowUpdate()
-	 */
-	public synchronized boolean isAllowUpdate() {
+    /**
+     * Query, if an update is currently allowed.
+     * When it is allowed, it will disable the allowUpdate flag as a side effect.
+     * (this means, one thread got to issue an update event)
+     *
+     * @return true, if an update is currently allowed; false, if the update shall be suppressed.
+     * @see livegps.ILiveGpsSuppressor#isAllowUpdate()
+     */
+    public synchronized boolean isAllowUpdate() {
 
-		// if disabled, always permit a re-draw.
-		if (!isEnabled()) {
-			return true;
-		} else {
+        // if disabled, always permit a re-draw.
+        if (!isEnabled()) {
+            return true;
+        } else {
 
-			if (allowUpdate) {
-				allowUpdate = false;
-				return true;
-			} else {
-				return false;
-			}
-		}
-	}
+            if (allowUpdate) {
+                allowUpdate = false;
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
 
-	/**
-	 * A value below 1 disables this feature.
-	 * This ensures that a small value does not run this thread
-	 * in a tight loop.
-	 * 
-	 * @return true, if suppressing is enabled
-	 */
-	private boolean isEnabled() {
-		return this.sleepTime > 0;
-	}
+    /**
+     * A value below 1 disables this feature.
+     * This ensures that a small value does not run this thread
+     * in a tight loop.
+     *
+     * @return true, if suppressing is enabled
+     */
+    private boolean isEnabled() {
+        return this.sleepTime > 0;
+    }
 
-	/**
-	 * Shut this thread down.
-	 */
-	public void shutdown() {
-		shutdownFlag = true;
-	}
+    /**
+     * Shut this thread down.
+     */
+    public void shutdown() {
+        shutdownFlag = true;
+    }
 
-	/**
-	 * @return the defaultSleepTime
-	 */
-	private int getSleepTime() {
-		return this.sleepTime;
-	}
+    /**
+     * @return the defaultSleepTime
+     */
+    private int getSleepTime() {
+        return this.sleepTime;
+    }
 
 }
Index: applications/editors/josm/plugins/livegps/src/livegps/SingleSegmentGpxTrack.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/livegps/SingleSegmentGpxTrack.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/livegps/SingleSegmentGpxTrack.java	(revision 23191)
@@ -11,33 +11,33 @@
 public class SingleSegmentGpxTrack implements GpxTrack {
 
-	private final Map<String, Object> attributes;
-	private final GpxTrackSegment trackSegment;
+    private final Map<String, Object> attributes;
+    private final GpxTrackSegment trackSegment;
 
-	public SingleSegmentGpxTrack(GpxTrackSegment trackSegment, Map<String, Object> attributes) {
-		this.attributes = Collections.unmodifiableMap(attributes);
-		this.trackSegment = trackSegment;
-	}
+    public SingleSegmentGpxTrack(GpxTrackSegment trackSegment, Map<String, Object> attributes) {
+        this.attributes = Collections.unmodifiableMap(attributes);
+        this.trackSegment = trackSegment;
+    }
 
 
-	public Map<String, Object> getAttributes() {
-		return attributes;
-	}
+    public Map<String, Object> getAttributes() {
+        return attributes;
+    }
 
-	public Bounds getBounds() {
-		return trackSegment.getBounds();
-	}
+    public Bounds getBounds() {
+        return trackSegment.getBounds();
+    }
 
-	public Collection<GpxTrackSegment> getSegments() {
-		return Collections.singleton(trackSegment);
-	}
+    public Collection<GpxTrackSegment> getSegments() {
+        return Collections.singleton(trackSegment);
+    }
 
-	public double length() {
-		return trackSegment.length();
-	}
+    public double length() {
+        return trackSegment.length();
+    }
 
-	@Override
-	public int getUpdateCount() {
-		return trackSegment.getUpdateCount();
-	}
+    @Override
+    public int getUpdateCount() {
+        return trackSegment.getUpdateCount();
+    }
 
 }
Index: applications/editors/josm/plugins/livegps/src/org/json/JSONArray.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/org/json/JSONArray.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/org/json/JSONArray.java	(revision 23191)
@@ -74,5 +74,5 @@
  * <li>Values can be separated by <code>;</code> <small>(semicolon)</small> as
  *     well as by <code>,</code> <small>(comma)</small>.</li>
- * <li>Numbers may have the 
+ * <li>Numbers may have the
  *     <code>0x-</code> <small>(hex)</small> prefix.</li>
  * </ul>
@@ -164,15 +164,15 @@
      */
     public JSONArray(Collection collection) {
-		this.myArrayList = new ArrayList();
-		if (collection != null) {
-			Iterator iter = collection.iterator();
-			while (iter.hasNext()) {
-			    Object o = iter.next();
-                this.myArrayList.add(JSONObject.wrap(o));  
-			}
-		}
-    }
-
-    
+        this.myArrayList = new ArrayList();
+        if (collection != null) {
+            Iterator iter = collection.iterator();
+            while (iter.hasNext()) {
+                Object o = iter.next();
+                this.myArrayList.add(JSONObject.wrap(o));
+            }
+        }
+    }
+
+
     /**
      * Construct a JSONArray from an array
@@ -192,5 +192,5 @@
     }
 
-     
+
     /**
      * Get the object value associated with an index.
@@ -765,6 +765,6 @@
         return this;
     }
-    
-    
+
+
     /**
      * Remove an index and close the hole.
@@ -774,5 +774,5 @@
      */
     public Object remove(int index) {
-    	Object o = opt(index);
+        Object o = opt(index);
         this.myArrayList.remove(index);
         return o;
Index: applications/editors/josm/plugins/livegps/src/org/json/JSONException.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/org/json/JSONException.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/org/json/JSONException.java	(revision 23191)
@@ -8,8 +8,8 @@
 public class JSONException extends Exception {
     /**
-	 * 
-	 */
-	private static final long serialVersionUID = 0;
-	private Throwable cause;
+     * 
+     */
+    private static final long serialVersionUID = 0;
+    private Throwable cause;
 
     /**
Index: applications/editors/josm/plugins/livegps/src/org/json/JSONObject.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/org/json/JSONObject.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/org/json/JSONObject.java	(revision 23191)
@@ -155,5 +155,5 @@
      * @param jo A JSONObject.
      * @param names An array of strings.
-     * @throws JSONException 
+     * @throws JSONException
      * @exception JSONException If a value is a non-finite number or if a name is duplicated.
      */
@@ -161,8 +161,8 @@
         this();
         for (int i = 0; i < names.length; i += 1) {
-        	try {
-        		putOnce(names[i], jo.opt(names[i]));
-        	} catch (Exception ignore) {
-        	}
+            try {
+                putOnce(names[i], jo.opt(names[i]));
+            } catch (Exception ignore) {
+            }
         }
     }
@@ -235,5 +235,5 @@
      * @param map A map object that can be used to initialize the contents of
      *  the JSONObject.
-     * @throws JSONException 
+     * @throws JSONException
      */
     public JSONObject(Map map) {
@@ -455,5 +455,5 @@
 
     /**
-     * Get the int value associated with a key. 
+     * Get the int value associated with a key.
      *
      * @param key   A key string.
@@ -512,5 +512,5 @@
 
     /**
-     * Get the long value associated with a key. 
+     * Get the long value associated with a key.
      *
      * @param key   A key string.
@@ -596,6 +596,6 @@
         return this.map.containsKey(key);
     }
-    
-    
+
+
     /**
      * Increment a property of a JSONObject. If there is no such property,
@@ -608,21 +608,21 @@
      */
     public JSONObject increment(String key) throws JSONException {
-    	Object value = opt(key);
-    	if (value == null) {
-    		put(key, 1);
-    	} else {
-    		if (value instanceof Integer) {
-    			put(key, ((Integer)value).intValue() + 1);
-    		} else if (value instanceof Long) {
-    			put(key, ((Long)value).longValue() + 1);    			
-    		} else if (value instanceof Double) {
-	    		put(key, ((Double)value).doubleValue() + 1);    			
-    		} else if (value instanceof Float) {
-	    		put(key, ((Float)value).floatValue() + 1);    			
-		    } else {
-		    	throw new JSONException("Unable to increment [" + key + "].");
-		    }
-	    }
-    	return this;
+        Object value = opt(key);
+        if (value == null) {
+            put(key, 1);
+        } else {
+            if (value instanceof Integer) {
+                put(key, ((Integer)value).intValue() + 1);
+            } else if (value instanceof Long) {
+                put(key, ((Long)value).longValue() + 1);
+            } else if (value instanceof Double) {
+                put(key, ((Double)value).doubleValue() + 1);
+            } else if (value instanceof Float) {
+                put(key, ((Float)value).floatValue() + 1);
+            } else {
+                throw new JSONException("Unable to increment [" + key + "].");
+            }
+        }
+        return this;
     }
 
@@ -903,5 +903,5 @@
         Class klass = bean.getClass();
 
-// If klass is a System class then set includeSuperClass to false. 
+// If klass is a System class then set includeSuperClass to false.
 
         boolean includeSuperClass = klass.getClassLoader() != null;
@@ -916,10 +916,10 @@
                     String key = "";
                     if (name.startsWith("get")) {
-                    	if (name.equals("getClass") || 
-                    			name.equals("getDeclaringClass")) {
-                    		key = "";
-                    	} else {
-                    		key = name.substring(3);
-                    	}
+                        if (name.equals("getClass") ||
+                                name.equals("getDeclaringClass")) {
+                            key = "";
+                        } else {
+                            key = name.substring(3);
+                        }
                     } else if (name.startsWith("is")) {
                         key = name.substring(2);
@@ -1199,6 +1199,6 @@
 
         /*
-         * If it might be a number, try converting it. 
-         * We support the non-standard 0x- convention. 
+         * If it might be a number, try converting it.
+         * We support the non-standard 0x- convention.
          * If a number cannot be produced, then the value will just
          * be a string. Note that the 0x-, plus, and implied string
@@ -1217,6 +1217,6 @@
             }
             try {
-                if (s.indexOf('.') > -1 || 
-                		s.indexOf('e') > -1 || s.indexOf('E') > -1) {
+                if (s.indexOf('.') > -1 ||
+                        s.indexOf('e') > -1 || s.indexOf('E') > -1) {
                     return Double.valueOf(s);
                 } else {
@@ -1495,9 +1495,9 @@
 
      /**
-      * Wrap an object, if necessary. If the object is null, return the NULL 
-      * object. If it is an array or collection, wrap it in a JSONArray. If 
-      * it is a map, wrap it in a JSONObject. If it is a standard property 
-      * (Double, String, et al) then it is already wrapped. Otherwise, if it 
-      * comes from one of the java packages, turn it into a string. And if 
+      * Wrap an object, if necessary. If the object is null, return the NULL
+      * object. If it is an array or collection, wrap it in a JSONArray. If
+      * it is a map, wrap it in a JSONObject. If it is a standard property
+      * (Double, String, et al) then it is already wrapped. Otherwise, if it
+      * comes from one of the java packages, turn it into a string. And if
       * it doesn't, try to wrap it in a JSONObject. If the wrapping fails,
       * then null is returned.
@@ -1511,14 +1511,14 @@
                  return NULL;
              }
-             if (object instanceof JSONObject || object instanceof JSONArray || 
-            		 NULL.equals(object)      || object instanceof JSONString || 
-            		 object instanceof Byte   || object instanceof Character ||
+             if (object instanceof JSONObject || object instanceof JSONArray ||
+                     NULL.equals(object)      || object instanceof JSONString ||
+                     object instanceof Byte   || object instanceof Character ||
                      object instanceof Short  || object instanceof Integer   ||
-                     object instanceof Long   || object instanceof Boolean   || 
+                     object instanceof Long   || object instanceof Boolean   ||
                      object instanceof Float  || object instanceof Double    ||
                      object instanceof String) {
                  return object;
              }
-             
+
              if (object instanceof Collection) {
                  return new JSONArray((Collection)object);
@@ -1533,6 +1533,6 @@
              String objectPackageName = ( objectPackage != null ? objectPackage.getName() : "" );
              if (objectPackageName.startsWith("java.") ||
-            		 objectPackageName.startsWith("javax.") ||
-            		 object.getClass().getClassLoader() == null) {
+                     objectPackageName.startsWith("javax.") ||
+                     object.getClass().getClassLoader() == null) {
                  return object.toString();
              }
@@ -1543,5 +1543,5 @@
      }
 
-     
+
      /**
       * Write the contents of the JSONObject as JSON text to a writer.
Index: applications/editors/josm/plugins/livegps/src/org/json/JSONString.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/org/json/JSONString.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/org/json/JSONString.java	(revision 23191)
@@ -9,10 +9,10 @@
  */
 public interface JSONString {
-	/**
-	 * The <code>toJSONString</code> method allows a class to produce its own JSON 
-	 * serialization. 
-	 * 
-	 * @return A strictly syntactically correct JSON text.
-	 */
-	public String toJSONString();
+    /**
+     * The <code>toJSONString</code> method allows a class to produce its own JSON 
+     * serialization. 
+     * 
+     * @return A strictly syntactically correct JSON text.
+     */
+    public String toJSONString();
 }
Index: applications/editors/josm/plugins/livegps/src/org/json/JSONTokener.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/org/json/JSONTokener.java	(revision 21622)
+++ applications/editors/josm/plugins/livegps/src/org/json/JSONTokener.java	(revision 23191)
@@ -39,10 +39,10 @@
 public class JSONTokener {
 
-    private int 	character;
-	private boolean eof;
-    private int 	index;
-    private int 	line;
-    private char 	previous;
-    private Reader 	reader;
+    private int     character;
+    private boolean eof;
+    private int     index;
+    private int     line;
+    private char    previous;
+    private Reader  reader;
     private boolean usePrevious;
 
@@ -54,6 +54,6 @@
      */
     public JSONTokener(Reader reader) {
-        this.reader = reader.markSupported() ? 
-        		reader : new BufferedReader(reader);
+        this.reader = reader.markSupported() ?
+                reader : new BufferedReader(reader);
         this.eof = false;
         this.usePrevious = false;
@@ -109,7 +109,7 @@
         return -1;
     }
-    
+
     public boolean end() {
-    	return eof && !usePrevious;    	
+        return eof && !usePrevious;
     }
 
@@ -124,5 +124,5 @@
         if (end()) {
             return false;
-        } 
+        }
         back();
         return true;
@@ -138,29 +138,29 @@
         int c;
         if (this.usePrevious) {
-        	this.usePrevious = false;
+            this.usePrevious = false;
             c = this.previous;
         } else {
-	        try {
-	            c = this.reader.read();
-	        } catch (IOException exception) {
-	            throw new JSONException(exception);
-	        }
-	
-	        if (c <= 0) { // End of stream
-	        	this.eof = true;
-	        	c = 0;
-	        } 
-        }
-    	this.index += 1;
-    	if (this.previous == '\r') {
-    		this.line += 1;
-    		this.character = c == '\n' ? 0 : 1;
-    	} else if (c == '\n') {
-    		this.line += 1;
-    		this.character = 0;
-    	} else {
-    		this.character += 1;
-    	}
-    	this.previous = (char) c;
+            try {
+                c = this.reader.read();
+            } catch (IOException exception) {
+                throw new JSONException(exception);
+            }
+
+            if (c <= 0) { // End of stream
+                this.eof = true;
+                c = 0;
+            }
+        }
+        this.index += 1;
+        if (this.previous == '\r') {
+            this.line += 1;
+            this.character = c == '\n' ? 0 : 1;
+        } else if (c == '\n') {
+            this.line += 1;
+            this.character = 0;
+        } else {
+            this.character += 1;
+        }
+        this.previous = (char) c;
         return this.previous;
     }
@@ -204,5 +204,5 @@
              buffer[pos] = next();
              if (end()) {
-                 throw syntaxError("Substring bounds error");                 
+                 throw syntaxError("Substring bounds error");
              }
              pos += 1;
@@ -273,6 +273,6 @@
                 case '\\':
                 case '/':
-                	sb.append(c);
-                	break;
+                    sb.append(c);
+                    break;
                 default:
                     throw syntaxError("Illegal escape.");
@@ -412,5 +412,5 @@
         return c;
     }
-    
+
 
     /**
