Ignore:
Timestamp:
17.01.2010 11:56:07 (2 years ago)
Author:
jttt
Message:

Removed ToggleDialog.tearDown(). All listeners should be unregistered in hideNotify()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r2847 r2869  
    4747import org.openstreetmap.josm.gui.layer.OsmDataLayer; 
    4848import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 
     49import org.openstreetmap.josm.tools.CheckParameterUtil; 
    4950import org.openstreetmap.josm.tools.ImageProvider; 
    5051import org.openstreetmap.josm.tools.Shortcut; 
    5152import org.openstreetmap.josm.tools.ImageProvider.OverlayPosition; 
    52 import org.openstreetmap.josm.tools.CheckParameterUtil; 
    5353 
    5454/** 
     
    7070     */ 
    7171    static public void createInstance(MapFrame mapFrame) { 
     72        if (instance != null) 
     73            throw new IllegalStateException("Dialog was already created"); 
    7274        instance = new LayerListDialog(mapFrame); 
    7375    } 
     
    115117        activateLayerAction = new ActivateLayerAction(); 
    116118        adaptTo(activateLayerAction, selectionModel); 
    117         MapView.addLayerChangeListener(activateLayerAction); 
    118119        buttonPanel.add(new SideButton(activateLayerAction)); 
    119120 
     
    153154        selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 
    154155        model = new LayerListModel(selectionModel); 
    155         MapView.addLayerChangeListener(model); 
    156156 
    157157        // create the list control 
     
    185185 
    186186    @Override 
    187     public void tearDown() { 
     187    public void showNotify() { 
     188        MapView.addLayerChangeListener(activateLayerAction); 
     189        MapView.addLayerChangeListener(model); 
     190    } 
     191 
     192    @Override 
     193    public void hideNotify() { 
    188194        MapView.removeLayerChangeListener(model); 
    189195        MapView.removeLayerChangeListener(activateLayerAction); 
     
    240246                } 
    241247        ); 
     248    } 
     249 
     250    @Override 
     251    public void destroy() { 
     252        super.destroy(); 
     253        instance = null; 
    242254    } 
    243255 
Note: See TracChangeset for help on using the changeset viewer.