Ignore:
Timestamp:
17.01.2010 16:37:24 (2 years ago)
Author:
jttt
Message:

Partially fix situation after last layer removal - most objects still stay in memory but at least there are less references and forgotten listeners

File:
1 edited

Legend:

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

    r2869 r2871  
    106106        setMinimumSize(new Dimension(0,0)); 
    107107        this.preferredHeight = preferredHeight; 
    108         toggleAction = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortcut, iconName); 
     108        toggleAction = new ToggleDialogAction(this, name, "dialogs/"+iconName, tooltip, shortcut, iconName); 
    109109        String helpId = "Dialog/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1); 
    110110        toggleAction.putValue("help", helpId.substring(0, helpId.length()-6)); 
     
    134134     * 
    135135     */ 
    136     public final class ToggleDialogAction extends JosmAction { 
    137         private ToggleDialogAction(String name, String iconName, String tooltip, Shortcut shortcut, String prefname) { 
     136    public final static class ToggleDialogAction extends JosmAction { 
     137 
     138        private ToggleDialog dialog; 
     139 
     140        private ToggleDialogAction(ToggleDialog dialog, String name, String iconName, String tooltip, Shortcut shortcut, String prefname) { 
    138141            super(name, iconName, tooltip, shortcut, false); 
     142            this.dialog = dialog; 
    139143        } 
    140144 
    141145        public void actionPerformed(ActionEvent e) { 
    142             toggleButtonHook(); 
    143             if (isShowing) { 
    144                 hideDialog(); 
    145                 dialogsPanel.reconstruct(Action.ELEMENT_SHRINKS, null); 
     146            dialog.toggleButtonHook(); 
     147            if (dialog.isShowing) { 
     148                dialog.hideDialog(); 
     149                dialog.dialogsPanel.reconstruct(Action.ELEMENT_SHRINKS, null); 
    146150            } else { 
    147                 showDialog(); 
    148                 if (isDocked && isCollapsed) { 
    149                     expand(); 
     151                dialog.showDialog(); 
     152                if (dialog.isDocked && dialog.isCollapsed) { 
     153                    dialog.expand(); 
    150154                } 
    151                 if (isDocked) { 
    152                     dialogsPanel.reconstruct(Action.INVISIBLE_TO_DEFAULT, ToggleDialog.this); 
     155                if (dialog.isDocked) { 
     156                    dialog.dialogsPanel.reconstruct(Action.INVISIBLE_TO_DEFAULT, dialog); 
    153157                } 
    154158            } 
     159        } 
     160 
     161        @Override 
     162        public void destroy() { 
     163            super.destroy(); 
     164            dialog = null; 
    155165        } 
    156166    } 
Note: See TracChangeset for help on using the changeset viewer.