Changeset 13928 in josm for trunk/src/org


Ignore:
Timestamp:
2018-06-13T22:55:57+02:00 (6 years ago)
Author:
Don-vip
Message:

see #11000 - support layer_name in the general case

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java

    r13927 r13928  
    1111import java.util.Collections;
    1212import java.util.HashSet;
     13import java.util.Objects;
    1314import java.util.Set;
    1415import java.util.concurrent.Future;
     
    186187    public abstract static class AbstractInternalTask extends PleaseWaitRunnable {
    187188
    188         protected final boolean newLayer;
     189        protected final DownloadParams settings;
    189190        protected final boolean zoomAfterDownload;
    190191        protected DataSet dataSet;
     
    201202        public AbstractInternalTask(DownloadParams settings, String title, boolean ignoreException, boolean zoomAfterDownload) {
    202203            super(title, ignoreException);
    203             this.newLayer = settings.isNewLayer();
     204            this.settings = Objects.requireNonNull(settings);
    204205            this.zoomAfterDownload = zoomAfterDownload;
    205206        }
     
    218219                boolean zoomAfterDownload) {
    219220            super(title, progressMonitor, ignoreException);
    220             this.newLayer = settings.isNewLayer();
     221            this.settings = Objects.requireNonNull(settings);
    221222            this.zoomAfterDownload = zoomAfterDownload;
    222223        }
     
    260261
    261262        protected OsmDataLayer createNewLayer(String layerName) {
     263            if (layerName == null || layerName.isEmpty()) {
     264                layerName = settings.getLayerName();
     265            }
    262266            if (layerName == null || layerName.isEmpty()) {
    263267                layerName = OsmDataLayer.createNewName();
     
    282286        protected OsmDataLayer addNewLayerIfRequired(String newLayerName) {
    283287            long numDataLayers = getNumModifiableDataLayers();
    284             if (newLayer || numDataLayers == 0 || (numDataLayers > 1 && getEditLayer() == null)) {
     288            if (settings.isNewLayer() || numDataLayers == 0 || (numDataLayers > 1 && getEditLayer() == null)) {
    285289                // the user explicitly wants a new layer, we don't have any layer at all
    286290                // or it is not clear which layer to merge to
Note: See TracChangeset for help on using the changeset viewer.