kopia lustrzana https://github.com/JOSM/MapWithAI
Use layer to set download listeners for continuous download
Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head
rodzic
588508b73f
commit
4c15c59df5
|
@ -62,6 +62,6 @@ public final class DownloadListener implements DataSourceListener, Destroyable {
|
|||
* Destroy all download listeners for MapWithAI
|
||||
*/
|
||||
public static void destroyAll() {
|
||||
LISTENERS.forEach(DownloadListener::destroy);
|
||||
new HashSet<>(LISTENERS).forEach(DownloadListener::destroy);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ public class MapWithAIAction extends JosmAction {
|
|||
.collect(Collectors.toList());
|
||||
final OsmDataLayer layer = getOsmLayer(osmLayers);
|
||||
if ((layer != null) && MapWithAIDataUtils.getMapWithAIData(MapWithAIDataUtils.getLayer(true), layer)) {
|
||||
new DownloadListener(layer.getDataSet());
|
||||
final Notification notification = createMessageDialog();
|
||||
if (notification != null) {
|
||||
notification.show();
|
||||
|
|
|
@ -284,6 +284,13 @@ public class MapWithAILayer extends OsmDataLayer implements ActiveLayerChangeLis
|
|||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
layer.continuousDownload = !layer.continuousDownload;
|
||||
if (layer.continuousDownload) {
|
||||
for (OsmDataLayer data : MainApplication.getLayerManager().getLayersOfType(OsmDataLayer.class)) {
|
||||
new DownloadListener(data.getDataSet());
|
||||
}
|
||||
} else {
|
||||
DownloadListener.destroyAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Ładowanie…
Reference in New Issue