Index: /applications/editors/josm/plugins/livegps/build.xml
===================================================================
--- /applications/editors/josm/plugins/livegps/build.xml	(revision 3072)
+++ /applications/editors/josm/plugins/livegps/build.xml	(revision 3073)
@@ -1,30 +1,57 @@
 <project name="livegps" default="dist" basedir=".">
 
-	<target name="dist" depends="compile">
-		<!-- images -->
-		<copy todir="build/images">
-			<fileset dir="images" />
-		</copy>
+  <property name="josm.build.dir" value="../../josm"/>
+  <property name="josm.home.dir" value="${user.home}/.josm"/>
+  <property name="plugin.build.dir" value="build"/>
 
-		<!-- create josm-custom.jar -->
-		<jar destfile="livegps.jar" basedir="build">
-			<manifest>
-                <attribute name="Plugin-Class" value="livegps.LiveGpsPlugin" />
-                <attribute name="Plugin-Description" value="Allow live GPS feed from a gpsd server" />
-			</manifest>
-		</jar>
-	</target>
 
-	<target name="compile" depends="init">
-		<javac srcdir="livegps" classpath="../../josm/bin/" destdir="build" />
-	</target>
+  
+  <target name="dist" depends="compile">
+    <!-- images -->
+    <copy todir="${plugin.build.dir}/images">
+      <fileset dir="images" />
+    </copy>
+      <!-- copy configuration xml files -->
+  	<!-- 
+    <copy todir="${plugin.build.dir}">
+      <fileset dir="src"> 
+        <include name="*.xml"/>
+      </fileset>
+    </copy>
+    -->
+  	
+    <!-- create plugin jar -->
+    <jar destfile="${ant.project.name}.jar" basedir="${plugin.build.dir}">
+      <manifest>
+        <attribute name="Plugin-Class" value="livegps.LiveGpsPlugin" />
+        <attribute name="Plugin-Description" value="Allow live GPS feed from a gpsd server" />
+        <attribute name="Plugin-Stage" value="50" />
+      </manifest>
+    </jar>
+  </target>
 
-	<target name="init">
-		<mkdir dir="build" />
-	</target>
+  <target name="compile" depends="init">
+    <mkdir dir="${plugin.build.dir}"/>
+    <javac srcdir="livegps" destdir="${plugin.build.dir}" debug="true" source="1.5" target="1.5">
+      <classpath>
+        <pathelement path="${josm.build.dir}/build"/>
+        <fileset dir="${josm.build.dir}/lib">
+          <include name="**/*.jar"/>
+        </fileset>
+      </classpath>
+    </javac>
+  </target>
 
