Parcourir la source

Create things in onload not load

Change-Id: I693acc716a54405f0aeb2cc8bb7739c29e82fca1
Reviewed-on: http://gerrit.dmdirc.com/3110
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.8
Greg Holmes il y a 10 ans
Parent
révision
71dac69517
1 fichiers modifiés avec 11 ajouts et 9 suppressions
  1. 11
    9
      src/com/dmdirc/addons/windowstatus/WindowStatusManager.java

+ 11
- 9
src/com/dmdirc/addons/windowstatus/WindowStatusManager.java Voir le fichier

58
     private final MainFrame mainFrame;
58
     private final MainFrame mainFrame;
59
     /** Status bar we're adding to. */
59
     /** Status bar we're adding to. */
60
     private final SwingStatusBar statusBar;
60
     private final SwingStatusBar statusBar;
61
-    /** The panel we use in the status bar. */
62
-    private final WindowStatusPanel panel;
63
     /** Identity controller to read settings from. */
61
     /** Identity controller to read settings from. */
64
     private final IdentityController identityController;
62
     private final IdentityController identityController;
65
     /** Plugin settings domain. */
63
     /** Plugin settings domain. */
66
     private final String domain;
64
     private final String domain;
65
+    /** The panel we use in the status bar. */
66
+    private WindowStatusPanel panel;
67
     /** Should we show the real name in queries? */
67
     /** Should we show the real name in queries? */
68
     private boolean showname;
68
     private boolean showname;
69
     /** Should we show users without modes? */
69
     /** Should we show users without modes? */
79
         this.mainFrame = mainFrame;
79
         this.mainFrame = mainFrame;
80
         this.statusBar = statusBar;
80
         this.statusBar = statusBar;
81
         this.identityController = identityController;
81
         this.identityController = identityController;
82
+    }
82
 
83
 
84
+    /**
85
+     * Loads the plugin.
86
+     */
87
+    public void onLoad() {
83
         panel = UIUtilities.invokeAndWait(new Callable<WindowStatusPanel>() {
88
         panel = UIUtilities.invokeAndWait(new Callable<WindowStatusPanel>() {
84
 
89
 
85
             /** {@inheritDoc} */
90
             /** {@inheritDoc} */
88
                 return new WindowStatusPanel();
93
                 return new WindowStatusPanel();
89
             }
94
             }
90
         });
95
         });
91
-    }
92
-
93
-    /**
94
-     * Loads the plugin.
95
-     */
96
-    public void onLoad() {
97
         statusBar.addComponent(panel);
96
         statusBar.addComponent(panel);
98
         mainFrame.addSelectionListener(this);
97
         mainFrame.addSelectionListener(this);
99
         identityController.getGlobalConfiguration().addChangeListener(domain, this);
98
         identityController.getGlobalConfiguration().addChangeListener(domain, this);
106
     public void onUnload() {
105
     public void onUnload() {
107
         mainFrame.removeSelectionListener(this);
106
         mainFrame.removeSelectionListener(this);
108
         statusBar.removeComponent(panel);
107
         statusBar.removeComponent(panel);
108
+        panel = null;
109
     }
109
     }
110
 
110
 
111
     /** {@inheritDoc} */
111
     /** {@inheritDoc} */
214
         } else {
214
         } else {
215
             textString.append("???");
215
             textString.append("???");
216
         }
216
         }
217
-        panel.setText(textString.toString());
217
+        if (panel != null) {
218
+            panel.setText(textString.toString());
219
+        }
218
     }
220
     }
219
 
221
 
220
     /**
222
     /**

Chargement…
Annuler
Enregistrer