Index: /applications/editors/josm/plugins/DirectUpload/.classpath
===================================================================
--- /applications/editors/josm/plugins/DirectUpload/.classpath	(revision 16582)
+++ /applications/editors/josm/plugins/DirectUpload/.classpath	(revision 16582)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
Index: /applications/editors/josm/plugins/DirectUpload/.project
===================================================================
--- /applications/editors/josm/plugins/DirectUpload/.project	(revision 16582)
+++ /applications/editors/josm/plugins/DirectUpload/.project	(revision 16582)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>JOSM-DirectUpload</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
Index: /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java
===================================================================
--- /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java	(revision 16581)
+++ /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java	(revision 16582)
@@ -11,14 +11,11 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
-import java.awt.Dimension;
+import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
-import java.awt.GridBagLayout;
-import java.io.BufferedOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
-import java.io.IOException;
 import java.io.OutputStream;
-import java.lang.String;
 import java.net.HttpURLConnection;
 import java.net.URL;
@@ -27,10 +24,8 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
-import java.text.DateFormat;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
-import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JLabel;
@@ -38,13 +33,14 @@
 import javax.swing.JTextField;
 
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.gpx.GpxData;
 import org.openstreetmap.josm.gui.ExtendedDialog;
 import org.openstreetmap.josm.gui.JMultilineLabel;
+import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.gui.layer.GpxLayer;
 import org.openstreetmap.josm.gui.layer.Layer;
-import org.openstreetmap.josm.gui.MapView;
-import org.openstreetmap.josm.gui.PleaseWaitRunnable;
+import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.io.GpxWriter;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.tools.Base64;
 import org.openstreetmap.josm.tools.GBC;
@@ -164,51 +160,54 @@
      * @param GpxData The GPX Data to upload
      */
-    private void upload(String description, String tags, Boolean isPublic, GpxData gpxData) throws IOException {
-        if(checkForErrors(username, password, description, gpxData))
-            return;
-
-        // Clean description/tags from disallowed chars
-        description = description.replaceAll("[&?/\\\\]"," ");
-        tags = tags.replaceAll("[&?/\\\\.,;]"," ");
-
-        // Set progress dialog to indeterminate while connecting
-        Main.pleaseWaitDlg.progress.setValue(0);
-        Main.pleaseWaitDlg.setIndeterminate(true);
-        Main.pleaseWaitDlg.currentAction.setText(tr("Connecting..."));
-
-        try {
-            // Generate data for upload
-            ByteArrayOutputStream baos  = new ByteArrayOutputStream();
-            writeGpxFile(baos, "file", gpxData);
-            writeField(baos, "description", description);
-            writeField(baos, "tags", (tags != null && tags.length() > 0) ? tags : "");
-            writeField(baos, "public", isPublic ? "1" : "0");
-            writeString(baos, "--" + BOUNDARY + "--" + LINE_END);
-
-            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-            HttpURLConnection conn = setupConnection(baos.size());
-
-            Main.pleaseWaitDlg.progress.setMaximum(baos.size());
-            Main.pleaseWaitDlg.setIndeterminate(false);
-
-            try {
-                flushToServer(bais, conn.getOutputStream());
-            } catch(Exception e) {}
-
-            if(cancelled) {
-                conn.disconnect();
-                OutputDisplay.setText(tr("Upload cancelled"));
-                buttons.get(0).setEnabled(true);
-                cancelled = false;
-            } else {
-                boolean success = finishUpConnection(conn);
-                buttons.get(0).setEnabled(!success);
-                if(success)
-                    buttons.get(1).setText(tr("Close"));
-            }
-        } catch(Exception e) {
-            OutputDisplay.setText(tr("Error while uploading"));
-            e.printStackTrace();
-        }
+    private void upload(String description, String tags, Boolean isPublic, GpxData gpxData, ProgressMonitor progressMonitor) throws IOException {
+    	progressMonitor.beginTask(null);
+    	try {
+    		if(checkForErrors(username, password, description, gpxData))
+    			return;
+
+    		// Clean description/tags from disallowed chars
+    		description = description.replaceAll("[&?/\\\\]"," ");
+    		tags = tags.replaceAll("[&?/\\\\.,;]"," ");
+
+    		// Set progress dialog to indeterminate while connecting
+    		progressMonitor.indeterminateSubTask(tr("Connecting..."));
+
+    		try {
+    			// Generate data for upload
+    			ByteArrayOutputStream baos  = new ByteArrayOutputStream();
+    			writeGpxFile(baos, "file", gpxData);
+    			writeField(baos, "description", description);
+    			writeField(baos, "tags", (tags != null && tags.length() > 0) ? tags : "");
+    			writeField(baos, "public", isPublic ? "1" : "0");
+    			writeString(baos, "--" + BOUNDARY + "--" + LINE_END);
+
+    			ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+    			HttpURLConnection conn = setupConnection(baos.size());
+
+    			progressMonitor.setTicksCount(baos.size());
+    			progressMonitor.subTask(null);
+
+    			try {
+    				flushToServer(bais, conn.getOutputStream(), progressMonitor);
+    			} catch(Exception e) {}
+
+    			if(cancelled) {
+    				conn.disconnect();
+    				OutputDisplay.setText(tr("Upload cancelled"));
+    				buttons.get(0).setEnabled(true);
+    				cancelled = false;
+    			} else {
+    				boolean success = finishUpConnection(conn);
+    				buttons.get(0).setEnabled(!success);
+    				if(success)
+    					buttons.get(1).setText(tr("Close"));
+    			}
+    		} catch(Exception e) {
+    			OutputDisplay.setText(tr("Error while uploading"));
+    			e.printStackTrace();
+    		}
+    	} finally {
+    		progressMonitor.finishTask();
+    	}
     }
 
@@ -271,5 +270,5 @@
      * @param OutputStream
      */
-    private void flushToServer(InputStream in, OutputStream out) throws Exception {
+    private void flushToServer(InputStream in, OutputStream out, ProgressMonitor progressMonitor) throws Exception {
         // Upload in 10 kB chunks
         byte[] buffer = new byte[10000];
@@ -281,6 +280,6 @@
                 cur += nread;
                 out.flush();
-                Main.pleaseWaitDlg.progress.setValue(cur);
-                Main.pleaseWaitDlg.currentAction.setText(getProgressText(cur));
+                progressMonitor.worked(nread);
+                progressMonitor.subTask(getProgressText(cur, progressMonitor));
 
                 if(cancelled)
@@ -290,5 +289,5 @@
         if(!cancelled)
             out.flush();
-        Main.pleaseWaitDlg.currentAction.setText("Waiting for server reply...");
+        progressMonitor.subTask("Waiting for server reply...");
         buffer = null;
     }
@@ -299,6 +298,6 @@
      * @return String Message
      */
-    private String getProgressText(int cur) {
-        int max = Main.pleaseWaitDlg.progress.getMaximum();
+    private String getProgressText(int cur, ProgressMonitor progressMonitor) {
+        int max = progressMonitor.getTicksCount();
         int percent = Math.round(cur * 100 / max);
         return tr("Uploading GPX track: {0}% ({1} of {2})",
@@ -380,5 +379,6 @@
                          tagsField.getText(),
                          publicCheckbox.isSelected(),
-                         ((GpxLayer)Main.map.mapView.getActiveLayer()).data
+                         ((GpxLayer)Main.map.mapView.getActiveLayer()).data,
+                         progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)
                   );
             }
