Changeset 8240 in josm
- Timestamp:
- 2015-04-20T00:15:43+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
r8203 r8240 31 31 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmChangeTask; 32 32 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmCompressedTask; 33 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmIdTask; 33 34 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 34 35 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmUrlTask; … … 68 69 addDownloadTaskClass(DownloadOsmChangeTask.class); 69 70 addDownloadTaskClass(DownloadOsmUrlTask.class); 71 addDownloadTaskClass(DownloadOsmIdTask.class); 70 72 addDownloadTaskClass(DownloadOsmCompressedTask.class); 71 73 addDownloadTaskClass(DownloadOsmChangeCompressedTask.class); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesUrlIdTask.java
r8195 r8240 17 17 public Future<?> loadUrl(boolean newLayer, String url, ProgressMonitor progressMonitor) { 18 18 final Matcher matcher = Pattern.compile(URL_ID_PATTERN).matcher(url); 19 final long id; 20 try { 21 matcher.matches(); 19 if (matcher.matches()) { 22 20 return download(newLayer, Long.parseLong(matcher.group(2)), null); 23 } catch (RuntimeException ex){21 } else { 24 22 throw new IllegalStateException("Failed to parse note id from " + url); 25 23 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeTask.java
r7937 r8240 10 10 import java.util.Map; 11 11 import java.util.concurrent.Future; 12 import java.util.regex.Matcher; 13 import java.util.regex.Pattern; 12 14 13 15 import org.openstreetmap.josm.Main; … … 32 34 import org.openstreetmap.josm.gui.history.HistoryLoadTask; 33 35 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 36 import org.openstreetmap.josm.io.OsmApi; 34 37 import org.openstreetmap.josm.io.OsmServerLocationReader; 35 38 import org.openstreetmap.josm.io.OsmServerReader; … … 42 45 public class DownloadOsmChangeTask extends DownloadOsmTask { 43 46 47 private static final String OSM_WEBSITE_PATTERN = "https?://www\\.(osm|openstreetmap)\\.org/changeset/(\\p{Digit}+).*"; 48 44 49 @Override 45 50 public String[] getPatterns() { 46 51 return new String[]{"https?://.*/api/0.6/changeset/\\p{Digit}+/download", // OSM API 0.6 changesets 52 OSM_WEBSITE_PATTERN, // OSM changesets 47 53 "https?://.*/.*\\.osc" // Remote .osc files 48 54 }; … … 61 67 62 68 @Override 63 public Future<?> loadUrl(boolean new_layer, String url, 64 ProgressMonitor progressMonitor) { 65 downloadTask = new DownloadTask(new_layer, 66 new OsmServerLocationReader(url), 67 progressMonitor); 69 public Future<?> loadUrl(boolean new_layer, String url, ProgressMonitor progressMonitor) { 70 final Matcher matcher = Pattern.compile(OSM_WEBSITE_PATTERN).matcher(url); 71 if (matcher.matches()) { 72 url = OsmApi.getOsmApi().getBaseUrl() + "changeset/" + Long.parseLong(matcher.group(2)) + "/download"; 73 } 74 downloadTask = new DownloadTask(new_layer, new OsmServerLocationReader(url), progressMonitor); 68 75 // Extract .osc filename from URL to set the new layer name 69 76 extractOsmFilename("https?://.*/(.*\\.osc)", url);
Note:
See TracChangeset
for help on using the changeset viewer.