diff --git a/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java b/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
index d1917bd..617dc36 100644
|
a
|
b
|
public class LayerListDialog extends ToggleDialog {
|
| 122 | 122 | private final ActivateLayerAction activateLayerAction; |
| 123 | 123 | private final ShowHideLayerAction showHideLayerAction; |
| 124 | 124 | |
| | 125 | /** |
| | 126 | * Set if {@link #showNotify()} was called. To be removed when lifecycle is fixed. |
| | 127 | */ |
| | 128 | private boolean isShown; |
| | 129 | |
| 125 | 130 | //TODO This duplicates ShowHide actions functionality |
| 126 | 131 | /** stores which layer index to toggle and executes the ShowHide action if the layer is present */ |
| 127 | 132 | private final class ToggleLayerIndexVisibility extends AbstractAction { |
| … |
… |
public class LayerListDialog extends ToggleDialog {
|
| 329 | 334 | |
| 330 | 335 | @Override |
| 331 | 336 | public void showNotify() { |
| | 337 | if (isShown) { |
| | 338 | return; |
| | 339 | } |
| 332 | 340 | MapView.addLayerChangeListener(activateLayerAction); |
| 333 | 341 | layerManager.addLayerChangeListener(model); |
| 334 | 342 | layerManager.addActiveLayerChangeListener(model, true); |
| 335 | 343 | model.populate(); |
| | 344 | isShown = true; |
| 336 | 345 | } |
| 337 | 346 | |
| 338 | 347 | @Override |
| 339 | 348 | public void hideNotify() { |
| | 349 | if (!isShown) { |
| | 350 | return; |
| | 351 | } |
| 340 | 352 | layerManager.removeLayerChangeListener(model); |
| 341 | 353 | layerManager.removeActiveLayerChangeListener(model); |
| 342 | 354 | MapView.removeLayerChangeListener(activateLayerAction); |
| | 355 | isShown = false; |
| 343 | 356 | } |
| 344 | 357 | |
| 345 | 358 | /** |