diff -u -r orig/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
|
old
|
new
|
|
| 19 | 19 | import org.xml.sax.SAXException; |
| 20 | 20 | |
| 21 | 21 | public class DownloadGpsTask implements DownloadTask { |
| 22 | | |
| | 22 | private boolean silent=false; |
| | 23 | |
| 23 | 24 | private static class Task extends PleaseWaitRunnable { |
| 24 | 25 | private BoundingBoxDownloader reader; |
| 25 | 26 | private GpxData rawData; |
| 26 | 27 | private final boolean newLayer; |
| 27 | 28 | |
| 28 | | public Task(boolean newLayer, BoundingBoxDownloader reader) { |
| 29 | | super(tr("Downloading GPS data")); |
| | 29 | public Task(boolean newLayer, BoundingBoxDownloader reader, boolean silent) { |
| | 30 | super(tr("Downloading GPS data"), silent); |
| 30 | 31 | this.reader = reader; |
| 31 | 32 | this.newLayer = newLayer; |
| 32 | 33 | } |
| … |
… |
|
| 69 | 70 | private JCheckBox checkBox = new JCheckBox(tr("Raw GPS data")); |
| 70 | 71 | |
| 71 | 72 | public void download(DownloadAction action, double minlat, double minlon, double maxlat, double maxlon) { |
| 72 | | Task task = new Task(action.dialog.newLayer.isSelected(), new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon)); |
| | 73 | Task task = new Task(action.dialog.newLayer.isSelected(), new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon), silent); |
| 73 | 74 | Main.worker.execute(task); |
| 74 | 75 | } |
| 75 | 76 | |
| 76 | 77 | public JCheckBox getCheckBox() { |
| 77 | 78 | return checkBox; |
| 78 | 79 | } |
| | 80 | |
| | 81 | public void setSilent(boolean silent) { |
| | 82 | this.silent=silent; |
| | 83 | } |
| 79 | 84 | |
| 80 | 85 | public String getPreferencesSuffix() { |
| 81 | 86 | return "gps"; |
diff -u -r orig/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
|
old
|
new
|
|
| 29 | 29 | public class DownloadOsmTask implements DownloadTask { |
| 30 | 30 | |
| 31 | 31 | private static Bounds currentBounds; |
| | 32 | private boolean silent=false; |
| 32 | 33 | |
| 33 | 34 | private static class Task extends PleaseWaitRunnable { |
| 34 | 35 | private OsmServerReader reader; |
| 35 | 36 | private DataSet dataSet; |
| 36 | 37 | private boolean newLayer; |
| 37 | 38 | |
| 38 | | public Task(boolean newLayer, OsmServerReader reader) { |
| 39 | | super(tr("Downloading data")); |
| | 39 | public Task(boolean newLayer, OsmServerReader reader, boolean silent) { |
| | 40 | super(tr("Downloading data"), silent); |
| 40 | 41 | this.reader = reader; |
| 41 | 42 | this.newLayer = newLayer; |
| 42 | 43 | } |
| … |
… |
|
| 80 | 81 | double t = minlon; minlon = maxlon; maxlon = t; |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | | Task task = new Task(action != null && (action.dialog == null || action.dialog.newLayer.isSelected()), new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon)); |
| | 84 | Task task = new Task(action != null && (action.dialog == null || action.dialog.newLayer.isSelected()), new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon), silent); |
| 84 | 85 | currentBounds = new Bounds(new LatLon(minlat, minlon), new LatLon(maxlat, maxlon)); |
| 85 | 86 | Main.worker.execute(task); |
| 86 | 87 | } |
| 87 | 88 | |
| 88 | 89 | public void loadUrl(boolean new_layer, String url) { |
| 89 | | Task task = new Task(new_layer, new OsmServerLocationReader(url)); |
| | 90 | Task task = new Task(new_layer, new OsmServerLocationReader(url), silent); |
| 90 | 91 | Main.worker.execute(task); |
| 91 | 92 | } |
| 92 | | |
| 93 | | |
| 94 | | |
| | 93 | |
| | 94 | public void setSilent(boolean silent) { |
| | 95 | this.silent=silent; |
| | 96 | } |
| 95 | 97 | |
| 96 | 98 | public JCheckBox getCheckBox() { |
| 97 | 99 | return checkBox; |
diff -u -r orig/src/org/openstreetmap/josm/gui/download/DownloadDialog.java trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
|
old
|
new
|
|
| 44 | 44 | */ |
| 45 | 45 | void download(DownloadAction action, double minlat, double minlon, double maxlat, double maxlon); |
| 46 | 46 | void loadUrl(boolean newLayer, String url); |
| | 47 | void setSilent(boolean silent); |
| 47 | 48 | /** |
| 48 | 49 | * @return The checkbox presented to the user |
| 49 | 50 | */ |
diff -u -r orig/src/org/openstreetmap/josm/gui/layer/GpxLayer.java trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
|
old
|
new
|
|
| 877 | 877 | // downloads left, and "cancel" needs to be honoured. An error along the way |
| 878 | 878 | // should abort the whole process. |
| 879 | 879 | DownloadTask osmTask = new DownloadOsmTask(); |
| | 880 | osmTask.setSilent(true); |
| 880 | 881 | for (Rectangle2D td : toDownload) { |
| 881 | 882 | osmTask.download(null, td.getMinY(), td.getMinX(), td.getMaxY(), td.getMaxX()); |
| 882 | 883 | } |
diff -u -r orig/src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java trunk/src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java
|
old
|
new
|
|
| 29 | 29 | |
| 30 | 30 | private boolean closeDialogCalled = false; |
| 31 | 31 | private boolean cancelled = false; |
| | 32 | private boolean silent = false; |
| 32 | 33 | |
| 33 | 34 | private final String title; |
| 34 | 35 | |
| 35 | 36 | /** |
| 36 | 37 | * Create the runnable object with a given message for the user. |
| 37 | 38 | */ |
| 38 | | public PleaseWaitRunnable(String title) { |
| | 39 | public PleaseWaitRunnable(String title, boolean silent) { |
| 39 | 40 | this.title = title; |
| | 41 | this.silent = silent; |
| 40 | 42 | Main.pleaseWaitDlg.cancel.addActionListener(new ActionListener(){ |
| 41 | 43 | public void actionPerformed(ActionEvent e) { |
| 42 | 44 | if (!cancelled) { |
| … |
… |
|
| 130 | 132 | Main.pleaseWaitDlg.setVisible(false); |
| 131 | 133 | Main.pleaseWaitDlg.dispose(); |
| 132 | 134 | } |
| 133 | | if (errorMessage != null) |
| 134 | | JOptionPane.showMessageDialog(Main.parent, errorMessage); |
| | 135 | if (errorMessage != null) { |
| | 136 | if(silent) |
| | 137 | System.out.println(errorMessage); |
| | 138 | else |
| | 139 | JOptionPane.showMessageDialog(Main.parent, errorMessage); |
| | 140 | } |
| 135 | 141 | } |
| 136 | 142 | }; |