Ignore:
Timestamp:
2017-09-30T00:24:47+02:00 (7 years ago)
Author:
donvip
Message:

Edigeo: use file name for data layer name when downloading remote tar.bz2 file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/download/CadastreDownloadTask.java

    r33680 r33684  
    99import org.openstreetmap.josm.data.Bounds;
    1010import org.openstreetmap.josm.gui.MainApplication;
     11import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1112import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1213
     
    2324    @Override
    2425    public Future<?> loadUrl(boolean newLayer, String url, ProgressMonitor progressMonitor) {
    25         downloadTask = new DownloadTask(newLayer, new CadastreServerReader(url), progressMonitor);
     26        downloadTask = new InternalDownloadTask(newLayer, url, progressMonitor);
    2627        currentBounds = null;
    2728        return MainApplication.worker.submit(downloadTask);
     
    3738        return tr("Download cadastre data");
    3839    }
     40
     41    class InternalDownloadTask extends DownloadTask {
     42
     43        private final String url;
     44
     45        InternalDownloadTask(boolean newLayer, String url, ProgressMonitor progressMonitor) {
     46            super(newLayer, new CadastreServerReader(url), progressMonitor);
     47            this.url = url;
     48        }
     49
     50        @Override
     51        protected OsmDataLayer createNewLayer(String layerName) {
     52            return super.createNewLayer(layerName != null ? layerName : url.substring(url.lastIndexOf('/')+1));
     53        }
     54    }
    3955}
Note: See TracChangeset for help on using the changeset viewer.