Quellcode durchsuchen

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 vor 10 Jahren
Ursprung
Commit
87cd3e23b6

+ 1
- 1
src/com/dmdirc/addons/dcc/ChatContainer.java Datei anzeigen

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

+ 3
- 20
src/com/dmdirc/addons/dcc/DCCCommandParser.java Datei anzeigen

@@ -32,10 +32,7 @@ import com.dmdirc.interfaces.config.AggregateConfigProvider;
32 32
 /**
33 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 37
     /** A version number for this class. */
41 38
     private static final long serialVersionUID = 2009290901;
@@ -45,23 +42,10 @@ public final class DCCCommandParser extends GlobalCommandParser {
45 42
      *
46 43
      * @param configManager Config manager
47 44
      */
48
-    private DCCCommandParser(final AggregateConfigProvider configManager) {
45
+    public DCCCommandParser(final AggregateConfigProvider configManager) {
49 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 49
     /** Loads the relevant commands into the parser. */
66 50
     @Override
67 51
     protected void loadCommands() {
@@ -77,8 +61,7 @@ public final class DCCCommandParser extends GlobalCommandParser {
77 61
      * @param line The line input by the user
78 62
      */
79 63
     @Override
80
-    protected void handleNonCommand(final FrameContainer origin,
81
-            final String line) {
64
+    protected void handleNonCommand(final FrameContainer origin, final String line) {
82 65
         ((WritableFrameContainer) origin).sendLine(line);
83 66
     }
84 67
 

Laden…
Abbrechen
Speichern