소스 검색

Don't get a PluginManager from random places.

pull/79/head
Chris Smith 9 년 전
부모
커밋
17fbdb70da

+ 9
- 3
ui_swing/src/com/dmdirc/addons/ui_swing/components/addonpanel/AddonToggle.java 파일 보기

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

+ 1
- 0
ui_swing/src/com/dmdirc/addons/ui_swing/components/addonpanel/PluginPanel.java 파일 보기

@@ -124,6 +124,7 @@ public class PluginPanel extends AddonPanel {
124 124
                                         new AddonToggle(
125 125
                                                 updateManager,
126 126
                                                 userConfig,
127
+                                                pluginManager,
127 128
                                                 plugin),
128 129
                                         iconManager),});
129 130
                 }

Loading…
취소
저장