Browse Source

Actions are now saved when the client exits (in addition to anywhere the UI cares to save them; fixes issue 453)

Updated umodes action pack to have correct component number
Changed a couple of listener lists from WeakMapLists to MapLists so AICs don't get GC'd
Deprecated the old actions methods so they're easy to spot for removal post-0.6

git-svn-id: http://svn.dmdirc.com/trunk@3121 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Chris Smith 16 years ago
parent
commit
d9688be750

+ 1
- 1
src/com/dmdirc/Main.java View File

@@ -69,7 +69,7 @@ public final class Main {
69 69
      * @Deprecated No longer needed, remove post-0.6
70 70
      */
71 71
     @Deprecated
72
-    private static final int ADDON_REVISION = 9;
72
+    private static final int ADDON_REVISION = 10;
73 73
     
74 74
     /**
75 75
      * Feedback nag delay.

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

@@ -103,7 +103,10 @@ public class Action extends ActionModel implements Serializable {
103 103
 
104 104
     /**
105 105
      * Loads this action from a properties file.
106
+     * 
107
+     * @Deprecated Remove post 0.6
106 108
      */
109
+    @Deprecated
107 110
     private void loadProperties() {
108 111
         try {
109 112
             final FileInputStream inputStream = new FileInputStream(file);
@@ -294,7 +297,10 @@ public class Action extends ActionModel implements Serializable {
294 297
 
295 298
     /**
296 299
      * Loads the various attributes of this action from the properties instance.
300
+     * 
301
+     * @Deprecated Remove post-0.6
297 302
      */
303
+    @Deprecated
298 304
     private void loadActionFromProperties() {
299 305
         // Read the triggers
300 306
         if (properties.containsKey("trigger")) {
@@ -358,6 +364,7 @@ public class Action extends ActionModel implements Serializable {
358 364
         }
359 365
 
360 366
         ActionManager.registerAction(this);
367
+        modified = true;
361 368
         save();
362 369
     }
363 370
 
@@ -365,6 +372,10 @@ public class Action extends ActionModel implements Serializable {
365 372
      * Called to save the action.
366 373
      */
367 374
     public void save() {
375
+        if (!isModified()) {
376
+            return;
377
+        }
378
+        
368 379
         final ConfigFile newConfig = new ConfigFile(location);
369 380
 
370 381
         final List<String> triggerNames = new ArrayList<String>();
@@ -541,7 +552,9 @@ public class Action extends ActionModel implements Serializable {
541 552
      *
542 553
      * @param condition Condition number to read
543 554
      * @return True if the condition was read successfully.
555
+     * @deprecated Remove post-0.6
544 556
      */
557
+    @Deprecated
545 558
     private boolean readCondition(final int condition) {
546 559
         // It may help to close your eyes while reading this method.
547 560
 

+ 144
- 123
src/com/dmdirc/actions/ActionManager.java View File

@@ -22,26 +22,25 @@
22 22
 
23 23
 package com.dmdirc.actions;
24 24
 
25
-import com.dmdirc.actions.interfaces.ActionType;
26
-import com.dmdirc.actions.interfaces.ActionComponent;
27
-import com.dmdirc.actions.interfaces.ActionComparison;
28 25
 import com.dmdirc.Main;
29 26
 import com.dmdirc.Precondition;
27
+import com.dmdirc.actions.interfaces.ActionComparison;
28
+import com.dmdirc.actions.interfaces.ActionComponent;
29
+import com.dmdirc.actions.interfaces.ActionType;
30 30
 import com.dmdirc.actions.wrappers.ActionWrapper;
31 31
 import com.dmdirc.actions.wrappers.AliasWrapper;
32 32
 import com.dmdirc.actions.wrappers.PerformWrapper;
33 33
 import com.dmdirc.config.ConfigTarget;
34 34
 import com.dmdirc.config.Identity;
35
-import com.dmdirc.interfaces.ConfigChangeListener;
36 35
 import com.dmdirc.config.IdentityManager;
37 36
 import com.dmdirc.interfaces.ActionListener;
37
+import com.dmdirc.interfaces.ConfigChangeListener;
38 38
 import com.dmdirc.logger.ErrorLevel;
39 39
 import com.dmdirc.logger.Logger;
40 40
 import com.dmdirc.updater.components.ActionGroupComponent;
41 41
 import com.dmdirc.util.MapList;
42
-import com.dmdirc.util.WeakMapList;
43
-
44 42
 import com.dmdirc.util.resourcemanager.ZipResourceManager;
43
+
45 44
 import java.io.File;
46 45
 import java.io.IOException;
47 46
 import java.util.ArrayList;
@@ -56,60 +55,51 @@ import java.util.Properties;
56 55
  * @author chris
57 56
  */
58 57
 public final class ActionManager {
59
-    
58
+
60 59
     /** A list of registered action types. */
61 60
     private final static List<ActionType> actionTypes
62 61
             = new ArrayList<ActionType>();
63
-    
62
+
64 63
     /** A list of registered action components. */
65 64
     private final static List<ActionComponent> actionComponents
66 65
             = new ArrayList<ActionComponent>();
67
-    
66
+
68 67
     /** A list of registered action comparisons. */
69 68
     private final static List<ActionComparison> actionComparisons
70 69
             = new ArrayList<ActionComparison>();
71
-    
70
+
72 71
     /** A list of all action wrappers that have registered with us. */
73 72
     private final static List<ActionWrapper> actionWrappers
74 73
             = new ArrayList<ActionWrapper>();
75
-    
74
+
76 75
     /** A map linking types and a list of actions that're registered for them. */
77 76
     private final static MapList<ActionType, Action> actions
78 77
             = new MapList<ActionType, Action>();
79
-    
78
+
80 79
     /** A map linking groups and a list of actions that're in them. */
81 80
     private final static Map<String, ActionGroup> groups
82 81
             = new HashMap<String, ActionGroup>();
83
-    
82
+
84 83
     /** A map of the action type groups to the action types within. */
85 84
     private final static MapList<String, ActionType> actionTypeGroups
86 85
             = new MapList<String, ActionType>();
87
-    
86
+
88 87
     /** The listeners that we have registered. */
89
-    private final static WeakMapList<ActionType, ActionListener> listeners
90
-            = new WeakMapList<ActionType, ActionListener>();
91
-    
88
+    private final static MapList<ActionType, ActionListener> listeners
89
+            = new MapList<ActionType, ActionListener>();
90
+
92 91
     /** The identity we're using for action defaults. */
93 92
     private static Identity defaultsIdentity;
94
-    
93
+
95 94
     /** Indicates whether or not user actions should be killed (not processed). */
96 95
     private static boolean killSwitch
97 96
             = IdentityManager.getGlobalConfig().getOptionBool("actions", "killswitch", false);
98
-    
99
-    static {
100
-        final ConfigTarget target = new ConfigTarget();
101
-        final Properties properties = new Properties();
102
-        target.setGlobalDefault();
103
-        target.setOrder(500000);
104
-        properties.setProperty("identity.name", "Action defaults");
105
-        defaultsIdentity = new Identity(properties, target);
106
-    }
107
-   
97
+
108 98
     /** Creates a new instance of ActionManager. */
109 99
     private ActionManager() {
110 100
         // Shouldn't be instansiated
111 101
     }
112
-    
102
+
113 103
     /**
114 104
      * Initialises the action manager.
115 105
      */
@@ -117,12 +107,32 @@ public final class ActionManager {
117 107
         registerActionTypes(CoreActionType.values());
118 108
         registerActionComparisons(CoreActionComparison.values());
119 109
         registerActionComponents(CoreActionComponent.values());
120
-        
110
+
121 111
         registerWrapper(AliasWrapper.getAliasWrapper());
122 112
         registerWrapper(PerformWrapper.getPerformWrapper());
113
+
114
+        // Set up the identity used for our defaults
115
+        final ConfigTarget target = new ConfigTarget();
116
+        final Properties properties = new Properties();
117
+        target.setGlobalDefault();
118
+        target.setOrder(500000);
119
+        properties.setProperty("identity.name", "Action defaults");
120
+        defaultsIdentity = new Identity(properties, target);
123 121
         
122
+        // Register a listener for the closing event, so we can save actions
123
+        addListener(new ActionListener() {
124
+            /** {@inheritDoc} */
125
+            @Override
126
+            public void processEvent(final ActionType type, final StringBuffer format,
127
+                    final Object... arguments) {
128
+                saveActions();
129
+            }
130
+        }, CoreActionType.CLIENT_CLOSED);
131
+
132
+        // Make sure we listen for the killswitch
124 133
         IdentityManager.getGlobalConfig().addChangeListener("actions", "killswitch",
125 134
                 new ConfigChangeListener() {
135
+            /** {@inheritDoc} */
126 136
             @Override
127 137
             public void configChanged(final String domain, final String key) {
128 138
                 killSwitch
@@ -132,16 +142,27 @@ public final class ActionManager {
132 142
         });
133 143
     }
134 144
     
145
+    /**
146
+     * Saves all actions.
147
+     */
148
+    public static void saveActions() {
149
+        for (ActionGroup group : groups.values()) {
150
+            for (Action action : group) {
151
+                action.save();
152
+            }
153
+        }
154
+    }
155
+
135 156
     /**
136 157
      * Registers the specified default setting for actions.
137
-     * 
158
+     *
138 159
      * @param name The name of the setting to be registered
139 160
      * @param value The default value for the setting
140 161
      */
141 162
     public static void registerDefault(final String name, final String value) {
142 163
         defaultsIdentity.setOption("actions", name, value);
143 164
     }
144
-    
165
+
145 166
     /**
146 167
      * Registers the specified action wrapper with the manager.
147 168
      *
@@ -155,10 +176,10 @@ public final class ActionManager {
155 176
         assert(wrapper != null);
156 177
         assert(wrapper.getGroupName() != null);
157 178
         assert(!wrapper.getGroupName().isEmpty());
158
-        
179
+
159 180
         actionWrappers.add(wrapper);
160 181
     }
161
-    
182
+
162 183
     /**
163 184
      * Registers a set of actiontypes with the manager.
164 185
      *
@@ -168,12 +189,12 @@ public final class ActionManager {
168 189
     public static void registerActionTypes(final ActionType[] types) {
169 190
         for (ActionType type : types) {
170 191
             assert(type != null);
171
-            
192
+
172 193
             actionTypes.add(type);
173 194
             actionTypeGroups.add(type.getType().getGroup(), type);
174 195
         }
175 196
     }
176
-    
197
+
177 198
     /**
178 199
      * Registers a set of action components with the manager.
179 200
      *
@@ -183,11 +204,11 @@ public final class ActionManager {
183 204
     public static void registerActionComponents(final ActionComponent[] comps) {
184 205
         for (ActionComponent comp : comps) {
185 206
             assert(comp != null);
186
-            
207
+
187 208
             actionComponents.add(comp);
188 209
         }
189 210
     }
190
-    
211
+
191 212
     /**
192 213
      * Registers a set of action comparisons with the manager.
193 214
      *
@@ -197,11 +218,11 @@ public final class ActionManager {
197 218
     public static void registerActionComparisons(final ActionComparison[] comps) {
198 219
         for (ActionComparison comp : comps) {
199 220
             assert(comp != null);
200
-            
221
+
201 222
             actionComparisons.add(comp);
202 223
         }
203 224
     }
204
-    
225
+
205 226
     /**
206 227
      * Returns a map of groups to action lists.
207 228
      *
@@ -210,7 +231,7 @@ public final class ActionManager {
210 231
     public static Map<String, ActionGroup> getGroups() {
211 232
         return groups;
212 233
     }
213
-    
234
+
214 235
     /**
215 236
      * Returns a map of type groups to types.
216 237
      *
@@ -219,20 +240,20 @@ public final class ActionManager {
219 240
     public static MapList<String, ActionType> getTypeGroups() {
220 241
         return actionTypeGroups;
221 242
     }
222
-    
243
+
223 244
     /**
224 245
      * Loads actions from the user's directory.
225 246
      */
226 247
     public static void loadActions() {
227 248
         actions.clear();
228 249
         groups.clear();
229
-        
250
+
230 251
         for (ActionWrapper wrapper : actionWrappers) {
231 252
             wrapper.clearActions();
232 253
         }
233
-        
254
+
234 255
         final File dir = new File(getDirectory());
235
-        
256
+
236 257
         if (!dir.exists()) {
237 258
             try {
238 259
                 dir.mkdirs();
@@ -242,20 +263,20 @@ public final class ActionManager {
242 263
                         + ex.getMessage());
243 264
             }
244 265
         }
245
-        
266
+
246 267
         if (dir.listFiles() == null) {
247 268
             Logger.userError(ErrorLevel.MEDIUM, "Unable to load user action files");
248 269
         } else {
249 270
             for (File file : dir.listFiles()) {
250
-                if (file.isDirectory()) {                    
271
+                if (file.isDirectory()) {
251 272
                     loadActions(file);
252 273
                 }
253 274
             }
254 275
         }
255
-        
276
+
256 277
         registerComponents();
257 278
     }
258
-    
279
+
259 280
     /**
260 281
      * Creates new ActionGroupComponents for each action group.
261 282
      */
@@ -264,7 +285,7 @@ public final class ActionManager {
264 285
             new ActionGroupComponent(group);
265 286
         }
266 287
     }
267
-    
288
+
268 289
     /**
269 290
      * Retrieves the action wrapper with the specified group name.
270 291
      *
@@ -275,16 +296,16 @@ public final class ActionManager {
275 296
     private static ActionWrapper getWrapper(final String name) {
276 297
         assert(name != null);
277 298
         assert(!name.isEmpty());
278
-        
299
+
279 300
         for (ActionWrapper wrapper : actionWrappers) {
280 301
             if (name.equals(wrapper.getGroupName())) {
281 302
                 return wrapper;
282 303
             }
283 304
         }
284
-        
305
+
285 306
         return null;
286 307
     }
287
-    
308
+
288 309
     /**
289 310
      * Determines whether the specified group name is one used by an action
290 311
      * wrapper.
@@ -296,10 +317,10 @@ public final class ActionManager {
296 317
     private static boolean isWrappedGroup(final String name) {
297 318
         assert(name != null);
298 319
         assert(!name.isEmpty());
299
-        
320
+
300 321
         return getWrapper(name) != null;
301 322
     }
302
-    
323
+
303 324
     /**
304 325
      * Loads action files from a specified group directory.
305 326
      *
@@ -309,12 +330,12 @@ public final class ActionManager {
309 330
     private static void loadActions(final File dir) {
310 331
         assert(dir != null);
311 332
         assert(dir.isDirectory());
312
-        
333
+
313 334
         for (File file : dir.listFiles()) {
314 335
             new Action(dir.getName(), file.getName());
315 336
         }
316 337
     }
317
-    
338
+
318 339
     /**
319 340
      * Registers an action with the manager.
320 341
      *
@@ -323,22 +344,22 @@ public final class ActionManager {
323 344
     @Precondition("The specified action is not null")
324 345
     public static void registerAction(final Action action) {
325 346
         assert(action != null);
326
-        
347
+
327 348
         for (ActionType trigger : action.getTriggers()) {
328 349
             actions.add(trigger, action);
329 350
         }
330
-        
351
+
331 352
         if (isWrappedGroup(action.getGroup())) {
332 353
             getWrapper(action.getGroup()).registerAction(action);
333 354
         } else {
334 355
             getGroup(action.getGroup()).add(action);
335 356
         }
336 357
     }
337
-    
358
+
338 359
     /**
339 360
      * Retrieves the action group with the specified name. A new group is
340 361
      * created if it doesn't already exist.
341
-     * 
362
+     *
342 363
      * @param name The name of the group to retrieve
343 364
      * @return The corresponding ActionGroup
344 365
      */
@@ -346,10 +367,10 @@ public final class ActionManager {
346 367
         if (!groups.containsKey(name)) {
347 368
             groups.put(name, new ActionGroup(name));
348 369
         }
349
-        
370
+
350 371
         return groups.get(name);
351 372
     }
352
-    
373
+
353 374
     /**
354 375
      * Unregisters an action with the manager.
355 376
      *
@@ -358,22 +379,22 @@ public final class ActionManager {
358 379
     @Precondition("The specified action is not null")
359 380
     public static void unregisterAction(final Action action) {
360 381
         assert(action != null);
361
-        
382
+
362 383
         actions.removeFromAll(action);
363 384
         getGroup(action.getGroup()).remove(action);
364 385
     }
365
-    
386
+
366 387
     /**
367 388
      * Reregisters the specified action. Should be used when the action's
368 389
      * triggers change.
369
-     * 
390
+     *
370 391
      * @param action The action to be reregistered
371 392
      */
372 393
     public static void reregisterAction(final Action action) {
373 394
         unregisterAction(action);
374 395
         reregisterAction(action);
375 396
     }
376
-    
397
+
377 398
     /**
378 399
      * Deletes the specified action.
379 400
      *
@@ -382,12 +403,12 @@ public final class ActionManager {
382 403
     @Precondition("The specified Action is not null")
383 404
     public static void deleteAction(final Action action) {
384 405
         assert(action != null);
385
-        
406
+
386 407
         unregisterAction(action);
387
-        
408
+
388 409
         action.delete();
389 410
     }
390
-    
411
+
391 412
     /**
392 413
      * Processes an event of the specified type.
393 414
      *
@@ -406,18 +427,18 @@ public final class ActionManager {
406 427
         assert(type != null);
407 428
         assert(type.getType() != null);
408 429
         assert(type.getType().getArity() == arguments.length);
409
-        
430
+
410 431
         if (listeners.containsKey(type)) {
411 432
             for (ActionListener listener : listeners.get(type)) {
412 433
                 listener.processEvent(type, format, arguments);
413 434
             }
414 435
         }
415
-        
436
+
416 437
         if (!killSwitch) {
417 438
             triggerActions(type, format, arguments);
418 439
         }
419 440
     }
420
-    
441
+
421 442
     /**
422 443
      * Triggers actions that respond to the specified type.
423 444
      *
@@ -430,14 +451,14 @@ public final class ActionManager {
430 451
     private static void triggerActions(final ActionType type,
431 452
             final StringBuffer format, final Object ... arguments) {
432 453
         assert(type != null);
433
-        
454
+
434 455
         if (actions.containsKey(type)) {
435 456
             for (Action action : actions.get(type)) {
436 457
                 action.trigger(format, arguments);
437 458
             }
438 459
         }
439 460
     }
440
-    
461
+
441 462
     /**
442 463
      * Returns the directory that should be used to store actions.
443 464
      *
@@ -446,7 +467,7 @@ public final class ActionManager {
446 467
     public static String getDirectory() {
447 468
         return Main.getConfigDir() + "actions" + System.getProperty("file.separator");
448 469
     }
449
-    
470
+
450 471
     /**
451 472
      * Creates a new group with the specified name.
452 473
      *
@@ -460,12 +481,12 @@ public final class ActionManager {
460 481
         assert(group != null);
461 482
         assert(!group.isEmpty());
462 483
         assert(!groups.containsKey(group));
463
-        
484
+
464 485
         if (new File(getDirectory() + group).mkdir()) {
465 486
             groups.put(group, new ActionGroup(group));
466 487
         }
467 488
     }
468
-    
489
+
469 490
     /**
470 491
      * Removes the group with the specified name.
471 492
      *
@@ -474,18 +495,18 @@ public final class ActionManager {
474 495
     @Precondition({
475 496
         "The specified group is non-null and not empty",
476 497
         "The specified group is an existing group"
477
-    })    
498
+    })
478 499
     public static void removeGroup(final String group) {
479 500
         assert(group != null);
480 501
         assert(!group.isEmpty());
481 502
         assert(groups.containsKey(group));
482
-        
503
+
483 504
         for (Action action : new ArrayList<Action>(groups.get(group))) {
484 505
             unregisterAction(action);
485 506
         }
486
-        
507
+
487 508
         final File dir = new File(getDirectory() + group);
488
-        
509
+
489 510
         for (File file : dir.listFiles()) {
490 511
             if (!file.delete()) {
491 512
                 Logger.userError(ErrorLevel.MEDIUM, "Unable to remove file: "
@@ -493,16 +514,16 @@ public final class ActionManager {
493 514
                 return;
494 515
             }
495 516
         }
496
-        
517
+
497 518
         if (!dir.delete()) {
498 519
             Logger.userError(ErrorLevel.MEDIUM, "Unable to remove directory: "
499 520
                     + dir.getAbsolutePath());
500 521
             return;
501 522
         }
502
-        
523
+
503 524
         groups.remove(group);
504 525
     }
505
-    
526
+
506 527
     /**
507 528
      * Renames the specified group.
508 529
      *
@@ -515,7 +536,7 @@ public final class ActionManager {
515 536
         "The new name is non-null and not empty",
516 537
         "The new name is not an existing group",
517 538
         "The old name does not equal the new name"
518
-    })    
539
+    })
519 540
     public static void renameGroup(final String oldName, final String newName) {
520 541
         assert(oldName != null);
521 542
         assert(!oldName.isEmpty());
@@ -524,19 +545,19 @@ public final class ActionManager {
524 545
         assert(groups.containsKey(oldName));
525 546
         assert(!groups.containsKey(newName));
526 547
         assert(!newName.equals(oldName));
527
-        
548
+
528 549
         makeGroup(newName);
529
-        
550
+
530 551
         for (Action action : groups.get(oldName)) {
531 552
             action.setGroup(newName);
532 553
             getGroup(newName).add(action);
533 554
         }
534
-        
555
+
535 556
         groups.remove(oldName);
536
-        
557
+
537 558
         removeGroup(oldName);
538 559
     }
539
-    
560
+
540 561
     /**
541 562
      * Returns the action comparison specified by the given string, or null if it
542 563
      * doesn't match a valid registered action comparison.
@@ -548,16 +569,16 @@ public final class ActionManager {
548 569
         if (type == null || type.isEmpty()) {
549 570
             return null;
550 571
         }
551
-        
572
+
552 573
         for (ActionType target : actionTypes) {
553 574
             if (((Enum) target).name().equals(type)) {
554 575
                 return target;
555 576
             }
556 577
         }
557
-        
578
+
558 579
         return null;
559 580
     }
560
-    
581
+
561 582
     /**
562 583
      * Returns a list of action types that are compatible with the one
563 584
      * specified.
@@ -568,17 +589,17 @@ public final class ActionManager {
568 589
     @Precondition("The specified type is not null")
569 590
     public static List<ActionType> getCompatibleTypes(final ActionType type) {
570 591
         assert(type != null);
571
-        
592
+
572 593
         final List<ActionType> res = new ArrayList<ActionType>();
573 594
         for (ActionType target : actionTypes) {
574 595
             if (!target.equals(type) && target.getType().equals(type.getType())) {
575 596
                 res.add(target);
576 597
             }
577 598
         }
578
-        
599
+
579 600
         return res;
580 601
     }
581
-    
602
+
582 603
     /**
583 604
      * Returns a list of action components that are compatible with the
584 605
      * specified class.
@@ -589,17 +610,17 @@ public final class ActionManager {
589 610
     @Precondition("The specified target is not null")
590 611
     public static List<ActionComponent> getCompatibleComponents(final Class target) {
591 612
         assert(target != null);
592
-        
613
+
593 614
         final List<ActionComponent> res = new ArrayList<ActionComponent>();
594 615
         for (ActionComponent subject : actionComponents) {
595 616
             if (subject.appliesTo().equals(target)) {
596 617
                 res.add(subject);
597 618
             }
598 619
         }
599
-        
620
+
600 621
         return res;
601 622
     }
602
-    
623
+
603 624
     /**
604 625
      * Returns a list of action comparisons that are compatible with the
605 626
      * specified class.
@@ -610,17 +631,17 @@ public final class ActionManager {
610 631
     @Precondition("The specified target is not null")
611 632
     public static List<ActionComparison> getCompatibleComparisons(final Class target) {
612 633
         assert(target != null);
613
-        
634
+
614 635
         final List<ActionComparison> res = new ArrayList<ActionComparison>();
615 636
         for (ActionComparison subject : actionComparisons) {
616 637
             if (subject.appliesTo().equals(target)) {
617 638
                 res.add(subject);
618 639
             }
619 640
         }
620
-        
641
+
621 642
         return res;
622 643
     }
623
-    
644
+
624 645
     /**
625 646
      * Returns a list of all the action types registered by this manager.
626 647
      *
@@ -629,7 +650,7 @@ public final class ActionManager {
629 650
     public static List<ActionType> getTypes() {
630 651
         return actionTypes;
631 652
     }
632
-    
653
+
633 654
     /**
634 655
      * Returns a list of all the action types registered by this manager.
635 656
      *
@@ -638,7 +659,7 @@ public final class ActionManager {
638 659
     public static List<ActionComparison> getComparisons() {
639 660
         return actionComparisons;
640 661
     }
641
-    
662
+
642 663
     /**
643 664
      * Returns the action component specified by the given string, or null if it
644 665
      * doesn't match a valid registered action component.
@@ -650,16 +671,16 @@ public final class ActionManager {
650 671
     public static ActionComponent getActionComponent(final String type) {
651 672
         assert(type != null);
652 673
         assert(!type.isEmpty());
653
-        
674
+
654 675
         for (ActionComponent target : actionComponents) {
655 676
             if (((Enum) target).name().equals(type)) {
656 677
                 return target;
657 678
             }
658 679
         }
659
-        
680
+
660 681
         return null;
661 682
     }
662
-    
683
+
663 684
     /**
664 685
      * Returns the action type specified by the given string, or null if it
665 686
      * doesn't match a valid registered action type.
@@ -671,35 +692,35 @@ public final class ActionManager {
671 692
     public static ActionComparison getActionComparison(final String type) {
672 693
         assert(type != null);
673 694
         assert(!type.isEmpty());
674
-        
695
+
675 696
         for (ActionComparison target : actionComparisons) {
676 697
             if (((Enum) target).name().equals(type)) {
677 698
                 return target;
678 699
             }
679 700
         }
680
-        
701
+
681 702
         return null;
682 703
     }
683
-    
704
+
684 705
     /**
685 706
      * Installs an action pack located at the specified path.
686
-     * 
707
+     *
687 708
      * @param path The full path of the action pack .zip.
688 709
      * @throws IOException If the zip cannot be extracted
689 710
      */
690 711
     public static void installActionPack(final String path) throws IOException {
691 712
         final ZipResourceManager ziprm = ZipResourceManager.getInstance(path);
692
-        
713
+
693 714
         ziprm.extractResources("", getDirectory());
694
-        
715
+
695 716
         loadActions();
696
-        
697
-        new File(path).delete();        
717
+
718
+        new File(path).delete();
698 719
     }
699
-    
720
+
700 721
     /**
701 722
      * Adds a new listener for the specified action type.
702
-     * 
723
+     *
703 724
      * @param types The action types that are to be listened for
704 725
      * @param listener The listener to be added
705 726
      */
@@ -708,10 +729,10 @@ public final class ActionManager {
708 729
             listeners.add(type, listener);
709 730
         }
710 731
     }
711
-    
732
+
712 733
     /**
713 734
      * Removes a listener for the specified action type.
714
-     * 
735
+     *
715 736
      * @param types The action types that were being listened for
716 737
      * @param listener The listener to be removed
717 738
      */
@@ -720,13 +741,13 @@ public final class ActionManager {
720 741
             listeners.remove(type, listener);
721 742
         }
722 743
     }
723
-    
744
+
724 745
     /**
725 746
      * Removes a listener for all action types.
726
-     * 
747
+     *
727 748
      * @param listener The listener to be removed
728 749
      */
729 750
     public static void removeListener(final ActionListener listener) {
730 751
         listeners.removeFromAll(listener);
731
-    }    
752
+    }
732 753
 }

+ 1
- 1
src/com/dmdirc/actions/defaults/umodes/ov View File

@@ -24,4 +24,4 @@ metadata:
24 24
   description=Automatically sets the popup.umodes setting when connecting to a server, so that the correct user modes appear in the nicklist popup.
25 25
   author=Chris <chris@dmdirc.com>
26 26
   version=2
27
-  component=umodes
27
+  component=19

+ 3
- 3
src/com/dmdirc/config/ConfigManager.java View File

@@ -23,7 +23,7 @@
23 23
 package com.dmdirc.config;
24 24
 
25 25
 import com.dmdirc.interfaces.ConfigChangeListener;
26
-import com.dmdirc.util.WeakMapList;
26
+import com.dmdirc.util.MapList;
27 27
 
28 28
 import java.io.Serializable;
29 29
 import java.util.ArrayList;
@@ -56,8 +56,8 @@ public final class ConfigManager extends ConfigSource implements Serializable,
56 56
     private List<Identity> sources;
57 57
     
58 58
     /** The listeners registered for this manager. */
59
-    private final WeakMapList<String, ConfigChangeListener> listeners
60
-            = new WeakMapList<String, ConfigChangeListener>();
59
+    private final MapList<String, ConfigChangeListener> listeners
60
+            = new MapList<String, ConfigChangeListener>();
61 61
     
62 62
     /** The ircd this manager is for. */
63 63
     private final String ircd;

Loading…
Cancel
Save