true, "action/mergelayer", true);
putValue("help", ht("/Action/MergeLayer"));
}
protected void doMerge(List<Layer> targetLayers, final Collection<Layer> sourceLayers) {
final Layer targetLayer = askTargetLayer(targetLayers);
if (targetLayer == null)
return;
Main.worker.submit(new Runnable() {
@Override
public void run() {
boolean layerMerged = false;
for (final Layer sourceLayer: sourceLayers) {
if (sourceLayer != null && sourceLayer != targetLayer) {
if (sourceLayer instanceof OsmDataLayer && targetLayer instanceof OsmDataLayer
&& ((OsmDataLayer)sourceLayer).isUploadDiscouraged() != ((OsmDataLayer)targetLayer).isUploadDiscouraged()) {
if (warnMergingUploadDiscouragedLayers(sourceLayer, targetLayer)) {
break;
}
}
targetLayer.mergeFrom(sourceLayer);
GuiHelper.runInEDTAndWait(new Runnable() {
@Override
public void run() {
Main.main.removeLayer(sourceLayer);
}