Browse Source

Don't get a PluginManager from random places.

pull/79/head
Chris Smith 9 years ago
parent
commit
17fbdb70da

+ 9
- 3
ui_swing/src/com/dmdirc/addons/ui_swing/components/addonpanel/AddonToggle.java View File

24
 
24
 
25
 import com.dmdirc.interfaces.config.ConfigProvider;
25
 import com.dmdirc.interfaces.config.ConfigProvider;
26
 import com.dmdirc.plugins.PluginInfo;
26
 import com.dmdirc.plugins.PluginInfo;
27
+import com.dmdirc.plugins.PluginManager;
27
 import com.dmdirc.ui.themes.Theme;
28
 import com.dmdirc.ui.themes.Theme;
28
 import com.dmdirc.ui.themes.ThemeManager;
29
 import com.dmdirc.ui.themes.ThemeManager;
29
 import com.dmdirc.updater.UpdateComponent;
30
 import com.dmdirc.updater.UpdateComponent;
49
     private final ListenerList listeners = new ListenerList();
50
     private final ListenerList listeners = new ListenerList();
50
     /** Identity to change update settings in. */
51
     /** Identity to change update settings in. */
51
     private final ConfigProvider identity;
52
     private final ConfigProvider identity;
53
+    /** The manager to update when toggling a plugin. */
54
+    private final PluginManager pluginManager;
52
     /** The manager to update when toggling a theme. */
55
     /** The manager to update when toggling a theme. */
53
     private final ThemeManager themeManager;
56
     private final ThemeManager themeManager;
54
 
57
 
62
     public AddonToggle(
65
     public AddonToggle(
63
             final CachingUpdateManager updateManager,
66
             final CachingUpdateManager updateManager,
64
             final ConfigProvider identity,
67
             final ConfigProvider identity,
68
+            final PluginManager pluginManager,
65
             final PluginInfo pi) {
69
             final PluginInfo pi) {
66
         this.identity = identity;
70
         this.identity = identity;
71
+        this.pluginManager = pluginManager;
67
         this.pi = pi;
72
         this.pi = pi;
68
-        this.theme = null;
69
         this.themeManager = null;
73
         this.themeManager = null;
74
+        this.theme = null;
70
         state = pi.isLoaded();
75
         state = pi.isLoaded();
71
 
76
 
72
         checkUpdateState(updateManager);
77
         checkUpdateState(updateManager);
86
             final ThemeManager themeManager,
91
             final ThemeManager themeManager,
87
             final Theme theme) {
92
             final Theme theme) {
88
         this.identity = identity;
93
         this.identity = identity;
94
+        this.pluginManager = null;
89
         this.pi = null;
95
         this.pi = null;
90
-        this.theme = theme;
91
         this.themeManager = themeManager;
96
         this.themeManager = themeManager;
97
+        this.theme = theme;
92
         state = theme.isEnabled();
98
         state = theme.isEnabled();
93
 
99
 
94
         checkUpdateState(updateManager);
100
         checkUpdateState(updateManager);
182
                     } else {
188
                     } else {
183
                         pi.unloadPlugin();
189
                         pi.unloadPlugin();
184
                     }
190
                     }
185
-                    pi.getMetaData().getManager().updateAutoLoad(pi);
191
+                    pluginManager.updateAutoLoad(pi);
186
                     if (getID() != -1) {
192
                     if (getID() != -1) {
187
                         if (getUpdateState()) {
193
                         if (getUpdateState()) {
188
                             identity.unsetOption("updater", "enable-addon-"
194
                             identity.unsetOption("updater", "enable-addon-"

+ 1
- 0
ui_swing/src/com/dmdirc/addons/ui_swing/components/addonpanel/PluginPanel.java View File

124
                                         new AddonToggle(
124
                                         new AddonToggle(
125
                                                 updateManager,
125
                                                 updateManager,
126
                                                 userConfig,
126
                                                 userConfig,
127
+                                                pluginManager,
127
                                                 plugin),
128
                                                 plugin),
128
                                         iconManager),});
129
                                         iconManager),});
129
                 }
130
                 }

Loading…
Cancel
Save