Browse 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 10 years ago
parent
commit
71dac69517
1 changed files with 11 additions and 9 deletions
  1. 11
    9
      src/com/dmdirc/addons/windowstatus/WindowStatusManager.java

+ 11
- 9
src/com/dmdirc/addons/windowstatus/WindowStatusManager.java View File

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

Loading…
Cancel
Save