Changeset 14555 in josm for trunk/src/org


Ignore:
Timestamp:
2018-12-12T15:12:36+01:00 (6 years ago)
Author:
GerdP
Message:

see #17040 commit ChangesetDetail-v2.patch

Location:
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset
Files:
2 edited

Legend:

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

    r14547 r14555  
    6565import org.openstreetmap.josm.io.NetworkManager;
    6666import org.openstreetmap.josm.io.OnlineResource;
     67import org.openstreetmap.josm.tools.Destroyable;
    6768import org.openstreetmap.josm.tools.ImageProvider;
    6869import org.openstreetmap.josm.tools.InputMapUtils;
     
    104105            instance.setVisible(true);
    105106            instance.dispose();
     107            for (Component c : instance.pnlChangesetDetailTabs.getComponents()) {
     108                if (c instanceof Destroyable) {
     109                    ((Destroyable) c).destroy();
     110                }
     111            }
    106112            instance = null;
    107113        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java

    r14547 r14555  
    1111import java.awt.Insets;
    1212import java.awt.event.ActionEvent;
    13 import java.awt.event.ComponentAdapter;
    14 import java.awt.event.ComponentEvent;
    1513import java.beans.PropertyChangeEvent;
    1614import java.beans.PropertyChangeListener;
     
    4644import org.openstreetmap.josm.io.NetworkManager;
    4745import org.openstreetmap.josm.io.OnlineResource;
     46import org.openstreetmap.josm.tools.Destroyable;
    4847import org.openstreetmap.josm.tools.ImageProvider;
    4948import org.openstreetmap.josm.tools.Utils;
     
    5554 * @since 2689
    5655 */
    57 public class ChangesetDetailPanel extends JPanel implements PropertyChangeListener, ChangesetAware {
     56public class ChangesetDetailPanel extends JPanel implements PropertyChangeListener, ChangesetAware, Destroyable {
    5857
    5958    // CHECKSTYLE.OFF: SingleSpaceSeparator
     
    104103        tb.add(actZoomInCurrentLayerAction);
    105104        MainApplication.getLayerManager().addActiveLayerChangeListener(actZoomInCurrentLayerAction);
    106 
    107         addComponentListener(
    108                 new ComponentAdapter() {
    109                     @Override
    110                     public void componentShown(ComponentEvent e) {
    111                         MainApplication.getLayerManager().addAndFireActiveLayerChangeListener(actSelectInCurrentLayer);
    112                         MainApplication.getLayerManager().addAndFireActiveLayerChangeListener(actZoomInCurrentLayerAction);
    113                     }
    114 
    115                     @Override
    116                     public void componentHidden(ComponentEvent e) {
    117                         // make sure the listener is unregistered when the panel becomes invisible
    118                         MainApplication.getLayerManager().removeActiveLayerChangeListener(actSelectInCurrentLayer);
    119                         MainApplication.getLayerManager().removeActiveLayerChangeListener(actZoomInCurrentLayerAction);
    120                     }
    121                 }
    122         );
    123105
    124106        pnl.add(tb);
     
    477459        return currentChangeset;
    478460    }
     461
     462    @Override
     463    public void destroy() {
     464        MainApplication.getLayerManager().removeActiveLayerChangeListener(actSelectInCurrentLayer);
     465        MainApplication.getLayerManager().removeActiveLayerChangeListener(actZoomInCurrentLayerAction);
     466    }
    479467}
Note: See TracChangeset for help on using the changeset viewer.