Browse Source

Fixes issue 0001734

git-svn-id: http://svn.dmdirc.com/trunk@4649 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6.3m1rc1
Chris Smith 16 years ago
parent
commit
6c270a7236

+ 1
- 1
src/com/dmdirc/actions/Action.java View File

@@ -246,7 +246,7 @@ public class Action extends ActionModel implements Serializable {
246 246
             if (data.containsKey("type") && data.containsKey("setting")
247 247
                     && data.containsKey("title") && data.containsKey("default")
248 248
                     && data.containsKey("tooltip")) {
249
-                myGroup.getSettings().add(new PreferencesSetting(
249
+                myGroup.getSettings().put(data.get("setting"), new PreferencesSetting(
250 250
                         PreferencesType.valueOf(data.get("type")), "actions",
251 251
                         data.get("setting"), data.get("default"), 
252 252
                         data.get("title"), data.get("tooltip")));

+ 8
- 4
src/com/dmdirc/actions/ActionGroup.java View File

@@ -25,8 +25,11 @@ package com.dmdirc.actions;
25 25
 import com.dmdirc.config.prefs.PreferencesSetting;
26 26
 
27 27
 import java.util.ArrayList;
28
+import java.util.Collection;
29
+import java.util.HashMap;
28 30
 import java.util.Iterator;
29 31
 import java.util.List;
32
+import java.util.Map;
30 33
 
31 34
 /**
32 35
  * Represents a group of actions, along with their meta-data.
@@ -61,7 +64,8 @@ public class ActionGroup implements Iterable<Action> {
61 64
     private int version = -1;
62 65
     
63 66
     /** A list of settings used by this action group. */
64
-    private final List<PreferencesSetting> settings = new ArrayList<PreferencesSetting>();
67
+    private final Map<String, PreferencesSetting> settings
68
+            = new HashMap<String, PreferencesSetting>();
65 69
 
66 70
     /**
67 71
      * Creates a new instance of ActionGroup.
@@ -120,11 +124,11 @@ public class ActionGroup implements Iterable<Action> {
120 124
     }
121 125
 
122 126
     /**
123
-     * Retrieves a list of settings used by this action group.
127
+     * Retrieves a map settings used by this action group.
124 128
      * 
125
-     * @return A list of settings used by this action group.
129
+     * @return A map of setting names to values
126 130
      */
127
-    public List<PreferencesSetting> getSettings() {
131
+    public Map<String, PreferencesSetting> getSettings() {
128 132
         return settings;
129 133
     }
130 134
 

+ 3
- 3
src/com/dmdirc/ui/swing/dialogs/actionsmanager/ActionGroupSettingsPanel.java View File

@@ -33,8 +33,8 @@ import java.awt.Window;
33 33
 import java.awt.event.ActionEvent;
34 34
 import java.awt.event.ActionListener;
35 35
 import java.util.ArrayList;
36
+import java.util.Collection;
36 37
 import java.util.HashMap;
37
-import java.util.List;
38 38
 import java.util.Map;
39 39
 
40 40
 import javax.swing.JButton;
@@ -56,7 +56,7 @@ public final class ActionGroupSettingsPanel extends JPanel implements ActionList
56 56
      */
57 57
     private static final long serialVersionUID = 1;
58 58
     /** Settings list. */
59
-    private List<PreferencesSetting> settings;
59
+    private Collection<PreferencesSetting> settings;
60 60
     /** Button -> Component map. */
61 61
     private Map<JButton, PreferencesSetting> settingMap;
62 62
     /** Parent dialog. */
@@ -141,7 +141,7 @@ public final class ActionGroupSettingsPanel extends JPanel implements ActionList
141 141
         if (group == null || group.getSettings().isEmpty()) {
142 142
             this.settings = new ArrayList<PreferencesSetting>();
143 143
         } else {
144
-            this.settings = group.getSettings();
144
+            this.settings = group.getSettings().values();
145 145
         }
146 146
 
147 147
         layoutComponents();

Loading…
Cancel
Save