Changeset 29718 in osm for applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap
- Timestamp:
- 2013-06-28T03:23:46+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java
r29631 r29718 39 39 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 40 40 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 41 import org.openstreetmap.josm.gui.util.GuiHelper; 41 42 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 42 43 import org.openstreetmap.josm.io.GpxWriter; … … 242 243 if (canceled) { 243 244 conn.disconnect(); 244 OutputDisplay.setText(tr("Upload canceled")); 245 buttons.get(0).setEnabled(true); 245 GuiHelper.runInEDT(new Runnable() { 246 @Override public void run() { 247 OutputDisplay.setText(tr("Upload canceled")); 248 buttons.get(0).setEnabled(true); 249 } 250 }); 246 251 canceled = false; 247 252 } 248 253 else { 249 boolean success = finishUpConnection(conn); 250 buttons.get(0).setEnabled(!success); 251 if (success) { 252 buttons.get(1).setText(tr("Close")); 254 final boolean success = finishUpConnection(conn); 255 GuiHelper.runInEDT(new Runnable() { 256 @Override public void run() { 257 buttons.get(0).setEnabled(!success); 258 if (success) { 259 buttons.get(1).setText(tr("Close")); 260 } 261 } 262 }); 263 } 264 } 265 catch (Exception e) { 266 GuiHelper.runInEDT(new Runnable() { 267 @Override public void run() { 268 OutputDisplay.setText(tr("Error while uploading")); 253 269 } 254 } 255 } 256 catch (Exception e) { 257 OutputDisplay.setText(tr("Error while uploading")); 270 }); 258 271 e.printStackTrace(); 259 272 } … … 300 313 private boolean finishUpConnection(HttpURLConnection c) throws Exception { 301 314 String returnMsg = c.getResponseMessage(); 302 boolean success = returnMsg.equals("OK");315 final boolean success = returnMsg.equals("OK"); 303 316 304 317 if (c.getResponseCode() != 200) { … … 306 319 returnMsg += "\n" + c.getHeaderField("Error"); 307 320 } 308 309 OutputDisplay.setText(success 310 ? tr("GPX upload was successful") 311 : tr("Upload failed. Server returned the following message: ") + returnMsg); 321 322 final String returnMsgEDT = returnMsg; 323 324 GuiHelper.runInEDT(new Runnable() { 325 @Override public void run() { 326 OutputDisplay.setText(success 327 ? tr("GPX upload was successful") 328 : tr("Upload failed. Server returned the following message: ") + returnMsgEDT); 329 } 330 }); 312 331 313 332 c.disconnect(); … … 385 404 errors += tr("No GPX layer selected. Cannot upload a trace."); 386 405 387 OutputDisplay.setText(errors); 406 final String errorsEDT = errors; 407 408 GuiHelper.runInEDT(new Runnable() { 409 @Override public void run() { 410 OutputDisplay.setText(errorsEDT); 411 } 412 }); 413 388 414 return errors.length() > 0; 389 415 }
Note:
See TracChangeset
for help on using the changeset viewer.