Browse Source

Remove CallbackNotFoundException usages.

pull/412/head
Chris Smith 9 years ago
parent
commit
bc96850aa4
1 changed files with 18 additions and 35 deletions
  1. 18
    35
      parserdebug/src/com/dmdirc/addons/parserdebug/ParserDebugManager.java

+ 18
- 35
parserdebug/src/com/dmdirc/addons/parserdebug/ParserDebugManager.java View File

@@ -25,12 +25,10 @@ package com.dmdirc.addons.parserdebug;
25 25
 import com.dmdirc.DMDircMBassador;
26 26
 import com.dmdirc.events.ServerDisconnectedEvent;
27 27
 import com.dmdirc.interfaces.Connection;
28
-import com.dmdirc.parser.common.CallbackNotFoundException;
29 28
 import com.dmdirc.parser.events.DebugInfoEvent;
30 29
 import com.dmdirc.parser.interfaces.Parser;
31 30
 import com.dmdirc.ui.WindowManager;
32 31
 import com.dmdirc.ui.messages.BackBufferFactory;
33
-import com.dmdirc.util.URLBuilder;
34 32
 
35 33
 import java.util.Date;
36 34
 import java.util.HashMap;
@@ -52,7 +50,6 @@ public class ParserDebugManager {
52 50
 
53 51
     @Inject
54 52
     public ParserDebugManager(
55
-            final URLBuilder urlBuilder,
56 53
             final WindowManager windowManager,
57 54
             final DMDircMBassador eventBus,
58 55
             final BackBufferFactory backBufferFactory) {
@@ -92,23 +89,16 @@ public class ParserDebugManager {
92 89
      *
93 90
      * @param parser Parser to add
94 91
      * @param connection The connection associated with the parser
95
-     *
96
-     * @return Whether we added the parser without error
97 92
      */
98
-    public boolean addParser(final Parser parser, final Connection connection) {
99
-        try {
100
-            parser.getCallbackManager().subscribe(this);
101
-            final DebugWindow window = new DebugWindow(this, "Parser Debug", parser,
102
-                    connection, eventBus, backBufferFactory);
103
-            windowManager.addWindow(connection.getWindowModel(), window);
104
-            registeredParsers.put(parser, window);
105
-            window.addLine("======================", new Date());
106
-            window.addLine("Started Monitoring: " + parser, new Date());
107
-            window.addLine("======================", new Date());
108
-            return true;
109
-        } catch (CallbackNotFoundException ex) {
110
-            return false;
111
-        }
93
+    public void addParser(final Parser parser, final Connection connection) {
94
+        parser.getCallbackManager().subscribe(this);
95
+        final DebugWindow window = new DebugWindow(this, "Parser Debug", parser,
96
+                connection, eventBus, backBufferFactory);
97
+        windowManager.addWindow(connection.getWindowModel(), window);
98
+        registeredParsers.put(parser, window);
99
+        window.addLine("======================", new Date());
100
+        window.addLine("Started Monitoring: " + parser, new Date());
101
+        window.addLine("======================", new Date());
112 102
     }
113 103
 
114 104
     /**
@@ -116,24 +106,17 @@ public class ParserDebugManager {
116 106
      *
117 107
      * @param parser Parser to add
118 108
      * @param close  Close debug window?
119
-     *
120
-     * @return Whether removed the parser without error
121 109
      */
122
-    public boolean removeParser(final Parser parser, final boolean close) {
123
-        try {
124
-            parser.getCallbackManager().unsubscribe(this);
125
-            final DebugWindow window = registeredParsers.get(parser);
126
-            window.addLine("======================", new Date());
127
-            window.addLine("No Longer Monitoring: " + parser + " (User Requested)", new Date());
128
-            window.addLine("======================", new Date());
129
-            if (close) {
130
-                window.close();
131
-            }
132
-            registeredParsers.remove(parser);
133
-            return true;
134
-        } catch (CallbackNotFoundException ex) {
135
-            return false;
110
+    public void removeParser(final Parser parser, final boolean close) {
111
+        parser.getCallbackManager().unsubscribe(this);
112
+        final DebugWindow window = registeredParsers.get(parser);
113
+        window.addLine("======================", new Date());
114
+        window.addLine("No Longer Monitoring: " + parser + " (User Requested)", new Date());
115
+        window.addLine("======================", new Date());
116
+        if (close) {
117
+            window.close();
136 118
         }
119
+        registeredParsers.remove(parser);
137 120
     }
138 121
 
139 122
     /**

Loading…
Cancel
Save