Changeset 8197 in josm
- Timestamp:
- 2015-04-15T21:11:28+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
r8193 r8197 7 7 import java.net.URL; 8 8 import java.util.Collection; 9 import java.util.LinkedHashSet; 10 import java.util.Set; 9 11 10 12 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.actions.OpenLocationAction; 11 14 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 12 15 import org.openstreetmap.josm.actions.downloadtasks.DownloadTask; … … 30 33 protected void handleRequest() throws RequestHandlerErrorException { 31 34 try { 32 if (suitableDownloadTasks != null && !suitableDownloadTasks.isEmpty()) { 33 // TODO: handle multiple suitable download tasks ? 34 suitableDownloadTasks.iterator().next().loadUrl(isLoadInNewLayer(), url.toExternalForm(), null); 35 if (Main.pref.getBoolean("remotecontrol.import.interactive", true)) { 36 // OpenLocationAction queries the user if more than one task is suitable 37 new OpenLocationAction().openUrl(isLoadInNewLayer(), url.toExternalForm()); 38 } else { 39 // Otherwise perform all tasks 40 for (DownloadTask task : suitableDownloadTasks) { 41 task.loadUrl(isLoadInNewLayer(), url.toExternalForm(), null); 42 } 35 43 } 36 44 } catch (Exception ex) { … … 68 76 // (Example with OSM-FR website that makes calls to the OSM-FR API) 69 77 // For user-friendliness, let's try to decode these OSM API calls to give a better confirmation message. 70 S tringtaskMessage= null;78 Set<String> taskMessages = new LinkedHashSet<>(); 71 79 if (suitableDownloadTasks != null && !suitableDownloadTasks.isEmpty()) { 72 // TODO: handle multiple suitable download tasks ? 73 taskMessage = suitableDownloadTasks.iterator().next().getConfirmationMessage(url); 80 for (DownloadTask task : suitableDownloadTasks) { 81 taskMessages.add(Utils.firstNonNull(task.getConfirmationMessage(url), url.toString())); 82 } 74 83 } 75 84 return tr("Remote Control has been asked to import data from the following URL:") 76 + "<br>" +(taskMessage== null ? url.toString() : taskMessage);85 + Utils.joinAsHtmlUnorderedList(taskMessages); 77 86 } 78 87
Note:
See TracChangeset
for help on using the changeset viewer.