Browse Source

Avoid need for hacky boolean to stop recursive reloading.

Fixes CLIENT-173

Change-Id: I5822f7d0509919d439b5f8bc1c2a3980ef4159c7
Reviewed-on: http://gerrit.dmdirc.com/1798
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.5
Greg Holmes 13 years ago
parent
commit
e48e7a14fa

+ 7
- 11
src/com/dmdirc/addons/ui_swing/components/addonpanel/PluginPanel.java View File

@@ -32,6 +32,7 @@ import com.dmdirc.plugins.PluginInfo;
32 32
 import com.dmdirc.plugins.PluginManager;
33 33
 
34 34
 import java.awt.Window;
35
+import java.util.ArrayList;
35 36
 import java.util.Collections;
36 37
 import java.util.List;
37 38
 
@@ -44,9 +45,6 @@ import javax.swing.table.DefaultTableModel;
44 45
  */
45 46
 public class PluginPanel extends AddonPanel implements ActionListener {
46 47
 
47
-    /** Do we refresh on plugin reload? */
48
-    private boolean pluginRefresh = true;
49
-
50 48
     /**
51 49
      * Creates a new instance of PluginPanel.
52 50
      *
@@ -57,16 +55,16 @@ public class PluginPanel extends AddonPanel implements ActionListener {
57 55
             final SwingController controller) {
58 56
         super(parentWindow, controller);
59 57
 
60
-        ActionManager.addListener(this, CoreActionType.PLUGIN_REFRESH);
58
+        ActionManager.getActionManager().registerListener(this,
59
+                CoreActionType.PLUGIN_REFRESH);
60
+        PluginManager.getPluginManager().getPossiblePluginInfos(true);
61 61
     }
62 62
 
63 63
     /** {@inheritDoc} */
64 64
     @Override
65 65
     protected JTable populateList(final JTable table) {
66
-        pluginRefresh = false;
67
-        final List<PluginInfo> list =
68
-                PluginManager.getPluginManager().getPossiblePluginInfos(true);
69
-        pluginRefresh = true;
66
+        final List<PluginInfo> list = new ArrayList<PluginInfo>();
67
+        list.addAll(PluginManager.getPluginManager().getPluginInfos());
70 68
         Collections.sort(list);
71 69
 
72 70
         UIUtilities.invokeLater(new Runnable() {
@@ -96,9 +94,7 @@ public class PluginPanel extends AddonPanel implements ActionListener {
96 94
     @Override
97 95
     public void processEvent(final ActionType type, final StringBuffer format,
98 96
             final Object... arguments) {
99
-        if (pluginRefresh) {
100
-            populateList(addonList);
101
-        }
97
+        populateList(addonList);
102 98
     }
103 99
 
104 100
     /** {@inheritDoc} */

Loading…
Cancel
Save