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
 import com.dmdirc.plugins.PluginManager;
32
 import com.dmdirc.plugins.PluginManager;
33
 
33
 
34
 import java.awt.Window;
34
 import java.awt.Window;
35
+import java.util.ArrayList;
35
 import java.util.Collections;
36
 import java.util.Collections;
36
 import java.util.List;
37
 import java.util.List;
37
 
38
 
44
  */
45
  */
45
 public class PluginPanel extends AddonPanel implements ActionListener {
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
      * Creates a new instance of PluginPanel.
49
      * Creates a new instance of PluginPanel.
52
      *
50
      *
57
             final SwingController controller) {
55
             final SwingController controller) {
58
         super(parentWindow, controller);
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
     /** {@inheritDoc} */
63
     /** {@inheritDoc} */
64
     @Override
64
     @Override
65
     protected JTable populateList(final JTable table) {
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
         Collections.sort(list);
68
         Collections.sort(list);
71
 
69
 
72
         UIUtilities.invokeLater(new Runnable() {
70
         UIUtilities.invokeLater(new Runnable() {
96
     @Override
94
     @Override
97
     public void processEvent(final ActionType type, final StringBuffer format,
95
     public void processEvent(final ActionType type, final StringBuffer format,
98
             final Object... arguments) {
96
             final Object... arguments) {
99
-        if (pluginRefresh) {
100
-            populateList(addonList);
101
-        }
97
+        populateList(addonList);
102
     }
98
     }
103
 
99
 
104
     /** {@inheritDoc} */
100
     /** {@inheritDoc} */

Loading…
Cancel
Save