Procházet zdrojové kódy

Plugin support for FrameContainer changes.

Change-Id: Ida8887d4065db2f26080986a4c426c6de700d65c
Depends-On: I3b95185db3f7e6ef09a6c4f91cd28c88d2c601ba
Reviewed-on: http://gerrit.dmdirc.com/3106
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8
Chris Smith před 10 roky
rodič
revize
266876cfa3

+ 10
- 3
src/com/dmdirc/addons/dcc/ChatContainer.java Zobrazit soubor

@@ -30,6 +30,7 @@ import com.dmdirc.interfaces.config.AggregateConfigProvider;
30 30
 import com.dmdirc.messages.MessageSinkManager;
31 31
 import com.dmdirc.ui.core.components.WindowComponent;
32 32
 import com.dmdirc.ui.input.TabCompleterFactory;
33
+import com.dmdirc.util.URLBuilder;
33 34
 
34 35
 import java.util.Arrays;
35 36
 
@@ -56,17 +57,23 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
56 57
      * @param targetNick Nickname of target
57 58
      * @param tabCompleterFactory The factory to use to create tab completers.
58 59
      * @param messageSinkManager The sink manager to use to despatch messages.
60
+     * @param urlBuilder The URL builder to use when finding icons.
59 61
      */
60
-    public ChatContainer(final DCCChat dcc,
62
+    public ChatContainer(
63
+            final DCCChat dcc,
61 64
             final AggregateConfigProvider configManager,
62 65
             final CommandController commandController,
63
-            final String title, final String nick, final String targetNick,
66
+            final String title,
67
+            final String nick,
68
+            final String targetNick,
64 69
             final TabCompleterFactory tabCompleterFactory,
65
-            final MessageSinkManager messageSinkManager) {
70
+            final MessageSinkManager messageSinkManager,
71
+            final URLBuilder urlBuilder) {
66 72
         super(title, "dcc-chat-inactive", configManager,
67 73
                 new DCCCommandParser(configManager, commandController),
68 74
                 messageSinkManager,
69 75
                 tabCompleterFactory,
76
+                urlBuilder,
70 77
                 Arrays.asList(
71 78
                     WindowComponent.TEXTAREA.getIdentifier(),
72 79
                     WindowComponent.INPUTFIELD.getIdentifier()));

+ 10
- 4
src/com/dmdirc/addons/dcc/DCCCommand.java Zobrazit soubor

@@ -47,6 +47,7 @@ import com.dmdirc.ui.WindowManager;
47 47
 import com.dmdirc.ui.input.AdditionalTabTargets;
48 48
 import com.dmdirc.ui.input.TabCompleterFactory;
49 49
 import com.dmdirc.ui.input.TabCompletionType;
50
+import com.dmdirc.util.URLBuilder;
50 51
 
51 52
 import java.io.File;
52 53
 import java.util.concurrent.Callable;
@@ -75,6 +76,8 @@ public class DCCCommand extends Command implements IntelligentCommand {
75 76
     private final MessageSinkManager messageSinkManager;
76 77
     /** The factory to use for tab completers. */
77 78
     private final TabCompleterFactory tabCompleterFactory;
79
+    /** The URL builder to use when finding icons. */
80
+    private final URLBuilder urlBuilder;
78 81
 
79 82
     /**
80 83
      * Creates a new instance of DCCCommand.
@@ -85,6 +88,7 @@ public class DCCCommand extends Command implements IntelligentCommand {
85 88
      * @param messageSinkManager The sink manager to use to despatch messages.
86 89
      * @param windowManager Window management
87 90
      * @param tabCompleterFactory The factory to use for tab completers.
91
+     * @param urlBuilder The URL builder to use when finding icons.
88 92
      */
89 93
     @Inject
90 94
     public DCCCommand(
@@ -93,13 +97,15 @@ public class DCCCommand extends Command implements IntelligentCommand {
93 97
             final DCCManager plugin,
94 98
             final MessageSinkManager messageSinkManager,
95 99
             final WindowManager windowManager,
96
-            final TabCompleterFactory tabCompleterFactory) {
100
+            final TabCompleterFactory tabCompleterFactory,
101
+            final URLBuilder urlBuilder) {
97 102
         super(controller);
98 103
         this.mainFrame = mainFrame;
99 104
         myPlugin = plugin;
100 105
         this.messageSinkManager = messageSinkManager;
101 106
         this.windowManager = windowManager;
102 107
         this.tabCompleterFactory = tabCompleterFactory;
108
+        this.urlBuilder = urlBuilder;
103 109
     }
104 110
 
105 111
     /** {@inheritDoc} */
@@ -167,7 +173,7 @@ public class DCCCommand extends Command implements IntelligentCommand {
167 173
         if (myPlugin.listen(chat)) {
168 174
             final ChatContainer window = new ChatContainer(chat, origin.getConfigManager(),
169 175
                     getController(), "*Chat: " + target, myNickname, target, tabCompleterFactory,
170
-                    messageSinkManager);
176
+                    messageSinkManager, urlBuilder);
171 177
             windowManager.addWindow(myPlugin.getContainer(), window);
172 178
             parser.sendCTCP(target, "DCC", "CHAT chat " + DCC.ipToLong(
173 179
                     myPlugin.getListenIP(parser)) + " " + chat.getPort());
@@ -246,7 +252,7 @@ public class DCCCommand extends Command implements IntelligentCommand {
246 252
                     final Parser parser = connection.getParser();
247 253
                     final TransferContainer container = new TransferContainer(myPlugin, send,
248 254
                             origin.getConfigManager(), "Send: " + target,
249
-                            target, connection);
255
+                            target, connection, urlBuilder);
250 256
                     windowManager.addWindow(myPlugin.getContainer(), container);
251 257
                     parser.sendCTCP(target, "DCC", "SEND \""
252 258
                             + selectedFile.getName() + "\" "
@@ -259,7 +265,7 @@ public class DCCCommand extends Command implements IntelligentCommand {
259 265
                     if (myPlugin.listen(send)) {
260 266
                         final TransferContainer container = new TransferContainer(myPlugin, send,
261 267
                                 origin.getConfigManager(), "*Send: "
262
-                                + target, target, connection);
268
+                                + target, target, connection, urlBuilder);
263 269
                         windowManager.addWindow(myPlugin.getContainer(), container);
264 270
                         parser.sendCTCP(target, "DCC", "SEND \""
265 271
                                 + selectedFile.getName() + "\" "

+ 9
- 3
src/com/dmdirc/addons/dcc/DCCFrameContainer.java Zobrazit soubor

@@ -29,6 +29,7 @@ import com.dmdirc.interfaces.config.AggregateConfigProvider;
29 29
 import com.dmdirc.messages.MessageSinkManager;
30 30
 import com.dmdirc.ui.input.TabCompleter;
31 31
 import com.dmdirc.ui.input.TabCompleterFactory;
32
+import com.dmdirc.util.URLBuilder;
32 33
 
33 34
 import java.util.Collection;
34 35
 
@@ -52,15 +53,20 @@ public abstract class DCCFrameContainer extends WritableFrameContainer {
52 53
      * @param parser Command parser to use for this window
53 54
      * @param messageSinkManager The sink manager to use to despatch messages.
54 55
      * @param tabCompleterFactory The factory to use to create tab completers.
56
+     * @param urlBuilder The URL builder to use when finding icons.
55 57
      * @param components The UI components that this frame requires
56 58
      */
57 59
     public DCCFrameContainer(
58
-            final String title, final String icon,
59
-            final AggregateConfigProvider configManager, final CommandParser parser,
60
+            final String title,
61
+            final String icon,
62
+            final AggregateConfigProvider configManager,
63
+            final CommandParser parser,
60 64
             final MessageSinkManager messageSinkManager,
61 65
             final TabCompleterFactory tabCompleterFactory,
66
+            final URLBuilder urlBuilder,
62 67
             final Collection<String> components) {
63
-        super(icon, title, title, configManager, parser, messageSinkManager, components);
68
+        super(icon, title, title, configManager, parser, messageSinkManager, urlBuilder,
69
+                components);
64 70
         this.tabCompleterFactory = tabCompleterFactory;
65 71
     }
66 72
 

+ 10
- 4
src/com/dmdirc/addons/dcc/DCCManager.java Zobrazit soubor

@@ -57,6 +57,7 @@ import com.dmdirc.parser.interfaces.Parser;
57 57
 import com.dmdirc.plugins.PluginInfo;
58 58
 import com.dmdirc.ui.WindowManager;
59 59
 import com.dmdirc.ui.input.TabCompleterFactory;
60
+import com.dmdirc.util.URLBuilder;
60 61
 
61 62
 import java.io.File;
62 63
 import java.io.IOException;
@@ -94,6 +95,8 @@ public class DCCManager implements ActionListener {
94 95
     private final MainFrame mainFrame;
95 96
     /** The configuration domain to use. */
96 97
     private final String domain;
98
+    /** The URL builder to use when finding icons. */
99
+    private final URLBuilder urlBuilder;
97 100
 
98 101
     /**
99 102
      * Creates a new instance of this plugin.
@@ -108,6 +111,7 @@ public class DCCManager implements ActionListener {
108 111
      * @param tabCompleterFactory The factory to use for tab completers.
109 112
      * @param windowFactory The window factory to register the DCC implementations with.
110 113
      * @param componentFrameFactory Factory to use to create new component frames for DCC windows.
114
+     * @param urlBuilder The URL builder to use when finding icons.
111 115
      * @param baseDirectory The directory to create a downloads directory within.
112 116
      */
113 117
     @Inject
@@ -122,6 +126,7 @@ public class DCCManager implements ActionListener {
122 126
             final TabCompleterFactory tabCompleterFactory,
123 127
             final SwingWindowFactory windowFactory,
124 128
             final ComponentFrameFactory componentFrameFactory,
129
+            final URLBuilder urlBuilder,
125 130
             @Directory(DirectoryType.BASE) final String baseDirectory) {
126 131
         this.mainFrame = mainFrame;
127 132
         this.messageSinkManager = messageSinkManager;
@@ -131,6 +136,7 @@ public class DCCManager implements ActionListener {
131 136
         this.domain = pluginInfo.getDomain();
132 137
         this.config = globalConfig;
133 138
         this.pluginInfo = pluginInfo;
139
+        this.urlBuilder = urlBuilder;
134 140
 
135 141
         windowFactory.registerImplementation(
136 142
                 new HashSet<>(Arrays.asList("com.dmdirc.addons.dcc.ui.PlaceholderPanel")),
@@ -224,7 +230,7 @@ public class DCCManager implements ActionListener {
224 230
                 final boolean resume = handleResume(jc);
225 231
                 if (reverse && !token.isEmpty()) {
226 232
                     TransferContainer container = new TransferContainer(DCCManager.this, send,
227
-                            config, "*Receive: " + nickname, nickname, null);
233
+                            config, "*Receive: " + nickname, nickname, null, urlBuilder);
228 234
                     windowManager.addWindow(getContainer(), container);
229 235
                     send.setToken(token);
230 236
                     if (resume) {
@@ -250,7 +256,7 @@ public class DCCManager implements ActionListener {
250 256
                     }
251 257
                 } else {
252 258
                     TransferContainer container = new TransferContainer(DCCManager.this, send,
253
-                            config, "Receive: " + nickname, nickname, null);
259
+                            config, "Receive: " + nickname, nickname, null, urlBuilder);
254 260
                     windowManager.addWindow(getContainer(), container);
255 261
                     if (resume) {
256 262
                         parser.sendCTCP(nickname, "DCC", "RESUME "
@@ -437,7 +443,7 @@ public class DCCManager implements ActionListener {
437 443
                     .getLocalClient().getNickname();
438 444
             final DCCFrameContainer f = new ChatContainer(chat, config, commandController,
439 445
                     "Chat: " + nickname, myNickname, nickname, tabCompleterFactory,
440
-                    messageSinkManager);
446
+                    messageSinkManager, urlBuilder);
441 447
             windowManager.addWindow(getContainer(), f);
442 448
             f.addLine("DCCChatStarting", nickname, chat.getHost(),
443 449
                     chat.getPort());
@@ -686,7 +692,7 @@ public class DCCManager implements ActionListener {
686 692
      * Create the container window.
687 693
      */
688 694
     protected void createContainer() {
689
-        container = new PlaceholderContainer(this, config, mainFrame);
695
+        container = new PlaceholderContainer(this, config, mainFrame, urlBuilder);
690 696
         windowManager.addWindow(container);
691 697
     }
692 698
 

+ 6
- 3
src/com/dmdirc/addons/dcc/PlaceholderContainer.java Zobrazit soubor

@@ -27,6 +27,7 @@ import com.dmdirc.addons.ui_swing.MainFrame;
27 27
 import com.dmdirc.addons.ui_swing.dialogs.StandardQuestionDialog;
28 28
 import com.dmdirc.interfaces.Connection;
29 29
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
30
+import com.dmdirc.util.URLBuilder;
30 31
 
31 32
 import java.awt.Dialog.ModalityType;
32 33
 import java.util.Arrays;
@@ -47,13 +48,15 @@ public class PlaceholderContainer extends FrameContainer {
47 48
      * @param plugin The plugin which owns this placeholder
48 49
      * @param config Config manager
49 50
      * @param mainFrame Frame that will own new dialogs.
51
+     * @param urlBuilder The URL builder to use when finding icons.
50 52
      */
51 53
     public PlaceholderContainer(
52 54
             final DCCManager plugin,
53 55
             final AggregateConfigProvider config,
54
-            final MainFrame mainFrame) {
55
-        super("dcc", "DCCs", "DCCs", config, Arrays.asList(
56
-                "com.dmdirc.addons.dcc.ui.PlaceholderPanel"));
56
+            final MainFrame mainFrame,
57
+            final URLBuilder urlBuilder) {
58
+        super("dcc", "DCCs", "DCCs", config, urlBuilder,
59
+                Arrays.asList("com.dmdirc.addons.dcc.ui.PlaceholderPanel"));
57 60
         this.plugin = plugin;
58 61
         this.mainFrame = mainFrame;
59 62
     }

+ 4
- 2
src/com/dmdirc/addons/dcc/TransferContainer.java Zobrazit soubor

@@ -32,6 +32,7 @@ import com.dmdirc.interfaces.Connection;
32 32
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
33 33
 import com.dmdirc.parser.interfaces.Parser;
34 34
 import com.dmdirc.parser.interfaces.callbacks.SocketCloseListener;
35
+import com.dmdirc.util.URLBuilder;
35 36
 
36 37
 import java.awt.Desktop;
37 38
 import java.io.File;
@@ -90,13 +91,14 @@ public class TransferContainer extends FrameContainer implements
90 91
      * @param title The title of this window
91 92
      * @param targetNick Nickname of target
92 93
      * @param connection The connection that the send was that initiated on
94
+     * @param urlBuilder The URL builder to use when finding icons.
93 95
      */
94 96
     public TransferContainer(final DCCManager plugin, final DCCTransfer dcc,
95 97
             final AggregateConfigProvider config, final String title,
96
-            final String targetNick, final Connection connection) {
98
+            final String targetNick, final Connection connection, final URLBuilder urlBuilder) {
97 99
         super(dcc.getType() == DCCTransfer.TransferType.SEND
98 100
                 ? "dcc-send-inactive" : "dcc-receive-inactive",
99
-                title, title, config,
101
+                title, title, config, urlBuilder,
100 102
                 Arrays.asList("com.dmdirc.addons.dcc.ui.TransferPanel"));
101 103
         this.plugin = plugin;
102 104
         this.dcc = dcc;

+ 9
- 3
src/com/dmdirc/addons/logging/HistoryWindow.java Zobrazit soubor

@@ -25,6 +25,7 @@ package com.dmdirc.addons.logging;
25 25
 import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.interfaces.Connection;
27 27
 import com.dmdirc.ui.core.components.WindowComponent;
28
+import com.dmdirc.util.URLBuilder;
28 29
 import com.dmdirc.util.io.ReverseFileReader;
29 30
 
30 31
 import java.util.Arrays;
@@ -40,11 +41,16 @@ public class HistoryWindow extends FrameContainer {
40 41
      * @param title The title of the window
41 42
      * @param reader The reader to use to get the history
42 43
      * @param parent The window this history window was opened from
44
+     * @param urlBuilder The URL builder to use when finding icons.
43 45
      * @param numLines The number of lines to show
44 46
      */
45
-    public HistoryWindow(final String title, final ReverseFileReader reader,
46
-                         final FrameContainer parent, final int numLines) {
47
-        super("raw", title, title, parent.getConfigManager(),
47
+    public HistoryWindow(
48
+            final String title,
49
+            final ReverseFileReader reader,
50
+            final FrameContainer parent,
51
+            final URLBuilder urlBuilder,
52
+            final int numLines) {
53
+        super("raw", title, title, parent.getConfigManager(), urlBuilder,
48 54
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier()));
49 55
 
50 56
         final int frameBufferSize = parent.getConfigManager().getOptionInt(

+ 8
- 2
src/com/dmdirc/addons/logging/LoggingPlugin.java Zobrazit soubor

@@ -50,6 +50,7 @@ import com.dmdirc.plugins.PluginInfo;
50 50
 import com.dmdirc.plugins.implementations.BaseCommandPlugin;
51 51
 import com.dmdirc.ui.WindowManager;
52 52
 import com.dmdirc.ui.messages.Styliser;
53
+import com.dmdirc.util.URLBuilder;
53 54
 import com.dmdirc.util.io.ReverseFileReader;
54 55
 import com.dmdirc.util.io.StreamUtils;
55 56
 
@@ -121,6 +122,7 @@ public class LoggingPlugin extends BaseCommandPlugin implements ActionListener,
121 122
 
122 123
     /** Date format used for "File Opened At" log. */
123 124
     final DateFormat openedAtFormat = new SimpleDateFormat("EEEE MMMM dd, yyyy - HH:mm:ss");
125
+    private final URLBuilder urlBuilder;
124 126
 
125 127
     /**
126 128
      * Creates a new instance of this plugin.
@@ -130,15 +132,18 @@ public class LoggingPlugin extends BaseCommandPlugin implements ActionListener,
130 132
      * @param identityController The Identity Manager that controls the current config
131 133
      * @param commandController Command controller to register commands
132 134
      * @param windowManager The manager to add history windows to.
135
+     * @param urlBuilder The URL builder to use when finding icons.
133 136
      */
134 137
     public LoggingPlugin(final PluginInfo pluginInfo,
135 138
             final ActionController actionController,
136 139
             final IdentityController identityController,
137 140
             final CommandController commandController,
138
-            final WindowManager windowManager) {
141
+            final WindowManager windowManager,
142
+            final URLBuilder urlBuilder) {
139 143
         super(commandController);
140 144
         this.identityController = identityController;
141 145
         this.windowManager = windowManager;
146
+        this.urlBuilder = urlBuilder;
142 147
 
143 148
         this.pluginInfo = pluginInfo;
144 149
         this.actionController = actionController;
@@ -884,7 +889,8 @@ public class LoggingPlugin extends BaseCommandPlugin implements ActionListener,
884 889
             return false;
885 890
         }
886 891
 
887
-        HistoryWindow window = new HistoryWindow("History", reader, target, historyLines);
892
+        final HistoryWindow window = new HistoryWindow("History", reader, target, urlBuilder,
893
+                historyLines);
888 894
         windowManager.addWindow(target, window);
889 895
 
890 896
         return true;

+ 8
- 3
src/com/dmdirc/addons/parserdebug/DebugPlugin.java Zobrazit soubor

@@ -32,6 +32,7 @@ import com.dmdirc.parser.interfaces.Parser;
32 32
 import com.dmdirc.parser.interfaces.callbacks.DebugInfoListener;
33 33
 import com.dmdirc.plugins.implementations.BaseCommandPlugin;
34 34
 import com.dmdirc.ui.WindowManager;
35
+import com.dmdirc.util.URLBuilder;
35 36
 
36 37
 import java.util.ArrayList;
37 38
 import java.util.Date;
@@ -55,15 +56,19 @@ public final class DebugPlugin extends BaseCommandPlugin implements
55 56
      * @param actionController The action controller to register listeners with
56 57
      * @param commandController Command controller to register commands
57 58
      * @param windowManager Window Manager
59
+     * @param urlBuilder The URL builder to use when finding icons.
58 60
      */
59
-    public DebugPlugin(final ActionController actionController,
61
+    public DebugPlugin(
62
+            final ActionController actionController,
60 63
             final CommandController commandController,
61
-            final WindowManager windowManager) {
64
+            final WindowManager windowManager,
65
+            final URLBuilder urlBuilder) {
62 66
         super(commandController);
63 67
 
64 68
         this.actionController = actionController;
65 69
 
66
-        registerCommand(new ParserDebugCommand(commandController, this, windowManager), ParserDebugCommand.INFO);
70
+        registerCommand(new ParserDebugCommand(commandController, this, windowManager, urlBuilder),
71
+                ParserDebugCommand.INFO);
67 72
     }
68 73
 
69 74
     /** {@inheritDoc} */

+ 9
- 2
src/com/dmdirc/addons/parserdebug/DebugWindow.java Zobrazit soubor

@@ -28,6 +28,7 @@ import com.dmdirc.interfaces.Connection;
28 28
 import com.dmdirc.parser.interfaces.Parser;
29 29
 import com.dmdirc.parser.interfaces.callbacks.DebugInfoListener;
30 30
 import com.dmdirc.ui.core.components.WindowComponent;
31
+import com.dmdirc.util.URLBuilder;
31 32
 
32 33
 import java.util.Arrays;
33 34
 
@@ -50,9 +51,15 @@ public class DebugWindow extends FrameContainer {
50 51
      * @param title The title of this window
51 52
      * @param parser The parser this plugin is debugging
52 53
      * @param server The Server window this is a child of
54
+     * @param urlBuilder The URL builder to use when finding icons.
53 55
      */
54
-    public DebugWindow(final DebugPlugin plugin, final String title, final Parser parser, final Server server) {
55
-        super("raw", "Parser Debug", title, server.getConfigManager(),
56
+    public DebugWindow(
57
+            final DebugPlugin plugin,
58
+            final String title,
59
+            final Parser parser,
60
+            final Server server,
61
+            final URLBuilder urlBuilder) {
62
+        super("raw", "Parser Debug", title, server.getConfigManager(), urlBuilder,
56 63
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier()));
57 64
         this.plugin = plugin;
58 65
         this.parser = parser;

+ 10
- 2
src/com/dmdirc/addons/parserdebug/ParserDebugCommand.java Zobrazit soubor

@@ -35,6 +35,7 @@ import com.dmdirc.interfaces.CommandController;
35 35
 import com.dmdirc.parser.interfaces.Parser;
36 36
 import com.dmdirc.parser.interfaces.callbacks.DebugInfoListener;
37 37
 import com.dmdirc.ui.WindowManager;
38
+import com.dmdirc.util.URLBuilder;
38 39
 
39 40
 /**
40 41
  * The ParserDebug Command allows controlling of which parsers spam debug info.
@@ -51,6 +52,7 @@ public final class ParserDebugCommand extends Command {
51 52
     final DebugPlugin myPlugin;
52 53
     /** Window management. */
53 54
     private final WindowManager windowManager;
55
+    private final URLBuilder urlBuilder;
54 56
 
55 57
     /**
56 58
      * Creates a new instance of ParserDebugCommand.
@@ -58,11 +60,17 @@ public final class ParserDebugCommand extends Command {
58 60
      * @param controller The controller to use for command information.
59 61
      * @param plugin Plugin that owns this command
60 62
      * @param windowManager Window management
63
+     * @param urlBuilder The URL builder to use when finding icons.
61 64
      */
62
-    public ParserDebugCommand(final CommandController controller, final DebugPlugin plugin, final WindowManager windowManager) {
65
+    public ParserDebugCommand(
66
+            final CommandController controller,
67
+            final DebugPlugin plugin,
68
+            final WindowManager windowManager,
69
+            final URLBuilder urlBuilder) {
63 70
         super(controller);
64 71
         myPlugin = plugin;
65 72
         this.windowManager = windowManager;
73
+        this.urlBuilder = urlBuilder;
66 74
     }
67 75
 
68 76
     /**
@@ -99,7 +107,7 @@ public final class ParserDebugCommand extends Command {
99 107
             try {
100 108
                 parser.getCallbackManager().addCallback(DebugInfoListener.class, myPlugin);
101 109
                 final DebugWindow window = new DebugWindow(myPlugin,
102
-                        "Parser Debug", parser, (Server) origin.getConnection());
110
+                        "Parser Debug", parser, (Server) origin.getConnection(), urlBuilder);
103 111
                 windowManager.addWindow((Server) origin.getConnection(), window);
104 112
                 myPlugin.registeredParsers.put(parser, window);
105 113
                 sendLine(origin, isSilent, FORMAT_OUTPUT, "Adding callback ok");

+ 6
- 3
src/com/dmdirc/addons/redirect/FakeWriteableFrameContainer.java Zobrazit soubor

@@ -28,6 +28,7 @@ import com.dmdirc.interfaces.Connection;
28 28
 import com.dmdirc.messages.MessageSinkManager;
29 29
 import com.dmdirc.ui.input.TabCompleter;
30 30
 import com.dmdirc.ui.messages.Formatter;
31
+import com.dmdirc.util.URLBuilder;
31 32
 
32 33
 import java.util.Collections;
33 34
 import java.util.Date;
@@ -46,13 +47,15 @@ public class FakeWriteableFrameContainer extends WritableFrameContainer {
46 47
      *
47 48
      * @param target The message target that output gets sent to
48 49
      * @param messageSinkManager The sink manager to use to despatch messages.
50
+     * @param urlBuilder The URL builder to use when finding icons.
49 51
      */
50 52
     public FakeWriteableFrameContainer(
51 53
             final MessageTarget target,
52
-            final MessageSinkManager messageSinkManager) {
54
+            final MessageSinkManager messageSinkManager,
55
+            final URLBuilder urlBuilder) {
53 56
         super(target.getIcon(), target.getName(), target.getTitle(),
54
-                target.getConfigManager(), target.getCommandParser(),
55
-                messageSinkManager, Collections.<String>emptyList());
57
+                target.getConfigManager(), target.getCommandParser(), messageSinkManager,
58
+                urlBuilder, Collections.<String>emptyList());
56 59
         this.target = target;
57 60
     }
58 61
 

+ 8
- 2
src/com/dmdirc/addons/redirect/RedirectCommand.java Zobrazit soubor

@@ -35,6 +35,7 @@ import com.dmdirc.interfaces.CommandController;
35 35
 import com.dmdirc.messages.MessageSinkManager;
36 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
37 37
 import com.dmdirc.ui.input.TabCompleter;
38
+import com.dmdirc.util.URLBuilder;
38 39
 
39 40
 /**
40 41
  * The redirect command allows the user to redirect the output from another
@@ -51,18 +52,23 @@ public class RedirectCommand extends Command implements IntelligentCommand {
51 52
 
52 53
     /** The sink manager to use to despatch messages. */
53 54
     private final MessageSinkManager messageSinkManager;
55
+    /** The URL builder to use when finding icons. */
56
+    private final URLBuilder urlBuilder;
54 57
 
55 58
     /**
56 59
      * Creates a new instance of this command.
57 60
      *
58 61
      * @param controller The controller to use for command information.
59 62
      * @param messageSinkManager The sink manager to use to despatch messages.
63
+     * @param urlBuilder The URL builder to use when finding icons.
60 64
      */
61 65
     public RedirectCommand(
62 66
             final CommandController controller,
63
-            final MessageSinkManager messageSinkManager) {
67
+            final MessageSinkManager messageSinkManager,
68
+            final URLBuilder urlBuilder) {
64 69
         super(controller);
65 70
         this.messageSinkManager = messageSinkManager;
71
+        this.urlBuilder = urlBuilder;
66 72
     }
67 73
 
68 74
     /** {@inheritDoc} */
@@ -72,7 +78,7 @@ public class RedirectCommand extends Command implements IntelligentCommand {
72 78
         final MessageTarget target = ((ChatCommandContext) context)
73 79
                 .getChat();
74 80
         target.getCommandParser().parseCommand(new FakeWriteableFrameContainer(
75
-                target, messageSinkManager), args.getArgumentsAsString());
81
+                target, messageSinkManager, urlBuilder), args.getArgumentsAsString());
76 82
     }
77 83
 
78 84
     /** {@inheritDoc} */

+ 5
- 2
src/com/dmdirc/addons/redirect/RedirectPlugin.java Zobrazit soubor

@@ -25,6 +25,7 @@ package com.dmdirc.addons.redirect;
25 25
 import com.dmdirc.interfaces.CommandController;
26 26
 import com.dmdirc.messages.MessageSinkManager;
27 27
 import com.dmdirc.plugins.implementations.BaseCommandPlugin;
28
+import com.dmdirc.util.URLBuilder;
28 29
 
29 30
 /**
30 31
  * The redirect plugin allows the suer to redirect the output of commands that
@@ -37,12 +38,14 @@ public class RedirectPlugin extends BaseCommandPlugin {
37 38
      *
38 39
      * @param commandController Command controller to register commands
39 40
      * @param messageSinkManager The sink manager to use to despatch messages.
41
+     * @param urlBuilder The URL builder to use when finding icons.
40 42
      */
41 43
     public RedirectPlugin(
42 44
             final CommandController commandController,
43
-            final MessageSinkManager messageSinkManager) {
45
+            final MessageSinkManager messageSinkManager,
46
+            final URLBuilder urlBuilder) {
44 47
         super(commandController);
45
-        registerCommand(new RedirectCommand(commandController, messageSinkManager),
48
+        registerCommand(new RedirectCommand(commandController, messageSinkManager, urlBuilder),
46 49
                 RedirectCommand.INFO);
47 50
     }
48 51
 }

+ 2
- 2
src/com/dmdirc/addons/swingdebug/SwingDebugPlugin.java Zobrazit soubor

@@ -108,7 +108,7 @@ public class SwingDebugPlugin extends BasePlugin implements ActionListener {
108 108
         if (e.getSource() == showSysOut) {
109 109
             if (showSysOut.isSelected()) {
110 110
                 sysoutFrame = new SystemStreamContainer(SystemStreamType.Out,
111
-                        controller.getGlobalConfig(), this);
111
+                        controller.getGlobalConfig(), this, controller.getUrlBuilder());
112 112
                 windowManager.addWindow(sysoutFrame);
113 113
             } else {
114 114
                 sysoutFrame.close();
@@ -118,7 +118,7 @@ public class SwingDebugPlugin extends BasePlugin implements ActionListener {
118 118
         if (e.getSource() == showSysErr) {
119 119
             if (showSysErr.isSelected()) {
120 120
                 syserrFrame = new SystemStreamContainer(SystemStreamType.Error,
121
-                        controller.getGlobalConfig(), this);
121
+                        controller.getGlobalConfig(), this, controller.getUrlBuilder());
122 122
                 windowManager.addWindow(syserrFrame);
123 123
             } else {
124 124
                 syserrFrame.close();

+ 7
- 3
src/com/dmdirc/addons/swingdebug/SystemStreamContainer.java Zobrazit soubor

@@ -26,6 +26,7 @@ import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.interfaces.Connection;
27 27
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
28 28
 import com.dmdirc.ui.core.components.WindowComponent;
29
+import com.dmdirc.util.URLBuilder;
29 30
 
30 31
 import java.io.IOException;
31 32
 import java.util.Arrays;
@@ -46,11 +47,14 @@ public class SystemStreamContainer extends FrameContainer {
46 47
      * @param stream Stream to wrap
47 48
      * @param config Config to wrap
48 49
      * @param plugin Parent plugin
50
+     * @param urlBuilder The URL builder to use when finding icons.
49 51
      */
50
-    public SystemStreamContainer(final SystemStreamType stream,
52
+    public SystemStreamContainer(
53
+            final SystemStreamType stream,
51 54
             final AggregateConfigProvider config,
52
-            final SwingDebugPlugin plugin) {
53
-        super("dmdirc", stream.toString(), stream.toString(), config,
55
+            final SwingDebugPlugin plugin,
56
+            final URLBuilder urlBuilder) {
57
+        super("dmdirc", stream.toString(), stream.toString(), config, urlBuilder,
54 58
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier()));
55 59
         this.plugin = plugin;
56 60
         try {

+ 4
- 1
test/com/dmdirc/addons/redirect/RedirectCommandTest.java Zobrazit soubor

@@ -34,6 +34,7 @@ import com.dmdirc.interfaces.config.AggregateConfigProvider;
34 34
 import com.dmdirc.interfaces.ui.InputWindow;
35 35
 import com.dmdirc.messages.MessageSinkManager;
36 36
 import com.dmdirc.ui.WindowManager;
37
+import com.dmdirc.util.URLBuilder;
37 38
 
38 39
 import org.junit.Before;
39 40
 import org.junit.Test;
@@ -56,6 +57,7 @@ public class RedirectCommandTest {
56 57
     @Mock private CommandParser commandParser;
57 58
     @Mock private MessageSinkManager messageSinkManager;
58 59
     @Mock private WindowManager windowManager;
60
+    @Mock private URLBuilder urlBuilder;
59 61
 
60 62
     @Before
61 63
     public void setup() {
@@ -80,7 +82,8 @@ public class RedirectCommandTest {
80 82
 
81 83
     @Test
82 84
     public void testExecute() {
83
-        final RedirectCommand command = new RedirectCommand(commandController, messageSinkManager);
85
+        final RedirectCommand command = new RedirectCommand(commandController, messageSinkManager,
86
+                urlBuilder);
84 87
 
85 88
         command.execute(target, new CommandArguments(commandController, "/redirect /echo test"),
86 89
                 new ChatCommandContext(frameContainer, RedirectCommand.INFO, target));

Načítá se…
Zrušit
Uložit