Browse Source

Desingleton DccCommandParser.

Can't see why it was a singleton, really.

Change-Id: I40cdad3c634840fbecfc584995edc4bb133549f8
Reviewed-on: http://gerrit.dmdirc.com/2838
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8
Chris Smith 10 years ago
parent
commit
87cd3e23b6

+ 1
- 1
src/com/dmdirc/addons/dcc/ChatContainer.java View File

61
             final String nick, final String targetNick, final MessageSinkManager messageSinkManager,
61
             final String nick, final String targetNick, final MessageSinkManager messageSinkManager,
62
             final WindowManager windowManager) {
62
             final WindowManager windowManager) {
63
         super(title, "dcc-chat-inactive", configManager,
63
         super(title, "dcc-chat-inactive", configManager,
64
-                DCCCommandParser.getDCCCommandParser(configManager),
64
+                new DCCCommandParser(configManager),
65
                 messageSinkManager, windowManager,
65
                 messageSinkManager, windowManager,
66
                 Arrays.asList(
66
                 Arrays.asList(
67
                     WindowComponent.TEXTAREA.getIdentifier(),
67
                     WindowComponent.TEXTAREA.getIdentifier(),

+ 3
- 20
src/com/dmdirc/addons/dcc/DCCCommandParser.java View File

32
 /**
32
 /**
33
  * DCC CommandParser.
33
  * DCC CommandParser.
34
  */
34
  */
35
-public final class DCCCommandParser extends GlobalCommandParser {
36
-
37
-    /** The singleton instance of the DCC command parser. */
38
-    private static DCCCommandParser me;
35
+public class DCCCommandParser extends GlobalCommandParser {
39
 
36
 
40
     /** A version number for this class. */
37
     /** A version number for this class. */
41
     private static final long serialVersionUID = 2009290901;
38
     private static final long serialVersionUID = 2009290901;
45
      *
42
      *
46
      * @param configManager Config manager
43
      * @param configManager Config manager
47
      */
44
      */
48
-    private DCCCommandParser(final AggregateConfigProvider configManager) {
45
+    public DCCCommandParser(final AggregateConfigProvider configManager) {
49
         super(configManager, CommandManager.getCommandManager());
46
         super(configManager, CommandManager.getCommandManager());
50
     }
47
     }
51
 
48
 
52
-    /**
53
-     * Retrieves the singleton dcc command parser.
54
-     *
55
-     * @return The singleton DCCCommandParser
56
-     */
57
-    public static synchronized DCCCommandParser getDCCCommandParser(final AggregateConfigProvider configManager) {
58
-        if (me == null) {
59
-            me = new DCCCommandParser(configManager);
60
-        }
61
-
62
-        return me;
63
-    }
64
-
65
     /** Loads the relevant commands into the parser. */
49
     /** Loads the relevant commands into the parser. */
66
     @Override
50
     @Override
67
     protected void loadCommands() {
51
     protected void loadCommands() {
77
      * @param line The line input by the user
61
      * @param line The line input by the user
78
      */
62
      */
79
     @Override
63
     @Override
80
-    protected void handleNonCommand(final FrameContainer origin,
81
-            final String line) {
64
+    protected void handleNonCommand(final FrameContainer origin, final String line) {
82
         ((WritableFrameContainer) origin).sendLine(line);
65
         ((WritableFrameContainer) origin).sendLine(line);
83
     }
66
     }
84
 
67
 

Loading…
Cancel
Save