#87743: memory leak. before_retouche_2006_merge_trunk
authorjglick@netbeans.org
Mon, 23 Oct 2006 15:54:57 +0000
changeset 762216a398bc2df9
parent 7621 85c99ad4e108
child 7623 34ffc2574f54
#87743: memory leak.
buildmonitor/manifest.mf
buildmonitor/src/org/netbeans/modules/buildmonitor/BuildStatus.java
     1.1 --- a/buildmonitor/manifest.mf	Mon Oct 23 15:48:51 2006 +0000
     1.2 +++ b/buildmonitor/manifest.mf	Mon Oct 23 15:54:57 2006 +0000
     1.3 @@ -2,5 +2,5 @@
     1.4  OpenIDE-Module: org.netbeans.modules.buildmonitor
     1.5  OpenIDE-Module-Layer: org/netbeans/modules/buildmonitor/layer.xml
     1.6  OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/buildmonitor/Bundle.properties
     1.7 -OpenIDE-Module-Specification-Version: 1.8
     1.8 +OpenIDE-Module-Specification-Version: 1.9
     1.9  
     2.1 --- a/buildmonitor/src/org/netbeans/modules/buildmonitor/BuildStatus.java	Mon Oct 23 15:48:51 2006 +0000
     2.2 +++ b/buildmonitor/src/org/netbeans/modules/buildmonitor/BuildStatus.java	Mon Oct 23 15:54:57 2006 +0000
     2.3 @@ -62,18 +62,17 @@
     2.4      private BuildMonitor monitor;
     2.5      private JPopupMenu popupMenu;
     2.6  
     2.7 -    /** Creates a new instance of BuildStatus */
     2.8      public BuildStatus(BuildMonitor monitor) {
     2.9 -	super(monitor.getName(), monitor.getStatus().getIcon());
    2.10 +        super(monitor.getName(), monitor.getStatus().getIcon());
    2.11          this.monitor = monitor;
    2.12 -	setBorderPainted(false);
    2.13 -	setFocusPainted(false);
    2.14 +        setBorderPainted(false);
    2.15 +        setFocusPainted(false);
    2.16          setMargin(new java.awt.Insets(0,0,0,0));
    2.17 -        if (monitor.getStatus() == Status.NO_STATUS_AVAIL)
    2.18 +        if (monitor.getStatus() == Status.NO_STATUS_AVAIL) {
    2.19              setContentAreaFilled(false);
    2.20 +        }
    2.21          setToolTipText(monitor.getStatusDescription());
    2.22          setActions();
    2.23 -	monitor.addPropertyChangeListener(this);
    2.24      }
    2.25      
    2.26      private void setActions() {
    2.27 @@ -101,21 +100,31 @@
    2.28          enableActions();
    2.29      }
    2.30      
    2.31 +    public void addNotify() {
    2.32 +        super.addNotify();
    2.33 +        monitor.addPropertyChangeListener(this);
    2.34 +    }
    2.35 +
    2.36 +    public void removeNotify() {
    2.37 +        super.removeNotify();
    2.38 +        monitor.removePropertyChangeListener(this);
    2.39 +    }
    2.40 +
    2.41      /**
    2.42       * Monitor has signaled a status change.
    2.43       */
    2.44      public void propertyChange(PropertyChangeEvent e) {
    2.45 -	BuildMonitor monitor = (BuildMonitor)e.getSource();
    2.46 +        BuildMonitor monitor = (BuildMonitor)e.getSource();
    2.47          final String name = monitor.getName();
    2.48 -	final Icon icon = monitor.getStatus().getIcon();
    2.49 -	EventQueue.invokeLater(new Runnable() {
    2.50 -	    public void run() {
    2.51 +        final Icon icon = monitor.getStatus().getIcon();
    2.52 +        EventQueue.invokeLater(new Runnable() {
    2.53 +            public void run() {
    2.54                  setName(name);
    2.55 -		setIcon(icon);
    2.56 -		repaint();
    2.57 +                setIcon(icon);
    2.58 +                repaint();
    2.59                  enableActions();
    2.60 -	    }
    2.61 -	});
    2.62 +            }
    2.63 +        });
    2.64      }
    2.65      
    2.66      private void enableActions() {
    2.67 @@ -277,4 +286,5 @@
    2.68      private static String getString(String key) {
    2.69          return NbBundle.getMessage(BuildStatus.class, key);
    2.70      }
    2.71 +
    2.72  }