-	<target name="clean">
-		<delete dir="build" />
-	</target>
+  <target name="install" depends="dist">
+    <copy file="${ant.project.name}.jar" todir="${josm.home.dir}/plugins" />
+  </target>
+
+  <target name="init">
+  	<mkdir dir="${plugin.build.dir}" />
+  </target>
+
+  <target name="clean">
+    <delete dir="${plugin.build.dir}" />
+  </target>
 
 </project>
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsData.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsData.java	(revision 3073)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsData.java	(revision 3073)
@@ -0,0 +1,171 @@
+/**
+ * 
+ */
+package livegps;
+
+import java.awt.Point;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.osm.Way;
+
+/**
+ * @author cdaller
+ *
+ */
+public class LiveGpsData {
+    private LatLon latLon;
+    private float course;
+    private float speed;
+    private boolean fix;
+    private String wayString;
+    
+    /**
+     * @param latitude
+     * @param longitude
+     * @param course
+     * @param speed
+     * @param haveFix
+     */
+    public LiveGpsData(double latitude, double longitude, float course, float speed, boolean haveFix) {
+        super();
+        this.latLon = new LatLon(latitude, longitude);
+        this.course = course;
+        this.speed = speed;
+        this.fix = haveFix;
+    }
+    /**
+     * 
+     */
+    public LiveGpsData() {
+        // TODO Auto-generated constructor stub
+    }
+    /**
+     * @return the course
+     */
+    public float getCourse() {
+        return this.course;
+    }
+    /**
+     * @param course the course to set
+     */
+    public void setCourse(float course) {
+        this.course = course;
+    }
+    /**
+     * @return the haveFix
+     */
+    public boolean isFix() {
+        return this.fix;
+    }
+    /**
+     * @param haveFix the haveFix to set
+     */
+    public void setFix(boolean haveFix) {
+        this.fix = haveFix;
+    }
+    /**
+     * @return the latitude
+     */
+    public double getLatitude() {
+        return this.latLon.lat();
+    }
+    /**
+     * @return the longitude
+     */
+    public double getLongitude() {
+        return this.latLon.lon();
+    }
+    /**
+     * @return the speed in metres per second!
+     */
+    public float getSpeed() {
+        return this.speed;
+    }
+    /**
+     * @param speed the speed to set
+     */
+    public void setSpeed(float speed) {
+        this.speed = speed;
+    }
+    
+    /**
+     * @return the latlon
+     */
+    public LatLon getLatLon() {
+        return this.latLon;
+    }
+    
+    /**
+     * @param latLon
+     */
+    public void setLatLon(LatLon latLon) {
+        this.latLon = latLon;
+    }
+    
+    public String toString() {
+        return getClass().getSimpleName() + "[fix=" + fix + ", lat=" + latLon.lat() 
+        + ", long=" + latLon.lon() + ", speed=" + speed + ", course=" + course + "]";
+        
+    }
+    
+    /**
+     * Returns the name of the way that is closest to the current coordinates or an
+     * empty string if no way is around.
+     * 
+     * @return the name of the way that is closest to the current coordinates.
+     */
+    public String getWay() {
+        if(wayString == null) {
+            EastNorth eastnorth = Main.proj.latlon2eastNorth(getLatLon()); 
+            Point xy = Main.map.mapView.getPoint(eastnorth); 
+            Way way = Main.map.mapView.getNearestWay(xy);
+            if(way != null) {
+                wayString = way.get("name") + " (" + way.get("highway") + ")";
+            } else {
+                wayString = "";
+            }
+        }
+        return wayString;
+    }
+    
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + Float.floatToIntBits(this.course);
+        result = prime * result + ((this.latLon == null) ? 0 : this.latLon.hashCode());
+        result = prime * result + Float.floatToIntBits(this.speed);
+        return result;
+    }
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        final LiveGpsData other = (LiveGpsData) obj;
+        if (Float.floatToIntBits(this.course) != Float.floatToIntBits(other.course))
+            return false;
+        if (this.latLon == null) {
+            if (other.latLon != null)
+                return false;
+        } else if (!this.latLon.equals(other.latLon))
+            return false;
+        if (Float.floatToIntBits(this.speed) != Float.floatToIntBits(other.speed))
+            return false;
+        return true;
+    }
+
+    
+    
+}
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsDialog.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsDialog.java	(revision 3073)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsDialog.java	(revision 3073)
@@ -0,0 +1,111 @@
+/**
+ * 
+ */
+package livegps;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridLayout;
+import java.awt.Point;
+import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.MapFrame;
+import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
+
+/**
+ * @author cdaller
+ *
+ */
+public class LiveGpsDialog extends ToggleDialog implements PropertyChangeListener {
+    private static final long serialVersionUID = 6183400754671501117L;
+    private JLabel statusLabel;
+    private JLabel wayLabel;
+    private JLabel latLabel;
+    private JLabel longLabel;
+    private JLabel courseLabel;
+    private JLabel speedLabel;
+    private JPanel panel;
+
+    /**
+     * @param name
+     * @param iconName
+     * @param tooltip
+     * @param shortCut
+     * @param preferredHeight
+     */
+    public LiveGpsDialog(final MapFrame mapFrame) {
+        super(tr("Live GPS"), "livegps", tr("Show GPS data."), KeyEvent.VK_G, 100);
+        panel = new JPanel();
+        panel.setLayout(new GridLayout(6,2));
+        panel.add(new JLabel(tr("Status")));
+        panel.add(statusLabel = new JLabel());
+        panel.add(new JLabel(tr("Way Info")));
+        panel.add(wayLabel = new JLabel());
+        panel.add(new JLabel(tr("Latitude")));
+        panel.add(latLabel = new JLabel());
+        panel.add(new JLabel(tr("Longitude")));
+        panel.add(longLabel = new JLabel());
+        panel.add(new JLabel(tr("Speed")));
+        panel.add(speedLabel = new JLabel());
+        panel.add(new JLabel(tr("Course")));
+        panel.add(courseLabel = new JLabel());
+        add(new JScrollPane(panel), BorderLayout.CENTER);
+    }
+    
+    /* (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()) {
+//                fixLabel.setText("fix");
+                panel.setBackground(Color.WHITE);
+                latLabel.setText(data.getLatitude() + "deg");
+                longLabel.setText(data.getLongitude() + "deg");
+                speedLabel.setText((data.getSpeed() * 3.6f) + "km/h"); // m(s to km/h
+                courseLabel.setText(data.getCourse() + "deg");
+                
+                String wayString = data.getWay();
+                if(wayString.length() == 0) {
+                    wayLabel.setText(wayString);
+                } else {
+                    wayLabel.setText("unknown");
+                }
+                
+            } else {
+//                fixLabel.setText("no fix");
+                latLabel.setText("");
+                longLabel.setText("");
+                speedLabel.setText("");
+                courseLabel.setText("");
+                panel.setBackground(Color.RED);
+            }
+        } else if ("gpsstatus".equals(evt.getPropertyName())) {
+            LiveGpsStatus status = (LiveGpsStatus) evt.getNewValue();
+            statusLabel.setText(status.getStatusMessage());
+            if(status.getStatus() != LiveGpsStatus.GpsStatus.CONNECTED) {
+                panel.setBackground(Color.RED);
+            } else {
+                panel.setBackground(Color.WHITE);                
+            }
+        }
+        
+    }
+
+
+
+}
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsLock.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsLock.java	(revision 3073)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsLock.java	(revision 3073)
@@ -0,0 +1,16 @@
+/**
+ * 
+ */
+package livegps;
+
+/**
+ * This class is only used to prevent concurrent object modification. So all classes that
+ * read or write live gps data must synchronize to this class. Especially the save action
+ * takes quite long, so concurrency problems occur.
+ * 
+ * @author cdaller
+ *
+ */
+public class LiveGpsLock {
+
+}
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsStatus.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsStatus.java	(revision 3073)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsStatus.java	(revision 3073)
@@ -0,0 +1,49 @@
+/**
+ * 
+ */
+package livegps;
+
+/**
+ * @author cdaller
+ *
+ */
+public class LiveGpsStatus {
+    public enum GpsStatus {CONNECTING, CONNECTED, DISCONNECTED, CONNECTION_FAILED};
+    private String statusMessage;
+    private GpsStatus status;
+
+    /**
+     * @param status
+     * @param statusMessage
+     */
+    public LiveGpsStatus(GpsStatus status, String statusMessage) {
+        super();
+        this.status = status;
+        this.statusMessage = statusMessage;
+    }
+/**
+     * @return the status
+     */
+    public GpsStatus getStatus() {
+        return this.status;
+    }
+    /**
+     * @param status the status to set
+     */
+    public void setStatus(GpsStatus status) {
+        this.status = status;
+    }
+    /**
+     * @return the statusMessage
+     */
+    public String getStatusMessage() {
+        return this.statusMessage;
+    }
+    /**
+     * @param statusMessage the statusMessage to set
+     */
+    public void setStatusMessage(String statusMessage) {
+        this.statusMessage = statusMessage;
+    }
+
+}
