瀏覽代碼

Massive window changes.

Highlights:

  - FrameContainers are now generic, according to their window type
  - Writable frame containers now handle their tab completers
  - Redirect plugin works again
  - Windows are no longer actively requested from the UI; the UI
    creates and adds them in response to events from the WindowManager

fixes issue 3997, fixes issue 4000, fixes issue 4012, fixes issue 4030
fixes issue 4027, fixes issue 4028, fixes issue 4029, fixes issue 4031
fixes issue 4032, fixes issue 4033

Change-Id: Ife307728e46bd3b6dcd189be6886ab8b6fbd9212
Reviewed-on: http://gerrit.dmdirc.com/1144
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
Automatic-Compile: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4rc1
Chris Smith 14 年之前
父節點
當前提交
f4bbdb48fe
共有 87 個檔案被更改,包括 432 行新增499 行删除
  1. 12
    31
      src/com/dmdirc/Channel.java
  2. 1
    1
      src/com/dmdirc/ChannelEventHandler.java
  3. 5
    23
      src/com/dmdirc/CustomWindow.java
  4. 4
    4
      src/com/dmdirc/EventHandler.java
  5. 68
    13
      src/com/dmdirc/FrameContainer.java
  6. 7
    7
      src/com/dmdirc/FrameContainerComparator.java
  7. 4
    19
      src/com/dmdirc/GlobalWindow.java
  8. 7
    4
      src/com/dmdirc/MessageTarget.java
  9. 9
    34
      src/com/dmdirc/Query.java
  10. 12
    19
      src/com/dmdirc/Raw.java
  11. 8
    28
      src/com/dmdirc/Server.java
  12. 1
    1
      src/com/dmdirc/ServerEventHandler.java
  13. 19
    18
      src/com/dmdirc/WritableFrameContainer.java
  14. 4
    4
      src/com/dmdirc/actions/ActionComponentChain.java
  15. 5
    5
      src/com/dmdirc/actions/ActionManager.java
  16. 7
    7
      src/com/dmdirc/actions/ActionModel.java
  17. 8
    8
      src/com/dmdirc/actions/ActionSubstitutor.java
  18. 1
    1
      src/com/dmdirc/actions/interfaces/ActionComparison.java
  19. 2
    2
      src/com/dmdirc/actions/interfaces/ActionComponent.java
  20. 1
    1
      src/com/dmdirc/commandparser/commands/ChannelCommand.java
  21. 1
    1
      src/com/dmdirc/commandparser/commands/ChatCommand.java
  22. 2
    2
      src/com/dmdirc/commandparser/commands/Command.java
  23. 1
    1
      src/com/dmdirc/commandparser/commands/ExternalCommand.java
  24. 1
    2
      src/com/dmdirc/commandparser/commands/GlobalCommand.java
  25. 1
    1
      src/com/dmdirc/commandparser/commands/QueryCommand.java
  26. 1
    1
      src/com/dmdirc/commandparser/commands/ServerCommand.java
  27. 1
    1
      src/com/dmdirc/commandparser/commands/channel/Ban.java
  28. 1
    1
      src/com/dmdirc/commandparser/commands/channel/ChannelSettings.java
  29. 1
    1
      src/com/dmdirc/commandparser/commands/channel/Cycle.java
  30. 1
    1
      src/com/dmdirc/commandparser/commands/channel/KickReason.java
  31. 2
    2
      src/com/dmdirc/commandparser/commands/channel/Mode.java
  32. 2
    2
      src/com/dmdirc/commandparser/commands/channel/Names.java
  33. 1
    1
      src/com/dmdirc/commandparser/commands/channel/Part.java
  34. 1
    1
      src/com/dmdirc/commandparser/commands/channel/SetNickColour.java
  35. 2
    2
      src/com/dmdirc/commandparser/commands/channel/ShowTopic.java
  36. 2
    2
      src/com/dmdirc/commandparser/commands/chat/Me.java
  37. 5
    5
      src/com/dmdirc/commandparser/commands/global/Active.java
  38. 1
    1
      src/com/dmdirc/commandparser/commands/global/AliasCommand.java
  39. 17
    17
      src/com/dmdirc/commandparser/commands/global/Debug.java
  40. 3
    3
      src/com/dmdirc/commandparser/commands/global/Echo.java
  41. 1
    1
      src/com/dmdirc/commandparser/commands/global/Exit.java
  42. 5
    5
      src/com/dmdirc/commandparser/commands/global/Help.java
  43. 2
    2
      src/com/dmdirc/commandparser/commands/global/Ifplugin.java
  44. 3
    3
      src/com/dmdirc/commandparser/commands/global/Input.java
  45. 1
    1
      src/com/dmdirc/commandparser/commands/global/Notify.java
  46. 1
    1
      src/com/dmdirc/commandparser/commands/global/ReloadActions.java
  47. 1
    1
      src/com/dmdirc/commandparser/commands/global/ReloadIdentities.java
  48. 1
    1
      src/com/dmdirc/commandparser/commands/global/SaveConfig.java
  49. 1
    1
      src/com/dmdirc/commandparser/commands/global/UnloadPlugin.java
  50. 2
    2
      src/com/dmdirc/commandparser/commands/server/OpenQuery.java
  51. 6
    4
      src/com/dmdirc/commandparser/parsers/ChannelCommandParser.java
  52. 9
    9
      src/com/dmdirc/commandparser/parsers/CommandParser.java
  53. 3
    3
      src/com/dmdirc/commandparser/parsers/GlobalCommandParser.java
  54. 6
    4
      src/com/dmdirc/commandparser/parsers/QueryCommandParser.java
  55. 6
    6
      src/com/dmdirc/commandparser/parsers/RawCommandParser.java
  56. 6
    4
      src/com/dmdirc/commandparser/parsers/ServerCommandParser.java
  57. 5
    5
      src/com/dmdirc/config/ConfigTarget.java
  58. 1
    1
      src/com/dmdirc/config/prefs/validator/OptionalValidator.java
  59. 3
    3
      src/com/dmdirc/interfaces/FrameInfoListener.java
  60. 2
    2
      src/com/dmdirc/interfaces/NotificationListener.java
  61. 1
    1
      src/com/dmdirc/interfaces/SelectionListener.java
  62. 37
    34
      src/com/dmdirc/ui/WindowManager.java
  63. 4
    4
      src/com/dmdirc/ui/interfaces/FrameListener.java
  64. 1
    1
      src/com/dmdirc/ui/interfaces/InputWindow.java
  65. 2
    4
      src/com/dmdirc/ui/interfaces/UIController.java
  66. 10
    2
      src/com/dmdirc/ui/interfaces/Window.java
  67. 2
    2
      src/com/dmdirc/ui/messages/IRCDocument.java
  68. 2
    2
      src/com/dmdirc/ui/messages/Styliser.java
  69. 0
    19
      test/com/dmdirc/ServerManagerTest.java
  70. 5
    2
      test/com/dmdirc/WritableFrameContainerTest.java
  71. 1
    1
      test/com/dmdirc/commandparser/commands/channel/BanTest.java
  72. 4
    4
      test/com/dmdirc/commandparser/commands/channel/KickReasonTest.java
  73. 4
    4
      test/com/dmdirc/commandparser/commands/channel/ModeTest.java
  74. 1
    1
      test/com/dmdirc/commandparser/commands/channel/PartTest.java
  75. 3
    3
      test/com/dmdirc/commandparser/commands/channel/SetNickColourTest.java
  76. 2
    2
      test/com/dmdirc/commandparser/commands/chat/MeTest.java
  77. 2
    2
      test/com/dmdirc/commandparser/commands/global/AliasCommandTest.java
  78. 2
    2
      test/com/dmdirc/commandparser/commands/global/DebugTest.java
  79. 2
    2
      test/com/dmdirc/commandparser/commands/global/IfpluginTest.java
  80. 4
    4
      test/com/dmdirc/commandparser/commands/global/NewServerTest.java
  81. 8
    8
      test/com/dmdirc/commandparser/commands/server/ChangeServerTest.java
  82. 4
    4
      test/com/dmdirc/harness/TestCommandParser.java
  83. 11
    11
      test/com/dmdirc/harness/TestWritableFrameContainer.java
  84. 20
    40
      test/com/dmdirc/ui/WindowManagerTest.java
  85. 1
    1
      test/com/dmdirc/ui/messages/IntelligentLinkingTest.java
  86. 1
    1
      test/com/dmdirc/ui/messages/StyliserStylesTest.java
  87. 1
    1
      test/com/dmdirc/ui/messages/StyliserTest.java

+ 12
- 31
src/com/dmdirc/Channel.java 查看文件

@@ -37,7 +37,6 @@ import com.dmdirc.ui.WindowManager;
37 37
 import com.dmdirc.ui.input.TabCompleter;
38 38
 import com.dmdirc.ui.input.TabCompletionType;
39 39
 import com.dmdirc.ui.interfaces.ChannelWindow;
40
-import com.dmdirc.ui.interfaces.InputWindow;
41 40
 import com.dmdirc.ui.messages.ColourManager;
42 41
 import com.dmdirc.ui.messages.Styliser;
43 42
 import com.dmdirc.util.RollingList;
@@ -56,7 +55,7 @@ import java.util.Map;
56 55
  *
57 56
  * @author chris
58 57
  */
59
-public class Channel extends MessageTarget implements ConfigChangeListener {
58
+public class Channel extends MessageTarget<ChannelWindow> implements ConfigChangeListener {
60 59
 
61 60
     /** The parser's pChannel class. */
62 61
     private transient ChannelInfo channelInfo;
@@ -64,9 +63,6 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
64 63
     /** The server this channel is on. */
65 64
     private Server server;
66 65
 
67
-    /** The ChannelWindow used for this channel. */
68
-    private ChannelWindow window;
69
-
70 66
     /** The tabcompleter used for this channel. */
71 67
     private final TabCompleter tabCompleter;
72 68
 
@@ -98,6 +94,7 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
98 94
     public Channel(final Server newServer, final ChannelInfo newChannelInfo) {
99 95
         super("channel-inactive", newChannelInfo.getName(),
100 96
                 Styliser.stipControlCodes(newChannelInfo.getName()),
97
+                ChannelWindow.class,
101 98
                 new ConfigManager(newServer.getProtocol(), newServer.getIrcd(),
102 99
                 newServer.getNetwork(), newServer.getAddress(), newChannelInfo.getName()),
103 100
                 new ChannelCommandParser());
@@ -121,9 +118,7 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
121 118
         tabCompleter.addEntries(TabCompletionType.COMMAND,
122 119
                 CommandManager.getCommandNames(CommandType.TYPE_CHAT));
123 120
 
124
-        window = Main.getUI().getChannel(Channel.this);
125 121
         WindowManager.addWindow(server, this);
126
-        window.getInputHandler().setTabCompleter(tabCompleter);
127 122
 
128 123
         eventHandler = new ChannelEventHandler(this);
129 124
 
@@ -148,7 +143,7 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
148 143
      * Shows this channel's window.
149 144
      */
150 145
     public void show() {
151
-        window.open();
146
+        getFrame().open();
152 147
     }
153 148
 
154 149
     /** {@inheritDoc} */
@@ -246,21 +241,8 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
246 241
         registerCallbacks();
247 242
     }
248 243
 
249
-    /**
250
-     * Returns the internal window belonging to this object.
251
-     *
252
-     * @return This object's internal window
253
-     */
244
+    /** {@inheritDoc} */
254 245
     @Override
255
-    public InputWindow getFrame() {
256
-        return window;
257
-    }
258
-
259
-    /**
260
-     * Returns the tab completer for this channel.
261
-     *
262
-     * @return This channel's tab completer
263
-     */
264 246
     public TabCompleter getTabCompleter() {
265 247
         return tabCompleter;
266 248
     }
@@ -343,8 +325,8 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
343 325
         setIcon("channel-inactive");
344 326
 
345 327
         synchronized (this) {
346
-            if (window != null) {
347
-                window.updateNames(new ArrayList<ChannelClientInfo>());
328
+            if (getFrame() != null) {
329
+                getFrame().updateNames(new ArrayList<ChannelClientInfo>());
348 330
             }
349 331
         }
350 332
     }
@@ -353,7 +335,7 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
353 335
     @Override
354 336
     public void windowClosing() {
355 337
         // 1: Make the window non-visible
356
-        window.setVisible(false);
338
+        getFrame().setVisible(false);
357 339
 
358 340
         // 2: Remove any callbacks or listeners
359 341
         eventHandler.unregisterCallbacks();
@@ -382,7 +364,6 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
382 364
     public void windowClosed() {
383 365
         // 7: Remove any references to the window and parents
384 366
         synchronized (this) {
385
-            window = null; // NOPMD
386 367
             server = null; // NOPMD
387 368
         }
388 369
     }
@@ -403,7 +384,7 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
403 384
      * @param client The client to be added
404 385
      */
405 386
     public void addClient(final ChannelClientInfo client) {
406
-        window.addName(client);
387
+        getFrame().addName(client);
407 388
         tabCompleter.addEntry(TabCompletionType.CHANNEL_NICK, client.getClient().getNickname());
408 389
     }
409 390
 
@@ -413,7 +394,7 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
413 394
      * @param client The client to be removed
414 395
      */
415 396
     public void removeClient(final ChannelClientInfo client) {
416
-        window.removeName(client);
397
+        getFrame().removeName(client);
417 398
         tabCompleter.removeEntry(TabCompletionType.CHANNEL_NICK, client.getClient().getNickname());
418 399
 
419 400
         if (client.getClient().equals(server.getParser().getLocalClient())) {
@@ -428,7 +409,7 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
428 409
      * @param clients The list of clients to use
429 410
      */
430 411
     public void setClients(final Collection<ChannelClientInfo> clients) {
431
-        window.updateNames(clients);
412
+        getFrame().updateNames(clients);
432 413
 
433 414
         tabCompleter.clear(TabCompletionType.CHANNEL_NICK);
434 415
 
@@ -454,8 +435,8 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
454 435
      * when (visible) user modes or nicknames change.
455 436
      */
456 437
     public void refreshClients() {
457
-        if (window != null && onChannel) {
458
-            window.updateNames();
438
+        if (getFrame() != null && onChannel) {
439
+            getFrame().updateNames();
459 440
         }
460 441
     }
461 442
 

+ 1
- 1
src/com/dmdirc/ChannelEventHandler.java 查看文件

@@ -63,7 +63,7 @@ public final class ChannelEventHandler extends EventHandler implements
63 63
     /** {@inheritDoc} */
64 64
     @SuppressWarnings("unchecked")
65 65
     @Override
66
-    protected <T extends CallbackInterface> void addCallback(final CallbackManager cbm,
66
+    protected <T extends CallbackInterface> void addCallback(final CallbackManager<?> cbm,
67 67
             final Class<T> type) {
68 68
         if (OtherAwayStateListener.class.equals(type)) {
69 69
             cbm.addCallback(type, (T) this);

+ 5
- 23
src/com/dmdirc/CustomWindow.java 查看文件

@@ -31,10 +31,7 @@ import com.dmdirc.ui.interfaces.Window;
31 31
  *
32 32
  * @author chris
33 33
  */
34
-public class CustomWindow extends FrameContainer {
35
-
36
-    /** The window used by this container. */
37
-    private Window window;
34
+public class CustomWindow extends FrameContainer<Window> {
38 35
 
39 36
     /**
40 37
      * Creates a new custom window as a child of the specified window.
@@ -44,14 +41,10 @@ public class CustomWindow extends FrameContainer {
44 41
      * @param parent The parent of this custom window
45 42
      */
46 43
     public CustomWindow(final String name, final String title,
47
-            final FrameContainer parent) {
48
-        super("custom", name, title, parent.getConfigManager());
49
-
50
-        window = Main.getUI().getWindow(this);
44
+            final FrameContainer<?> parent) {
45
+        super("custom", name, title, Window.class, parent.getConfigManager());
51 46
 
52 47
         WindowManager.addWindow(parent, this);
53
-
54
-        window.open();
55 48
     }
56 49
 
57 50
     /**
@@ -61,26 +54,16 @@ public class CustomWindow extends FrameContainer {
61 54
      * @param title The parent of this custom window
62 55
      */
63 56
     public CustomWindow(final String name, final String title) {
64
-        super("custom", name, title, IdentityManager.getGlobalConfig());
65
-
66
-        window = Main.getUI().getWindow(this);
57
+        super("custom", name, title, Window.class, IdentityManager.getGlobalConfig());
67 58
 
68 59
         WindowManager.addWindow(this);
69
-
70
-        window.open();
71
-    }
72
-
73
-    /** {@inheritDoc} */
74
-    @Override
75
-    public Window getFrame() {
76
-        return window;
77 60
     }
78 61
 
79 62
     /** {@inheritDoc} */
80 63
     @Override
81 64
     public void windowClosing() {
82 65
         // 1: Make the window non-visible
83
-        window.setVisible(false);
66
+        getFrame().setVisible(false);
84 67
 
85 68
         // 2: Remove any callbacks or listeners
86 69
         // 3: Trigger any actions neccessary
@@ -95,7 +78,6 @@ public class CustomWindow extends FrameContainer {
95 78
     @Override
96 79
     public void windowClosed() {
97 80
         // 7: Remove any references to the window and parents
98
-        window = null; // NOPMD
99 81
         parent = null; // NOPMD
100 82
     }
101 83
 

+ 4
- 4
src/com/dmdirc/EventHandler.java 查看文件

@@ -42,12 +42,12 @@ public abstract class EventHandler implements CallbackInterface {
42 42
      */
43 43
     @SuppressWarnings("unchecked")
44 44
     public void registerCallbacks() {
45
-        final CallbackManager cbm = getServer().getParser().getCallbackManager();
45
+        final CallbackManager<?> cbm = getServer().getParser().getCallbackManager();
46 46
         
47 47
         try {
48
-            for (Class iface : this.getClass().getInterfaces()) {
48
+            for (Class<?> iface : this.getClass().getInterfaces()) {
49 49
                 if (CallbackInterface.class.isAssignableFrom(iface)) {
50
-                    addCallback(cbm, iface);
50
+                    addCallback(cbm, iface.asSubclass(CallbackInterface.class));
51 51
                 }
52 52
             }
53 53
         } catch (CallbackNotFoundException exception) {
@@ -75,7 +75,7 @@ public abstract class EventHandler implements CallbackInterface {
75 75
      */
76 76
     @SuppressWarnings("unchecked")
77 77
     protected abstract <T extends CallbackInterface> void addCallback(
78
-            final CallbackManager cbm, final Class<T> type) throws CallbackNotFoundException;
78
+            final CallbackManager<?> cbm, final Class<T> type) throws CallbackNotFoundException;
79 79
     
80 80
     /**
81 81
      * Retrieves the server belonging to this EventHandler's owner.

+ 68
- 13
src/com/dmdirc/FrameContainer.java 查看文件

@@ -50,9 +50,10 @@ import java.util.concurrent.CopyOnWriteArrayList;
50 50
  * The frame container implements basic methods that should be present in
51 51
  * all objects that handle a frame.
52 52
  *
53
+ * @param <T> The type of window which should be used for this frame container.
53 54
  * @author chris
54 55
  */
55
-public abstract class FrameContainer {
56
+public abstract class FrameContainer<T extends Window> {
56 57
 
57 58
     /** Logger to use. */
58 59
     private static final java.util.logging.Logger LOGGER = java.util.logging
@@ -68,11 +69,18 @@ public abstract class FrameContainer {
68 69
     protected final IRCDocument document;
69 70
 
70 71
     /** The children of this frame. */
71
-    protected final Collection<FrameContainer> children
72
-            = new CopyOnWriteArrayList<FrameContainer>();
72
+    protected final Collection<FrameContainer<?>> children
73
+            = new CopyOnWriteArrayList<FrameContainer<?>>();
74
+
75
+    /** The windows representing of this frame. */
76
+    protected final Collection<T> windows
77
+            = new CopyOnWriteArrayList<T>();
78
+
79
+    /** The class of windows we want to represent this container. */
80
+    protected final Class<T> windowClass;
73 81
 
74 82
     /** The parent of this frame. */
75
-    protected FrameContainer parent;
83
+    protected FrameContainer<?> parent;
76 84
 
77 85
     /** The name of the icon being used for this container's frame. */
78 86
     private String icon;
@@ -101,14 +109,16 @@ public abstract class FrameContainer {
101 109
      * @param icon The icon to use for this container
102 110
      * @param name The name of this container
103 111
      * @param title The title of this container
112
+     * @param windowClass The class of windows required to represent this container
104 113
      * @param config The config manager for this container
105 114
      * @since 0.6.4
106 115
      */
107 116
     public FrameContainer(final String icon, final String name,
108
-            final String title, final ConfigManager config) {
117
+            final String title, final Class<T> windowClass, final ConfigManager config) {
109 118
         this.config = config;
110 119
         this.name = name;
111 120
         this.title = title;
121
+        this.windowClass = windowClass;
112 122
         this.styliser = new Styliser(this);
113 123
         this.document = new IRCDocument(this);
114 124
 
@@ -130,8 +140,12 @@ public abstract class FrameContainer {
130 140
      * Returns the internal frame associated with this object.
131 141
      *
132 142
      * @return The internal frame associated with this object
143
+     * @deprecated Use {@link #getWindows()} instead
133 144
      */
134
-    public abstract Window getFrame();
145
+    @Deprecated
146
+    public final T getFrame() {
147
+        return getWindows().isEmpty() ? null : getWindows().iterator().next();
148
+    }
135 149
 
136 150
     /**
137 151
      * Returns a collection of direct children of this frame.
@@ -139,7 +153,7 @@ public abstract class FrameContainer {
139 153
      * @return This frame's children
140 154
      * @since 0.6.4
141 155
      */
142
-    public Collection<FrameContainer> getChildren() {
156
+    public Collection<FrameContainer<?>> getChildren() {
143 157
         return Collections.unmodifiableCollection(children);
144 158
     }
145 159
 
@@ -149,7 +163,7 @@ public abstract class FrameContainer {
149 163
      * @param child The window to be added
150 164
      * @since 0.6.4
151 165
      */
152
-    public void addChild(final FrameContainer child) {
166
+    public void addChild(final FrameContainer<?> child) {
153 167
         children.add(child);
154 168
         child.setParent(this);
155 169
     }
@@ -160,7 +174,7 @@ public abstract class FrameContainer {
160 174
      * @param child The window to be removed
161 175
      * @since 0.6.4
162 176
      */
163
-    public void removeChild(final FrameContainer child) {
177
+    public void removeChild(final FrameContainer<?> child) {
164 178
         children.remove(child);
165 179
     }
166 180
 
@@ -172,7 +186,7 @@ public abstract class FrameContainer {
172 186
      * @param parent The new parent for this container
173 187
      * @since 0.6.4
174 188
      */
175
-    public synchronized void setParent(final FrameContainer parent) {
189
+    public synchronized void setParent(final FrameContainer<?> parent) {
176 190
         if (this.parent != null && !parent.equals(this.parent)) {
177 191
             this.parent.removeChild(this);
178 192
         }
@@ -186,7 +200,7 @@ public abstract class FrameContainer {
186 200
      * @return This container's parent, or null if it is a top level window.
187 201
      * @since 0.6.4
188 202
      */
189
-    public FrameContainer getParent() {
203
+    public FrameContainer<?> getParent() {
190 204
         return parent;
191 205
     }
192 206
 
@@ -369,7 +383,7 @@ public abstract class FrameContainer {
369 383
      * @param colour The colour to use for the notification
370 384
      */
371 385
     public void sendNotification(final Color colour) {
372
-        final FrameContainer activeWindow = WindowManager.getActiveWindow();
386
+        final FrameContainer<?> activeWindow = WindowManager.getActiveWindow();
373 387
 
374 388
         if (activeWindow != null && !activeWindow.equals(this)
375 389
                 && !colour.equals(notification)) {
@@ -587,7 +601,48 @@ public abstract class FrameContainer {
587 601
     public void removeFrameInfoListener(final FrameInfoListener listener) {
588 602
         listeners.remove(FrameInfoListener.class, listener);
589 603
     }
590
-    
604
+
605
+    /**
606
+     * Adds a new window to this container.
607
+     *
608
+     * @param window The window to be added
609
+     * @since 0.6.4
610
+     */
611
+    public void addWindow(T window) {
612
+        windows.add(window);
613
+    }
614
+
615
+    /**
616
+     * Removes the specified window from this container.
617
+     *
618
+     * @param window The window to be removed
619
+     * @since 0.6.4
620
+     */
621
+    public void removeWindow(T window) {
622
+        windows.remove(window);
623
+    }
624
+
625
+    /**
626
+     * Retrieves a collection of windows that represent this container.
627
+     *
628
+     * @return The collection of windows currently representing this container
629
+     * @since 0.6.4
630
+     */
631
+    public Collection<T> getWindows() {
632
+        return windows;
633
+    }
634
+
635
+    /**
636
+     * Retrieves the class of windows which should be used to represent this
637
+     * container.
638
+     *
639
+     * @return This container's window class
640
+     * @since 0.6.4
641
+     */
642
+    public Class<T> getWindowClass() {
643
+        return windowClass;
644
+    }
645
+
591 646
     /**
592 647
      * Updates the icon of this frame if its config setting is changed.
593 648
      */

+ 7
- 7
src/com/dmdirc/FrameContainerComparator.java 查看文件

@@ -30,7 +30,7 @@ import java.util.Comparator;
30 30
 /**
31 31
  * Compares FrameContainers by name.
32 32
  */
33
-public final class FrameContainerComparator implements Comparator<FrameContainer>,
33
+public final class FrameContainerComparator implements Comparator<FrameContainer<?>>,
34 34
         Serializable {
35 35
 
36 36
     /**
@@ -62,7 +62,7 @@ public final class FrameContainerComparator implements Comparator<FrameContainer
62 62
         "item1.toString() returns a non-null value",
63 63
         "item2.toString() returns a non-null value"
64 64
     })
65
-    public int compare(final FrameContainer item1, final FrameContainer item2) {
65
+    public int compare(final FrameContainer<?> item1, final FrameContainer<?> item2) {
66 66
         Logger.assertTrue(item1 != null);
67 67
         Logger.assertTrue(item2 != null);
68 68
         Logger.assertTrue(item1.toString() != null);
@@ -91,8 +91,8 @@ public final class FrameContainerComparator implements Comparator<FrameContainer
91 91
      * @param item2 The existing container to test against
92 92
      * @return True iff the new container should be before the old container
93 93
      */
94
-    private boolean sortBefore(final FrameContainer item1,
95
-            final FrameContainer item2) {
94
+    private boolean sortBefore(final FrameContainer<?> item1,
95
+            final FrameContainer<?> item2) {
96 96
 
97 97
         return getPosition(item1) < getPosition(item2);
98 98
     }
@@ -104,8 +104,8 @@ public final class FrameContainerComparator implements Comparator<FrameContainer
104 104
      * @param item2 The existing container to test against
105 105
      * @return True iff the new container should be after the old container
106 106
      */
107
-    private boolean sortAfter(final FrameContainer item1,
108
-            final FrameContainer item2) {
107
+    private boolean sortAfter(final FrameContainer<?> item1,
108
+            final FrameContainer<?> item2) {
109 109
         return getPosition(item1) > getPosition(item2);
110 110
     }
111 111
 
@@ -116,7 +116,7 @@ public final class FrameContainerComparator implements Comparator<FrameContainer
116 116
      * @param item The frame container to be tested
117 117
      * @return Position of the frame container
118 118
      */
119
-    private int getPosition(final FrameContainer item) {
119
+    private int getPosition(final FrameContainer<?> item) {
120 120
         if (item instanceof GlobalWindow) {
121 121
             return 0;
122 122
         } else if (item instanceof Server) {

+ 4
- 19
src/com/dmdirc/GlobalWindow.java 查看文件

@@ -38,10 +38,7 @@ import com.dmdirc.ui.interfaces.InputWindow;
38 38
  *
39 39
  * @author chris
40 40
  */
41
-public class GlobalWindow extends WritableFrameContainer {
42
-
43
-    /** The window we're using. */
44
-    private InputWindow window;
41
+public class GlobalWindow extends WritableFrameContainer<InputWindow> {
45 42
 
46 43
     /** The global window that's in use, if any. */
47 44
     private static GlobalWindow globalWindow;
@@ -51,7 +48,8 @@ public class GlobalWindow extends WritableFrameContainer {
51 48
 
52 49
     /** Creates a new instance of GlobalWindow. */
53 50
     public GlobalWindow() {
54
-        super("icon", "Global", "(Global)", IdentityManager.getGlobalConfig(),
51
+        super("icon", "Global", "(Global)", InputWindow.class,
52
+                IdentityManager.getGlobalConfig(),
55 53
                 GlobalCommandParser.getGlobalCommandParser());
56 54
 
57 55
         tabCompleter = new TabCompleter();
@@ -60,26 +58,14 @@ public class GlobalWindow extends WritableFrameContainer {
60 58
         tabCompleter.addEntries(TabCompletionType.COMMAND,
61 59
                 AliasWrapper.getAliasWrapper().getAliases());
62 60
 
63
-        window = Main.getUI().getInputWindow(this);
64
-
65
-        window.getInputHandler().setTabCompleter(tabCompleter);
66
-
67 61
         WindowManager.addWindow(this);
68
-
69
-        window.open();
70 62
     }
71 63
 
72
-    /** {@inheritDoc} */
73
-    @Override
74
-    public InputWindow getFrame() {
75
-        return window;
76
-    }
77
-    
78 64
     /** {@inheritDoc} */
79 65
     @Override
80 66
     public void windowClosing() {
81 67
         // 1: Make the window non-visible
82
-        window.setVisible(false);
68
+        getFrame().setVisible(false);
83 69
 
84 70
         // 2: Remove any callbacks or listeners
85 71
         // 3: Trigger any actions neccessary
@@ -94,7 +80,6 @@ public class GlobalWindow extends WritableFrameContainer {
94 80
     @Override
95 81
     public void windowClosed() {
96 82
         // 7: Remove any references to the window and parents
97
-        window = null;
98 83
         globalWindow = null;
99 84
     }
100 85
 

+ 7
- 4
src/com/dmdirc/MessageTarget.java 查看文件

@@ -24,14 +24,16 @@ package com.dmdirc;
24 24
 
25 25
 import com.dmdirc.commandparser.parsers.CommandParser;
26 26
 import com.dmdirc.config.ConfigManager;
27
+import com.dmdirc.ui.interfaces.InputWindow;
27 28
 
28 29
 /**
29 30
  * Defines common methods for objects that you can send messages to (such as
30 31
  * channels and queries).
31 32
  *
33
+ * @param <T> The type of window which should be used for this frame container.
32 34
  * @author Chris
33 35
  */
34
-public abstract class MessageTarget extends WritableFrameContainer {
36
+public abstract class MessageTarget<T extends InputWindow> extends WritableFrameContainer<T> {
35 37
 
36 38
     /**
37 39
      * Creates a new MessageTarget.
@@ -39,14 +41,15 @@ public abstract class MessageTarget extends WritableFrameContainer {
39 41
      * @param icon The icon to use for this target
40 42
      * @param name The name of this target
41 43
      * @param title The title of this target
44
+     * @param windowClass The class of window to use to represent this container
42 45
      * @param config The config manager to use for this target
43 46
      * @param parser The command parser for this container
44 47
      * @since 0.6.4
45 48
      */
46 49
     public MessageTarget(final String icon, final String name,
47
-            final String title, final ConfigManager config,
48
-            final CommandParser parser) {
49
-        super(icon, name, title, config, parser);
50
+            final String title, final Class<T> windowClass,
51
+            final ConfigManager config, final CommandParser parser) {
52
+        super(icon, name, title, windowClass, config, parser);
50 53
     }
51 54
 
52 55
     /**

+ 9
- 34
src/com/dmdirc/Query.java 查看文件

@@ -40,7 +40,6 @@ import com.dmdirc.parser.interfaces.callbacks.QuitListener;
40 40
 import com.dmdirc.ui.WindowManager;
41 41
 import com.dmdirc.ui.input.TabCompleter;
42 42
 import com.dmdirc.ui.input.TabCompletionType;
43
-import com.dmdirc.ui.interfaces.InputWindow;
44 43
 import com.dmdirc.ui.interfaces.QueryWindow;
45 44
 
46 45
 import java.awt.Toolkit;
@@ -52,15 +51,12 @@ import java.util.List;
52 51
  * corresponding QueryWindow, and handles user input for the query.
53 52
  * @author chris
54 53
  */
55
-public class Query extends MessageTarget implements PrivateActionListener,
54
+public class Query extends MessageTarget<QueryWindow> implements PrivateActionListener,
56 55
         PrivateMessageListener, NickChangeListener, QuitListener {
57 56
 
58 57
     /** The Server this Query is on. */
59 58
     private Server server;
60 59
 
61
-    /** The QueryWindow used for this Query. */
62
-    private QueryWindow window;
63
-
64 60
     /** The full host and nickname of the client associated with this Query. */
65 61
     private String host, nickname;
66 62
 
@@ -76,27 +72,23 @@ public class Query extends MessageTarget implements PrivateActionListener,
76 72
     public Query(final Server newServer, final String newHost) {
77 73
         super("query", newServer.getParser().parseHostmask(newHost)[0],
78 74
                 newServer.getParser().parseHostmask(newHost)[0],
79
-                newServer.getConfigManager(), new QueryCommandParser());
75
+                QueryWindow.class, newServer.getConfigManager(),
76
+                new QueryCommandParser());
80 77
 
81 78
         this.server = newServer;
82 79
         this.host = newHost;
83 80
         this.nickname = server.getParser().parseHostmask(host)[0];
84 81
 
85
-        window = Main.getUI().getQuery(this);
86
-        WindowManager.addWindow(server, this);
82
+        WindowManager.addWindow(server, this,
83
+                !getConfigManager().getOptionBool("general", "hidequeries"));
87 84
 
88 85
         ActionManager.processEvent(CoreActionType.QUERY_OPENED, null, this);
89 86
 
90
-        if (!server.getConfigManager().getOptionBool("general", "hidequeries")) {
91
-            window.open();
92
-        }
93
-
94 87
         tabCompleter = new TabCompleter(server.getTabCompleter());
95 88
         tabCompleter.addEntries(TabCompletionType.COMMAND,
96 89
                 CommandManager.getCommandNames(CommandType.TYPE_QUERY));
97 90
         tabCompleter.addEntries(TabCompletionType.COMMAND,
98 91
                 CommandManager.getCommandNames(CommandType.TYPE_CHAT));
99
-        window.getInputHandler().setTabCompleter(tabCompleter);
100 92
 
101 93
         if (!server.getState().isDisconnected()) {
102 94
             reregister();
@@ -105,24 +97,8 @@ public class Query extends MessageTarget implements PrivateActionListener,
105 97
         updateTitle();
106 98
     }
107 99
 
108
-    /**
109
-     * Shows this query's window.
110
-     */
111
-    public void show() {
112
-        window.open();
113
-    }
114
-
115 100
     /** {@inheritDoc} */
116 101
     @Override
117
-    public InputWindow getFrame() {
118
-        return window;
119
-    }
120
-
121
-    /**
122
-     * Returns the tab completer for this query.
123
-     *
124
-     * @return This query's tab completer
125
-     */
126 102
     public TabCompleter getTabCompleter() {
127 103
         return tabCompleter;
128 104
     }
@@ -319,7 +295,7 @@ public class Query extends MessageTarget implements PrivateActionListener,
319 295
     @Override
320 296
     public void windowClosing() {
321 297
         // 1: Make the window non-visible
322
-        window.setVisible(false);
298
+        getFrame().setVisible(false);
323 299
 
324 300
         // 2: Remove any callbacks or listeners
325 301
         if (server != null && server.getParser() != null) {
@@ -344,7 +320,6 @@ public class Query extends MessageTarget implements PrivateActionListener,
344 320
     @Override
345 321
     public void windowClosed() {
346 322
         // 7: Remove any references to the window and parents
347
-        window = null;
348 323
         server = null;
349 324
     }
350 325
 
@@ -369,12 +344,12 @@ public class Query extends MessageTarget implements PrivateActionListener,
369 344
     /** {@inheritDoc} */
370 345
     @Override
371 346
     public void activateFrame() {
372
-        if (window == null) {
347
+        if (getFrame() == null) {
373 348
             return;
374 349
         }
375 350
 
376
-        if (!window.isVisible()) {
377
-            show();
351
+        if (!getFrame().isVisible()) {
352
+            getFrame().setVisible(true);
378 353
         }
379 354
 
380 355
         super.activateFrame();

+ 12
- 19
src/com/dmdirc/Raw.java 查看文件

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc;
24 24
 
25
-import com.dmdirc.commandparser.parsers.CommandParser;
26 25
 import com.dmdirc.commandparser.parsers.RawCommandParser;
27 26
 import com.dmdirc.logger.ErrorLevel;
28 27
 import com.dmdirc.logger.Logger;
@@ -31,6 +30,7 @@ import com.dmdirc.parser.common.CallbackNotFoundException;
31 30
 import com.dmdirc.parser.interfaces.callbacks.DataInListener;
32 31
 import com.dmdirc.parser.interfaces.callbacks.DataOutListener;
33 32
 import com.dmdirc.ui.WindowManager;
33
+import com.dmdirc.ui.input.TabCompleter;
34 34
 import com.dmdirc.ui.interfaces.InputWindow;
35 35
 
36 36
 /**
@@ -38,30 +38,24 @@ import com.dmdirc.ui.interfaces.InputWindow;
38 38
  * received to/from the server).
39 39
  * @author chris
40 40
  */
41
-public final class Raw extends WritableFrameContainer implements DataInListener,
42
-        DataOutListener {
41
+public final class Raw extends WritableFrameContainer<InputWindow>
42
+        implements DataInListener, DataOutListener {
43 43
 
44 44
     /** The server object that's being monitored. */
45 45
     private Server server;
46 46
 
47
-    /** An InputWindow used for displaying the raw data.*/
48
-    private InputWindow window;
49
-
50 47
     /**
51 48
      * Creates a new instance of Raw.
52 49
      *
53 50
      * @param newServer the server to monitor
54 51
      */
55 52
     public Raw(final Server newServer) {
56
-        super("raw", "Raw", "(Raw log)", newServer.getConfigManager(), new RawCommandParser());
53
+        super("raw", "Raw", "(Raw log)", InputWindow.class,
54
+                newServer.getConfigManager(), new RawCommandParser());
57 55
 
58 56
         this.server = newServer;
59 57
 
60
-        window = Main.getUI().getInputWindow(this);
61 58
         WindowManager.addWindow(server, this);
62
-        window.getInputHandler().setTabCompleter(server.getTabCompleter());
63
-
64
-        window.open();
65 59
     }
66 60
 
67 61
     /**
@@ -80,7 +74,7 @@ public final class Raw extends WritableFrameContainer implements DataInListener,
80 74
     @Override
81 75
     public void windowClosing() {
82 76
         // 1: Make the window non-visible
83
-        window.setVisible(false);
77
+        getFrame().setVisible(false);
84 78
 
85 79
         // 2: Remove any callbacks or listeners
86 80
         if (server.getParser() != null) {
@@ -101,16 +95,9 @@ public final class Raw extends WritableFrameContainer implements DataInListener,
101 95
     @Override
102 96
     public void windowClosed() {
103 97
         // 7: Remove any references to the window and parents
104
-        window = null;
105 98
         server = null;
106 99
     }
107 100
 
108
-    /** {@inheritDoc} */
109
-    @Override
110
-    public InputWindow getFrame() {
111
-        return window;
112
-    }
113
-
114 101
     /** {@inheritDoc} */
115 102
     @Override
116 103
     public void onDataIn(final Parser tParser, final String sData) {
@@ -144,4 +131,10 @@ public final class Raw extends WritableFrameContainer implements DataInListener,
144 131
         return server.getMaxLineLength();
145 132
     }
146 133
 
134
+    /** {@inheritDoc} */
135
+    @Override
136
+    public TabCompleter getTabCompleter() {
137
+        return server.getTabCompleter();
138
+    }
139
+
147 140
 }

+ 8
- 28
src/com/dmdirc/Server.java 查看文件

@@ -27,7 +27,6 @@ import com.dmdirc.actions.CoreActionType;
27 27
 import com.dmdirc.actions.wrappers.AliasWrapper;
28 28
 import com.dmdirc.commandparser.CommandManager;
29 29
 import com.dmdirc.commandparser.CommandType;
30
-import com.dmdirc.commandparser.parsers.RawCommandParser;
31 30
 import com.dmdirc.commandparser.parsers.ServerCommandParser;
32 31
 import com.dmdirc.config.ConfigManager;
33 32
 import com.dmdirc.config.Identity;
@@ -50,7 +49,6 @@ import com.dmdirc.parser.common.MyInfo;
50 49
 import com.dmdirc.ui.WindowManager;
51 50
 import com.dmdirc.ui.input.TabCompleter;
52 51
 import com.dmdirc.ui.input.TabCompletionType;
53
-import com.dmdirc.ui.interfaces.InputWindow;
54 52
 import com.dmdirc.ui.interfaces.ServerWindow;
55 53
 import com.dmdirc.ui.interfaces.Window;
56 54
 import com.dmdirc.ui.messages.Formatter;
@@ -77,7 +75,7 @@ import javax.net.ssl.TrustManager;
77 75
  *
78 76
  * @author chris
79 77
  */
80
-public class Server extends WritableFrameContainer implements ConfigChangeListener {
78
+public class Server extends WritableFrameContainer<ServerWindow> implements ConfigChangeListener {
81 79
 
82 80
     // <editor-fold defaultstate="collapsed" desc="Properties">
83 81
 
@@ -122,9 +120,6 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
122 120
     /** The raw frame used for this server instance. */
123 121
     private Raw raw;
124 122
 
125
-    /** The ServerWindow corresponding to this server. */
126
-    private ServerWindow window;
127
-
128 123
     /** The address of the server we're connecting to. */
129 124
     private URI address;
130 125
 
@@ -143,7 +138,7 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
143 138
     /** The tabcompleter used for this server. */
144 139
     private final TabCompleter tabCompleter = new TabCompleter();
145 140
     /** The last activated internal frame for this server. */
146
-    private FrameContainer activeFrame = this;
141
+    private FrameContainer<?> activeFrame = this;
147 142
 
148 143
     /** Our reason for being away, if any. */
149 144
     private String awayMessage;
@@ -176,14 +171,13 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
176 171
      */
177 172
     public Server(final URI uri, final Identity profile) {
178 173
         super("server-disconnected", uri.getHost(), uri.getHost(),
174
+                ServerWindow.class,
179 175
                 new ConfigManager(uri.getScheme(), "", "", uri.getHost()),
180 176
                 new ServerCommandParser());
181 177
 
182 178
         this.address = uri;
183 179
         this.profile = profile;
184 180
 
185
-        window = Main.getUI().getServer(this);
186
-
187 181
         ServerManager.getServerManager().registerServer(this);
188 182
         WindowManager.addWindow(this);
189 183
 
@@ -194,12 +188,8 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
194 188
         tabCompleter.addEntries(TabCompletionType.COMMAND,
195 189
                 CommandManager.getCommandNames(CommandType.TYPE_GLOBAL));
196 190
 
197
-        window.getInputHandler().setTabCompleter(tabCompleter);
198
-
199 191
         updateIcon();
200 192
 
201
-        window.open();
202
-
203 193
         new Timer("Server Who Timer").schedule(new TimerTask() {
204 194
             @Override
205 195
             public void run() {
@@ -672,7 +662,7 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
672 662
     @Override
673 663
     public boolean ownsFrame(final Window target) {
674 664
         // Check if it's our server frame
675
-        if (window != null && window.equals(target)) { return true; }
665
+        if (getFrame() != null && getFrame().equals(target)) { return true; }
676 666
         // Check if it's the raw frame
677 667
         if (raw != null && raw.ownsFrame(target)) { return true; }
678 668
         // Check if it's a channel frame
@@ -691,7 +681,7 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
691 681
      *
692 682
      * @param source The frame that was activated
693 683
      */
694
-    public void setActiveFrame(final FrameContainer source) {
684
+    public void setActiveFrame(final FrameContainer<?> source) {
695 685
         activeFrame = source;
696 686
     }
697 687
 
@@ -1094,19 +1084,10 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
1094 1084
         return awayMessage;
1095 1085
     }
1096 1086
 
1097
-    /**
1098
-     * Returns the tab completer for this connection.
1099
-     *
1100
-     * @return The tab completer for this server
1101
-     */
1102
-    public TabCompleter getTabCompleter() {
1103
-        return tabCompleter;
1104
-    }
1105
-
1106 1087
     /** {@inheritDoc} */
1107 1088
     @Override
1108
-    public InputWindow getFrame() {
1109
-        return window;
1089
+    public TabCompleter getTabCompleter() {
1090
+        return tabCompleter;
1110 1091
     }
1111 1092
 
1112 1093
     /**
@@ -1135,7 +1116,7 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
1135 1116
     public void windowClosing() {
1136 1117
         synchronized (myStateLock) {
1137 1118
             // 1: Make the window non-visible
1138
-            window.setVisible(false);
1119
+            getFrame().setVisible(false);
1139 1120
 
1140 1121
             // 2: Remove any callbacks or listeners
1141 1122
             eventHandler.unregisterCallbacks();
@@ -1166,7 +1147,6 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
1166 1147
     @Override
1167 1148
     public void windowClosed() {
1168 1149
         // 7: Remove any references to the window and parents
1169
-        window = null; //NOPMD
1170 1150
         oldParser = null; //NOPMD
1171 1151
         parser = null; //NOPMD
1172 1152
     }

+ 1
- 1
src/com/dmdirc/ServerEventHandler.java 查看文件

@@ -72,7 +72,7 @@ public final class ServerEventHandler extends EventHandler implements
72 72
     @Override
73 73
     @SuppressWarnings("unchecked")
74 74
     protected <T extends CallbackInterface> void addCallback(
75
-            final CallbackManager cbm, final Class<T> type) throws CallbackNotFoundException {
75
+            final CallbackManager<?> cbm, final Class<T> type) throws CallbackNotFoundException {
76 76
         cbm.addCallback(type, (T) this);
77 77
     }
78 78
 

+ 19
- 18
src/com/dmdirc/WritableFrameContainer.java 查看文件

@@ -29,8 +29,8 @@ import com.dmdirc.config.ConfigManager;
29 29
 import com.dmdirc.logger.ErrorLevel;
30 30
 import com.dmdirc.logger.Logger;
31 31
 import com.dmdirc.ui.WindowManager;
32
+import com.dmdirc.ui.input.TabCompleter;
32 33
 import com.dmdirc.ui.interfaces.InputWindow;
33
-import com.dmdirc.ui.interfaces.Window;
34 34
 
35 35
 import java.util.ArrayList;
36 36
 import java.util.List;
@@ -40,9 +40,10 @@ import java.util.List;
40 40
  * class that allow the sending of lines back to whatever the container's
41 41
  * data source is (e.g. an IRC channel or server).
42 42
  *
43
+ * @param <T> The type of window which should be used for this frame container.
43 44
  * @author chris
44 45
  */
45
-public abstract class WritableFrameContainer extends FrameContainer {
46
+public abstract class WritableFrameContainer<T extends InputWindow> extends FrameContainer<T> {
46 47
     
47 48
     /** The name of the server notification target. */
48 49
     protected static final String NOTIFICATION_SERVER = "server".intern();
@@ -59,13 +60,15 @@ public abstract class WritableFrameContainer extends FrameContainer {
59 60
      * @param icon The icon to use for this container
60 61
      * @param name The name of this container
61 62
      * @param title The title of this container
63
+     * @param windowClass The class of window to use to represent this container
62 64
      * @param config The config manager for this container
63 65
      * @param parser The command parser for this container
64 66
      * @since 0.6.4
65 67
      */
66 68
     public WritableFrameContainer(final String icon, final String name,
67
-            final String title, final ConfigManager config, final CommandParser parser) {
68
-        super(icon, name, title, config);
69
+            final String title, final Class<T> windowClass,
70
+            final ConfigManager config, final CommandParser parser) {
71
+        super(icon, name, title, windowClass, config);
69 72
 
70 73
         this.commandParser = parser;
71 74
         parser.setOwner(this);
@@ -86,14 +89,13 @@ public abstract class WritableFrameContainer extends FrameContainer {
86 89
     public CommandParser getCommandParser() {
87 90
         return commandParser;
88 91
     }
89
-    
92
+
90 93
     /**
91
-     * Returns the internal frame associated with this object.
94
+     * Retrieves the tab completer which should be used for this cotnainer.
92 95
      *
93
-     * @return The internal frame associated with this object
96
+     * @return This container's tab completer
94 97
      */
95
-    @Override
96
-    public abstract InputWindow getFrame();
98
+    public abstract TabCompleter getTabCompleter();
97 99
     
98 100
     /**
99 101
      * Returns the maximum length that a line passed to sendLine() should be,
@@ -273,7 +275,7 @@ public abstract class WritableFrameContainer extends FrameContainer {
273 275
         } else if (target.startsWith("window:")) {
274 276
             final String windowName = target.substring(7);
275 277
 
276
-            FrameContainer targetWindow = WindowManager.findCustomWindow(getServer(), windowName);
278
+            FrameContainer<?> targetWindow = WindowManager.findCustomWindow(getServer(), windowName);
277 279
 
278 280
             if (targetWindow == null) {
279 281
                 targetWindow = new CustomWindow(windowName, windowName, getServer());
@@ -289,25 +291,24 @@ public abstract class WritableFrameContainer extends FrameContainer {
289 291
 
290 292
             final String command = String.format(target.substring(12), escapedargs);
291 293
 
292
-            WritableFrameContainer best = this;
294
+            WritableFrameContainer<?> best = this;
293 295
             long besttime = 0;
294 296
 
295
-            final List<FrameContainer> containers = new ArrayList<FrameContainer>();
297
+            final List<FrameContainer<?>> containers = new ArrayList<FrameContainer<?>>();
296 298
             
297 299
             containers.add(getServer());
298 300
             containers.addAll(getServer().getChildren());
299 301
 
300
-            for (FrameContainer container : containers) {
301
-                final Window window = container.getFrame();
302
-
303
-                if (window == null || !(window instanceof InputWindow)) {
302
+            for (FrameContainer<?> container : containers) {
303
+                if (container == null || !(container instanceof WritableFrameContainer<?>)) {
304 304
                     continue;
305 305
                 }
306 306
 
307
-                final long time = ((InputWindow) window).getCommandParser().getCommandTime(command);
307
+                final long time = ((WritableFrameContainer<?>) container)
308
+                        .getCommandParser().getCommandTime(command);
308 309
                 if (time > besttime) {
309 310
                     besttime = time;
310
-                    best = (WritableFrameContainer) container;
311
+                    best = (WritableFrameContainer<?>) container;
311 312
                 }
312 313
             }
313 314
 

+ 4
- 4
src/com/dmdirc/actions/ActionComponentChain.java 查看文件

@@ -49,8 +49,8 @@ public class ActionComponentChain implements ActionComponent {
49 49
      * @param source The class that this chain needs to start with
50 50
      * @param chain The textual representation of the chain
51 51
      */
52
-    public ActionComponentChain(final Class source, final String chain) {
53
-        Class current = source;
52
+    public ActionComponentChain(final Class<?> source, final String chain) {
53
+        Class<?> current = source;
54 54
         
55 55
         for (String componentName : chain.split("\\.")) {
56 56
             final ActionComponent component = ActionManager.getActionComponent(componentName);
@@ -88,7 +88,7 @@ public class ActionComponentChain implements ActionComponent {
88 88
     /** {@inheritDoc} */
89 89
     @Precondition("This component chain has one or more components")
90 90
     @Override
91
-    public Class appliesTo() {
91
+    public Class<?> appliesTo() {
92 92
         Logger.assertTrue(!components.isEmpty());
93 93
         
94 94
         return components.get(0).appliesTo();
@@ -97,7 +97,7 @@ public class ActionComponentChain implements ActionComponent {
97 97
     /** {@inheritDoc} */
98 98
     @Precondition("This component chain has one or more components")
99 99
     @Override
100
-    public Class getType() {
100
+    public Class<?> getType() {
101 101
         Logger.assertTrue(!components.isEmpty());
102 102
         
103 103
         return components.get(components.size() - 1).getType();

+ 5
- 5
src/com/dmdirc/actions/ActionManager.java 查看文件

@@ -564,7 +564,7 @@ public final class ActionManager {
564 564
         }
565 565
 
566 566
         for (ActionType target : actionTypes) {
567
-            if (((Enum) target).name().equals(type)) {
567
+            if (((Enum<?>) target).name().equals(type)) {
568 568
                 return target;
569 569
             }
570 570
         }
@@ -601,7 +601,7 @@ public final class ActionManager {
601 601
      * @return A list of compatible action components
602 602
      */
603 603
     @Precondition("The specified target is not null")
604
-    public static List<ActionComponent> getCompatibleComponents(final Class target) {
604
+    public static List<ActionComponent> getCompatibleComponents(final Class<?> target) {
605 605
         Logger.assertTrue(target != null);
606 606
 
607 607
         final List<ActionComponent> res = new ArrayList<ActionComponent>();
@@ -622,7 +622,7 @@ public final class ActionManager {
622 622
      * @return A list of compatible action comparisons
623 623
      */
624 624
     @Precondition("The specified target is not null")
625
-    public static List<ActionComparison> getCompatibleComparisons(final Class target) {
625
+    public static List<ActionComparison> getCompatibleComparisons(final Class<?> target) {
626 626
         Logger.assertTrue(target != null);
627 627
 
628 628
         final List<ActionComparison> res = new ArrayList<ActionComparison>();
@@ -666,7 +666,7 @@ public final class ActionManager {
666 666
         Logger.assertTrue(!type.isEmpty());
667 667
 
668 668
         for (ActionComponent target : actionComponents) {
669
-            if (((Enum) target).name().equals(type)) {
669
+            if (((Enum<?>) target).name().equals(type)) {
670 670
                 return target;
671 671
             }
672 672
         }
@@ -687,7 +687,7 @@ public final class ActionManager {
687 687
         Logger.assertTrue(!type.isEmpty());
688 688
 
689 689
         for (ActionComparison target : actionComparisons) {
690
-            if (((Enum) target).name().equals(type)) {
690
+            if (((Enum<?>) target).name().equals(type)) {
691 691
                 return target;
692 692
             }
693 693
         }

+ 7
- 7
src/com/dmdirc/actions/ActionModel.java 查看文件

@@ -131,14 +131,14 @@ public class ActionModel {
131 131
             return true;
132 132
         }
133 133
 
134
-        final FrameContainer active = WindowManager.getActiveWindow();
135
-        WritableFrameContainer cw = null;
134
+        final FrameContainer<?> active = WindowManager.getActiveWindow();
135
+        WritableFrameContainer<?> cw = null;
136 136
         CommandParser cp = null;
137 137
 
138
-        if (arguments.length > 0 && arguments[0] instanceof WritableFrameContainer) {
139
-            cw = (WritableFrameContainer) arguments[0];
140
-        } else if (active instanceof WritableFrameContainer) {
141
-            cw = (WritableFrameContainer) active;
138
+        if (arguments.length > 0 && arguments[0] instanceof WritableFrameContainer<?>) {
139
+            cw = (WritableFrameContainer<?>) arguments[0];
140
+        } else if (active instanceof WritableFrameContainer<?>) {
141
+            cw = (WritableFrameContainer<?>) active;
142 142
         } else if (ServerManager.getServerManager().numServers() > 0) {
143 143
             cw = ServerManager.getServerManager().getServers().get(0);
144 144
         }
@@ -146,7 +146,7 @@ public class ActionModel {
146 146
         if (cw == null) {
147 147
             cp = GlobalCommandParser.getGlobalCommandParser();
148 148
         } else {
149
-            cp = cw.getFrame().getCommandParser();
149
+            cp = cw.getCommandParser();
150 150
         }
151 151
 
152 152
         for (String command : response) {

+ 8
- 8
src/com/dmdirc/actions/ActionSubstitutor.java 查看文件

@@ -103,7 +103,7 @@ public class ActionSubstitutor {
103 103
         final Map<String, String> res = new HashMap<String, String>();
104 104
         
105 105
         int i = 0;
106
-        for (Class myClass : type.getType().getArgTypes()) {
106
+        for (Class<?> myClass : type.getType().getArgTypes()) {
107 107
             for (ActionComponent comp : ActionManager.getCompatibleComponents(myClass)) {
108 108
                 final String key = "{" + i + "." + comp.toString() + "}";
109 109
                 final String desc = type.getType().getArgNames()[i] + "'s " + comp.getName();
@@ -146,7 +146,7 @@ public class ActionSubstitutor {
146 146
      * @return True if this action type's first arg extends or is a FrameContainer
147 147
      */
148 148
     private boolean hasFrameContainer() {
149
-        Class target = null;
149
+        Class<?> target = null;
150 150
         
151 151
         if (type.getType().getArgTypes().length > 0) {
152 152
             target = type.getType().getArgTypes()[0];
@@ -260,7 +260,7 @@ public class ActionSubstitutor {
260 260
         }
261 261
 
262 262
         if (hasFrameContainer() && serverMatcher.matches()) {
263
-            final Server server = ((FrameContainer) args[0]).getServer();
263
+            final Server server = ((FrameContainer<?>) args[0]).getServer();
264 264
 
265 265
             if (server != null) {
266 266
                 try {
@@ -291,8 +291,8 @@ public class ActionSubstitutor {
291 291
      */
292 292
     protected String checkConnection(final ActionComponentChain chain,
293 293
             final Object[] args, final Object argument) {
294
-        if ((chain.requiresConnection() && args[0] instanceof FrameContainer
295
-                    && ((FrameContainer) args[0]).getServer().getState()
294
+        if ((chain.requiresConnection() && args[0] instanceof FrameContainer<?>
295
+                    && ((FrameContainer<?>) args[0]).getServer().getState()
296 296
                     == ServerState.CONNECTED) || !chain.requiresConnection()) {
297 297
             return chain.get(argument).toString();
298 298
         }
@@ -312,10 +312,10 @@ public class ActionSubstitutor {
312 312
      */
313 313
     protected ConfigManager getConfigManager(final Object ... args) {
314 314
         for (Object arg : args) {
315
-            if (arg instanceof FrameContainer) {
316
-                return ((FrameContainer) arg).getConfigManager();
315
+            if (arg instanceof FrameContainer<?>) {
316
+                return ((FrameContainer<?>) arg).getConfigManager();
317 317
             } else if (arg instanceof Window) {
318
-                return ((Window) arg).getConfigManager();
318
+                return ((Window) arg).getContainer().getConfigManager();
319 319
             }
320 320
         }
321 321
 

+ 1
- 1
src/com/dmdirc/actions/interfaces/ActionComparison.java 查看文件

@@ -43,7 +43,7 @@ public interface ActionComparison {
43 43
      * Returns the class that this comparison deals with.
44 44
      * @return The Class that this comparison can compare
45 45
      */
46
-    Class appliesTo();
46
+    Class<?> appliesTo();
47 47
     
48 48
     /**
49 49
      * Returns a friendly name for this comparison.

+ 2
- 2
src/com/dmdirc/actions/interfaces/ActionComponent.java 查看文件

@@ -64,13 +64,13 @@ public interface ActionComponent {
64 64
      * Retrieves the type of class that this component applies to.
65 65
      * @return The Class that this component can be applied to
66 66
      */
67
-    Class appliesTo();
67
+    Class<?> appliesTo();
68 68
     
69 69
     /**
70 70
      * Retrieves the type of this component.
71 71
      * @return The Class of this component.
72 72
      */
73
-    Class getType();
73
+    Class<?> getType();
74 74
     
75 75
     /**
76 76
      * Retrives a friendly name for this component.

+ 1
- 1
src/com/dmdirc/commandparser/commands/ChannelCommand.java 查看文件

@@ -46,7 +46,7 @@ public abstract class ChannelCommand extends Command implements CommandInfo {
46 46
      * @param args Arguments passed to this command
47 47
      * @since 0.6.3m1
48 48
      */
49
-    public abstract void execute(FrameContainer origin, Server server, Channel channel,
49
+    public abstract void execute(FrameContainer<?> origin, Server server, Channel channel,
50 50
             boolean isSilent, CommandArguments args);
51 51
 
52 52
     /** {@inheritDoc} */

+ 1
- 1
src/com/dmdirc/commandparser/commands/ChatCommand.java 查看文件

@@ -47,7 +47,7 @@ public abstract class ChatCommand extends Command implements CommandInfo {
47 47
      * @param args Arguments passed to this command
48 48
      * @since 0.6.3m1
49 49
      */
50
-    public abstract void execute(FrameContainer origin, Server server, MessageTarget target,
50
+    public abstract void execute(FrameContainer<?> origin, Server server, MessageTarget<?> target,
51 51
             boolean isSilent, CommandArguments args);
52 52
 
53 53
     /** {@inheritDoc} */

+ 2
- 2
src/com/dmdirc/commandparser/commands/Command.java 查看文件

@@ -46,7 +46,7 @@ public abstract class Command {
46 46
      * @param type The type of message to send
47 47
      * @param args The arguments of the message
48 48
      */
49
-    protected final void sendLine(final FrameContainer target,
49
+    protected final void sendLine(final FrameContainer<?> target,
50 50
             final boolean isSilent, final String type, final Object ... args) {
51 51
         if (!isSilent && target != null) {
52 52
             target.addLine(type, args);
@@ -61,7 +61,7 @@ public abstract class Command {
61 61
      * @param name The name of the command that's raising the error
62 62
      * @param args The arguments that the command accepts or expects
63 63
      */
64
-    protected final void showUsage(final FrameContainer target,
64
+    protected final void showUsage(final FrameContainer<?> target,
65 65
             final boolean isSilent, final String name, final String args) {
66 66
         sendLine(target, isSilent, "commandUsage", CommandManager.getCommandChar(),
67 67
                 name, args);

+ 1
- 1
src/com/dmdirc/commandparser/commands/ExternalCommand.java 查看文件

@@ -43,7 +43,7 @@ public interface ExternalCommand {
43 43
      * @param args Arguments passed to this command
44 44
      * @since 0.6.3m1
45 45
      */
46
-    void execute(FrameContainer origin, Server server, String channel,
46
+    void execute(FrameContainer<?> origin, Server server, String channel,
47 47
             boolean isSilent, CommandArguments args);
48 48
 
49 49
 }

+ 1
- 2
src/com/dmdirc/commandparser/commands/GlobalCommand.java 查看文件

@@ -26,7 +26,6 @@ import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.commandparser.CommandArguments;
27 27
 import com.dmdirc.commandparser.CommandInfo;
28 28
 import com.dmdirc.commandparser.CommandType;
29
-import com.dmdirc.ui.interfaces.InputWindow;
30 29
 
31 30
 /**
32 31
  * Represents a generic global command. Global commands are associated with
@@ -45,7 +44,7 @@ public abstract class GlobalCommand extends Command implements CommandInfo {
45 44
      * @param args Arguments passed to this command
46 45
      * @since 0.6.3m1
47 46
      */
48
-    public abstract void execute(FrameContainer origin, boolean isSilent, CommandArguments args);
47
+    public abstract void execute(FrameContainer<?> origin, boolean isSilent, CommandArguments args);
49 48
 
50 49
     /** {@inheritDoc} */
51 50
     @Override

+ 1
- 1
src/com/dmdirc/commandparser/commands/QueryCommand.java 查看文件

@@ -46,7 +46,7 @@ public abstract class QueryCommand extends Command implements CommandInfo {
46 46
      * @param args Arguments passed to this command
47 47
      * @since 0.6.3m1
48 48
      */
49
-    public abstract void execute(FrameContainer origin, Server server, Query query,
49
+    public abstract void execute(FrameContainer<?> origin, Server server, Query query,
50 50
             boolean isSilent, CommandArguments args);
51 51
 
52 52
     /** {@inheritDoc} */

+ 1
- 1
src/com/dmdirc/commandparser/commands/ServerCommand.java 查看文件

@@ -45,7 +45,7 @@ public abstract class ServerCommand extends Command implements CommandInfo {
45 45
      * @param args Arguments passed to this command
46 46
      * @since 0.6.3m1
47 47
      */
48
-    public abstract void execute(FrameContainer origin, Server server,
48
+    public abstract void execute(FrameContainer<?> origin, Server server,
49 49
             boolean isSilent, CommandArguments args);
50 50
 
51 51
     /** {@inheritDoc} */

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/Ban.java 查看文件

@@ -49,7 +49,7 @@ public final class Ban extends ChannelCommand implements IntelligentCommand {
49 49
     
50 50
     /** {@inheritDoc} */
51 51
     @Override
52
-    public void execute(final FrameContainer origin, final Server server,
52
+    public void execute(final FrameContainer<?> origin, final Server server,
53 53
             final Channel channel, final boolean isSilent, final CommandArguments args) {
54 54
         if (args.getArguments().length == 0) {
55 55
             showUsage(origin, isSilent, "ban", "<user|host>");

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/ChannelSettings.java 查看文件

@@ -49,7 +49,7 @@ public final class ChannelSettings extends ChannelCommand implements Intelligent
49 49
     
50 50
     /** {@inheritDoc} */
51 51
     @Override
52
-    public void execute(final FrameContainer origin, final Server server,
52
+    public void execute(final FrameContainer<?> origin, final Server server,
53 53
             final Channel channel, final boolean isSilent, final CommandArguments args) {
54 54
         Main.getUI().showChannelSettingsDialog(channel);
55 55
     }

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/Cycle.java 查看文件

@@ -47,7 +47,7 @@ public final class Cycle extends ChannelCommand {
47 47
     
48 48
     /** {@inheritDoc} */
49 49
     @Override
50
-    public void execute(final FrameContainer origin, final Server server,
50
+    public void execute(final FrameContainer<?> origin, final Server server,
51 51
             final Channel channel, final boolean isSilent, final CommandArguments args) {
52 52
         channel.part(args.getArguments().length > 0 ? args.getArgumentsAsString()
53 53
                 : origin.getConfigManager().getOption("general", "cyclemessage"));

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/KickReason.java 查看文件

@@ -51,7 +51,7 @@ public final class KickReason extends ChannelCommand implements IntelligentComma
51 51
     
52 52
     /** {@inheritDoc} */
53 53
     @Override
54
-    public void execute(final FrameContainer origin, final Server server,
54
+    public void execute(final FrameContainer<?> origin, final Server server,
55 55
             final Channel channel, final boolean isSilent, final CommandArguments args) {
56 56
         if (args.getArguments().length == 0) {
57 57
             showUsage(origin, isSilent, "kick", "<user> [reason]");

+ 2
- 2
src/com/dmdirc/commandparser/commands/channel/Mode.java 查看文件

@@ -52,7 +52,7 @@ public final class Mode extends ChannelCommand implements IntelligentCommand,
52 52
 
53 53
     /** {@inheritDoc} */
54 54
     @Override
55
-    public void execute(final FrameContainer origin, final Server server,
55
+    public void execute(final FrameContainer<?> origin, final Server server,
56 56
             final Channel channel, final boolean isSilent, final CommandArguments args) {
57 57
         final ChannelInfo cChannel = channel.getChannelInfo();
58 58
 
@@ -65,7 +65,7 @@ public final class Mode extends ChannelCommand implements IntelligentCommand,
65 65
 
66 66
     /** {@inheritDoc} */
67 67
     @Override
68
-    public void execute(final FrameContainer origin, final Server server,
68
+    public void execute(final FrameContainer<?> origin, final Server server,
69 69
             final String channel, final boolean isSilent, final CommandArguments args) {
70 70
         if (args.getArguments().length == 0) {
71 71
             server.getParser().sendRawMessage("MODE " + channel);

+ 2
- 2
src/com/dmdirc/commandparser/commands/channel/Names.java 查看文件

@@ -52,7 +52,7 @@ public class Names extends ChannelCommand implements IntelligentCommand, Externa
52 52
 
53 53
     /** {@inheritDoc} */
54 54
     @Override
55
-    public void execute(final FrameContainer origin, final Server server,
55
+    public void execute(final FrameContainer<?> origin, final Server server,
56 56
             final Channel channel, final boolean isSilent, final CommandArguments args) {
57 57
         server.getParser().sendRawMessage("NAMES " + channel.getChannelInfo().getName());
58 58
     }
@@ -60,7 +60,7 @@ public class Names extends ChannelCommand implements IntelligentCommand, Externa
60 60
 
61 61
     /** {@inheritDoc} */
62 62
     @Override
63
-    public void execute(final FrameContainer origin, final Server server,
63
+    public void execute(final FrameContainer<?> origin, final Server server,
64 64
             final String channel, final boolean isSilent, final CommandArguments args) {
65 65
         server.getParser().sendRawMessage("NAMES " + channel);
66 66
     }    

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/Part.java 查看文件

@@ -46,7 +46,7 @@ public final class Part extends ChannelCommand {
46 46
     
47 47
     /** {@inheritDoc} */
48 48
     @Override
49
-    public void execute(final FrameContainer origin, final Server server,
49
+    public void execute(final FrameContainer<?> origin, final Server server,
50 50
             final Channel channel, final boolean isSilent, final CommandArguments args) {
51 51
         channel.part(args.getArguments().length > 0 ? args.getArgumentsAsString()
52 52
                 : origin.getConfigManager().getOption("general", "partmessage"));

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/SetNickColour.java 查看文件

@@ -53,7 +53,7 @@ public final class SetNickColour extends ChannelCommand implements IntelligentCo
53 53
     
54 54
     /** {@inheritDoc} */
55 55
     @SuppressWarnings("unchecked") @Override
56
-    public void execute(final FrameContainer origin, final Server server,
56
+    public void execute(final FrameContainer<?> origin, final Server server,
57 57
             final Channel channel, final boolean isSilent, final CommandArguments args) {
58 58
         
59 59
         int offset = 0;

+ 2
- 2
src/com/dmdirc/commandparser/commands/channel/ShowTopic.java 查看文件

@@ -48,7 +48,7 @@ public final class ShowTopic extends ChannelCommand implements ExternalCommand {
48 48
 
49 49
     /** {@inheritDoc} */
50 50
     @Override
51
-    public void execute(final FrameContainer origin, final Server server,
51
+    public void execute(final FrameContainer<?> origin, final Server server,
52 52
             final Channel channel, final boolean isSilent, final CommandArguments args) {
53 53
         if (args.getArguments().length == 0) {
54 54
             final ChannelInfo cChannel = channel.getChannelInfo();
@@ -69,7 +69,7 @@ public final class ShowTopic extends ChannelCommand implements ExternalCommand {
69 69
 
70 70
     /** {@inheritDoc} */
71 71
     @Override
72
-    public void execute(final FrameContainer origin, final Server server,
72
+    public void execute(final FrameContainer<?> origin, final Server server,
73 73
             final String channel, final boolean isSilent, final CommandArguments args) {
74 74
         if (args.getArguments().length == 0) {
75 75
             server.getParser().sendRawMessage("TOPIC " + channel);

+ 2
- 2
src/com/dmdirc/commandparser/commands/chat/Me.java 查看文件

@@ -47,8 +47,8 @@ public final class Me extends ChatCommand implements ValidatingCommand {
47 47
     
48 48
     /** {@inheritDoc} */
49 49
     @Override
50
-    public void execute(final FrameContainer origin, final Server server,
51
-            final MessageTarget target, final boolean isSilent, final CommandArguments args) {
50
+    public void execute(final FrameContainer<?> origin, final Server server,
51
+            final MessageTarget<?> target, final boolean isSilent, final CommandArguments args) {
52 52
         if (args.getArguments().length == 0) {
53 53
             showUsage(origin, isSilent, "me", "<action>");
54 54
         } else {

+ 5
- 5
src/com/dmdirc/commandparser/commands/global/Active.java 查看文件

@@ -49,15 +49,15 @@ public final class Active extends GlobalCommand implements IntelligentCommand {
49 49
     
50 50
     /** {@inheritDoc} */
51 51
     @Override
52
-    public void execute(final FrameContainer origin, final boolean isSilent,
52
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
53 53
             final CommandArguments args) {
54 54
         final String command = args.getArgumentsAsString();
55 55
         
56
-        final FrameContainer window = WindowManager.getActiveWindow();
56
+        final FrameContainer<?> window = WindowManager.getActiveWindow();
57 57
         
58
-        if (window != null && window instanceof WritableFrameContainer) {
59
-            ((WritableFrameContainer) window).getFrame()
60
-                    .getCommandParser().parseCommand(window, command);
58
+        if (window != null && window instanceof WritableFrameContainer<?>) {
59
+            ((WritableFrameContainer<?>) window).getCommandParser()
60
+                    .parseCommand(window, command);
61 61
         }
62 62
     }
63 63
     

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/AliasCommand.java 查看文件

@@ -53,7 +53,7 @@ public final class AliasCommand extends GlobalCommand implements
53 53
 
54 54
     /** {@inheritDoc} */
55 55
     @Override
56
-    public void execute(final FrameContainer origin, final boolean isSilent,
56
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
57 57
                         final CommandArguments args) {
58 58
         if (args.getArguments().length < 2) {
59 59
             showUsage(origin, isSilent, "alias", "[--remove] <name> [command]");

+ 17
- 17
src/com/dmdirc/commandparser/commands/global/Debug.java 查看文件

@@ -64,7 +64,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
64 64
     
65 65
     /** {@inheritDoc} */
66 66
     @Override
67
-    public void execute(final FrameContainer origin, final boolean isSilent,
67
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
68 68
             final CommandArguments args) {
69 69
         if (args.getArguments().length == 0) {
70 70
             showUsage(origin, isSilent, "debug", "<debug command> [options]");
@@ -142,7 +142,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
142 142
      * @param origin The window this command was executed in
143 143
      * @param isSilent Whether this command has been silenced or not
144 144
      */
145
-    private void doShowRaw(final FrameContainer origin, final boolean isSilent) {
145
+    private void doShowRaw(final FrameContainer<?> origin, final boolean isSilent) {
146 146
         if (origin == null || origin.getServer() == null) {
147 147
             sendLine(origin, isSilent, FORMAT_ERROR, "Cannot show raw window here.");
148 148
         } else {
@@ -157,7 +157,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
157 157
      * @param isSilent Whether this command has been silenced or not
158 158
      * @param args Arguments array for the command
159 159
      */
160
-    private void doConfigStats(final FrameContainer origin, final boolean isSilent,
160
+    private void doConfigStats(final FrameContainer<?> origin, final boolean isSilent,
161 161
             final String[] args) {
162 162
         int arg = -1;
163 163
         if (args.length == 2) {
@@ -191,7 +191,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
191 191
      * @param isSilent Whether this command has been silenced or not
192 192
      * @param regex Regex to match options against
193 193
      */
194
-    private void doConfigStatsOption(final FrameContainer origin,
194
+    private void doConfigStatsOption(final FrameContainer<?> origin,
195 195
             final boolean isSilent, final String regex) {
196 196
         final SortedSet<Entry<String, Integer>> sortedStats = getSortedStats();
197 197
         boolean found = false;
@@ -215,7 +215,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
215 215
      * @param isSilent Whether this command has been silenced or not
216 216
      * @param top Top number of entries to show
217 217
      */
218
-    private void doConfigStatsTop(final FrameContainer origin,
218
+    private void doConfigStatsTop(final FrameContainer<?> origin,
219 219
             final boolean isSilent, final int top) {
220 220
         final SortedSet<Entry<String, Integer>> sortedStats = getSortedStats();
221 221
         int i = 0;
@@ -237,7 +237,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
237 237
      * @param isSilent Whether this command has been silenced or not
238 238
      * @param cutoff Cut off value for stats
239 239
      */
240
-    private void doConfigStatsCutOff(final FrameContainer origin,
240
+    private void doConfigStatsCutOff(final FrameContainer<?> origin,
241 241
             final boolean isSilent, final int cutoff) {
242 242
         final SortedSet<Entry<String, Integer>> sortedStats = getSortedStats();
243 243
         for (Map.Entry<String, Integer> entry : sortedStats) {
@@ -268,7 +268,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
268 268
      * @param origin The window this command was executed in
269 269
      * @param isSilent Whether this command has been silenced or not
270 270
      */
271
-    private void doMemInfo(final FrameContainer origin, final boolean isSilent) {
271
+    private void doMemInfo(final FrameContainer<?> origin, final boolean isSilent) {
272 272
         sendLine(origin, isSilent, FORMAT_OUTPUT, "Total Memory: "
273 273
                 + Runtime.getRuntime().totalMemory());
274 274
         sendLine(origin, isSilent, FORMAT_OUTPUT, "Free Memory: "
@@ -283,7 +283,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
283 283
      * @param origin The window this command was executed in
284 284
      * @param isSilent Whether this command has been silenced or not
285 285
      */
286
-    private void doColourSpam(final FrameContainer origin, final boolean isSilent) {
286
+    private void doColourSpam(final FrameContainer<?> origin, final boolean isSilent) {
287 287
         for (int i = 0; i < 100; i++) {
288 288
             sendLine(origin, isSilent, FORMAT_OUTPUT, ((char) 3) + "5Colour! "
289 289
                     + ((char) 3) + "6Colour! " + ((char) 3) + "7Colour! "
@@ -299,7 +299,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
299 299
      * @param origin The window this command was executed in
300 300
      * @param isSilent Whether this command has been silenced or not
301 301
      */
302
-    private void doGarbage(final FrameContainer origin, final boolean isSilent) {
302
+    private void doGarbage(final FrameContainer<?> origin, final boolean isSilent) {
303 303
         System.gc();
304 304
         sendLine(origin, isSilent, FORMAT_OUTPUT, "Invoked garbage collector.");
305 305
     }
@@ -310,7 +310,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
310 310
      * @param origin The window this command was executed in
311 311
      * @param isSilent Whether this command has been silenced or not
312 312
      */
313
-    private void doConfigInfo(final FrameContainer origin, final boolean isSilent) {
313
+    private void doConfigInfo(final FrameContainer<?> origin, final boolean isSilent) {
314 314
         for (Identity source : origin.getConfigManager().getSources()) {
315 315
             sendLine(origin, isSilent, FORMAT_OUTPUT, source.getTarget() + " - "
316 316
                     + source + "(" + source.getTarget().getOrder() + ")");
@@ -323,7 +323,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
323 323
      * @param origin The window this command was executed in
324 324
      * @param isSilent Whether this command has been silenced or not
325 325
      */
326
-    private void doGlobalConfigInfo(final FrameContainer origin, final boolean isSilent) {
326
+    private void doGlobalConfigInfo(final FrameContainer<?> origin, final boolean isSilent) {
327 327
         for (Identity source : IdentityManager.getGlobalConfig().getSources()) {
328 328
             sendLine(origin, isSilent, FORMAT_OUTPUT, source.getTarget() + " - "
329 329
                     + source + "(" + source.getTarget().getOrder() + ")");
@@ -336,7 +336,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
336 336
      * @param origin The window this command was executed in
337 337
      * @param isSilent Whether this command has been silenced or not
338 338
      */
339
-    private void doForceUpdate(final FrameContainer origin, final boolean isSilent) {
339
+    private void doForceUpdate(final FrameContainer<?> origin, final boolean isSilent) {
340 340
         if (IdentityManager.getGlobalConfig().getOptionBool("updater", "enable")) {
341 341
             new Thread(new UpdateChecker(), "Forced update checker").start();
342 342
         } else {
@@ -353,7 +353,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
353 353
      * @param origin The window this command was executed in
354 354
      * @param isSilent Whether this command has been silenced or not
355 355
      */
356
-    private void doThreads(final FrameContainer origin, final boolean isSilent) {
356
+    private void doThreads(final FrameContainer<?> origin, final boolean isSilent) {
357 357
         for (Entry<Thread, StackTraceElement[]> thread: Thread.getAllStackTraces().entrySet()) {
358 358
             sendLine(origin, isSilent, FORMAT_OUTPUT, Styliser.CODE_BOLD
359 359
                     + thread.getKey().getName());
@@ -371,7 +371,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
371 371
      * @param origin The window this command was executed in
372 372
      * @param isSilent Whether this command has been silenced or not
373 373
      */
374
-    private void doServerState(final FrameContainer origin, final boolean isSilent) {
374
+    private void doServerState(final FrameContainer<?> origin, final boolean isSilent) {
375 375
         if (origin.getServer() == null) {
376 376
             sendLine(origin, isSilent, FORMAT_ERROR, "This window isn't connected to a server");
377 377
         } else {
@@ -386,7 +386,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
386 386
      * @param origin The window this command was executed in
387 387
      * @param isSilent Whether this command has been silenced or not
388 388
      */
389
-    private void doServerInfo(final FrameContainer origin, final boolean isSilent) {
389
+    private void doServerInfo(final FrameContainer<?> origin, final boolean isSilent) {
390 390
         if (origin.getServer() == null) {
391 391
             sendLine(origin, isSilent, FORMAT_ERROR, "This window isn't connected to a server");
392 392
         } else {
@@ -411,7 +411,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
411 411
      * 
412 412
      * @param origin The window this command was executed in
413 413
      */
414
-    private void doBenchmark(final FrameContainer origin) {
414
+    private void doBenchmark(final FrameContainer<?> origin) {
415 415
         long[] results = new long[10];
416 416
         
417 417
         for (int i = 0; i < results.length; i++) {
@@ -439,7 +439,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
439 439
      * @param isSilent Whether this command has been silenced or not
440 440
      * @param args The arguments that were passed to the command
441 441
      */
442
-    private void doServices(final FrameContainer origin, final boolean isSilent,
442
+    private void doServices(final FrameContainer<?> origin, final boolean isSilent,
443 443
             final String[] args) {
444 444
         sendLine(origin, isSilent, FORMAT_OUTPUT, "Available Services:");
445 445
         for (Service service : PluginManager.getPluginManager().getAllServices()) {

+ 3
- 3
src/com/dmdirc/commandparser/commands/global/Echo.java 查看文件

@@ -115,7 +115,7 @@ public final class Echo extends GlobalCommand implements IntelligentCommand {
115 115
             targets.add("--target");
116 116
         } else if (arg == 1 && context.getPreviousArgs().get(0).equals("--target")) {
117 117
 
118
-            final List<FrameContainer> windowList = new ArrayList<FrameContainer>();
118
+            final List<FrameContainer<?>> windowList = new ArrayList<FrameContainer<?>>();
119 119
             final Server currentServer = context.getWindow().getContainer()
120 120
                     .getServer();
121 121
 
@@ -128,8 +128,8 @@ public final class Echo extends GlobalCommand implements IntelligentCommand {
128 128
             }
129 129
 
130 130
             //Global Windows
131
-            windowList.addAll(Arrays.asList(WindowManager.getRootWindows()));
132
-            for (FrameContainer customWindow : windowList) {
131
+            windowList.addAll(WindowManager.getRootWindows());
132
+            for (FrameContainer<?> customWindow : windowList) {
133 133
                 if (customWindow instanceof CustomWindow) {
134 134
                     targets.add(customWindow.getName());
135 135
                 }

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/Exit.java 查看文件

@@ -47,7 +47,7 @@ public final class Exit extends GlobalCommand {
47 47
     
48 48
     /** {@inheritDoc} */
49 49
     @Override
50
-    public void execute(final FrameContainer origin, final boolean isSilent,
50
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
51 51
             final CommandArguments args) {
52 52
         Main.quit(args.getArguments().length > 0 ? args.getArgumentsAsString()
53 53
                 : origin.getConfigManager().getOption("general", "closemessage"));

+ 5
- 5
src/com/dmdirc/commandparser/commands/global/Help.java 查看文件

@@ -58,7 +58,7 @@ public final class Help extends GlobalCommand implements IntelligentCommand {
58 58
     
59 59
     /** {@inheritDoc} */
60 60
     @Override
61
-    public void execute(final FrameContainer origin, final boolean isSilent,
61
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
62 62
             final CommandArguments args) {
63 63
         if (args.getArguments().length == 0) {
64 64
             showAllCommands(origin, isSilent);
@@ -73,9 +73,9 @@ public final class Help extends GlobalCommand implements IntelligentCommand {
73 73
      * @param origin The window the command was executed in
74 74
      * @param isSilent Whether this command has been silenced or not
75 75
      */
76
-    private void showAllCommands(final FrameContainer origin, final boolean isSilent) {
77
-        final List<String> commands = new ArrayList<String>(((WritableFrameContainer) origin)
78
-                .getFrame().getCommandParser().getCommands().keySet());
76
+    private void showAllCommands(final FrameContainer<?> origin, final boolean isSilent) {
77
+        final List<String> commands = new ArrayList<String>(((WritableFrameContainer<?>) origin)
78
+                .getCommandParser().getCommands().keySet());
79 79
 
80 80
         Collections.sort(commands);
81 81
         
@@ -110,7 +110,7 @@ public final class Help extends GlobalCommand implements IntelligentCommand {
110 110
      * @param isSilent Whether this command has been silenced or not
111 111
      * @param name The name of the command to display info for
112 112
      */
113
-    private void showCommand(final FrameContainer origin, final boolean isSilent,
113
+    private void showCommand(final FrameContainer<?> origin, final boolean isSilent,
114 114
             final String name) {
115 115
         Map.Entry<CommandInfo, Command> command = null;
116 116
 

+ 2
- 2
src/com/dmdirc/commandparser/commands/global/Ifplugin.java 查看文件

@@ -53,7 +53,7 @@ public final class Ifplugin extends GlobalCommand implements IntelligentCommand
53 53
     
54 54
     /** {@inheritDoc} */
55 55
     @Override
56
-    public void execute(final FrameContainer origin, final boolean isSilent,
56
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
57 57
             final CommandArguments args) {
58 58
         if (args.getArguments().length <= 1) {
59 59
             showUsage(origin, isSilent, "ifplugin", "<[!]plugin> <command>");
@@ -77,7 +77,7 @@ public final class Ifplugin extends GlobalCommand implements IntelligentCommand
77 77
                 GlobalCommandParser.getGlobalCommandParser().parseCommand(null,
78 78
                         args.getArgumentsAsString(1));
79 79
             } else {
80
-                ((WritableFrameContainer) origin).getFrame().getCommandParser()
80
+                ((WritableFrameContainer<?>) origin).getCommandParser()
81 81
                         .parseCommand(origin, args.getArgumentsAsString(1));
82 82
             }
83 83
         }

+ 3
- 3
src/com/dmdirc/commandparser/commands/global/Input.java 查看文件

@@ -50,7 +50,7 @@ public class Input extends GlobalCommand implements IntelligentCommand {
50 50
 
51 51
     /** {@inheritDoc} */
52 52
     @Override
53
-    public void execute(final FrameContainer origin, final boolean isSilent,
53
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
54 54
             final CommandArguments args) {
55 55
 
56 56
         if (args.getArguments().length == 0) {
@@ -59,10 +59,10 @@ public class Input extends GlobalCommand implements IntelligentCommand {
59 59
             return;
60 60
         } else if (args.getArguments().length == 1
61 61
                 && "--clear".equals(args.getArgumentsAsString(0))) {
62
-            ((WritableFrameContainer) origin).getFrame()
62
+            ((WritableFrameContainer<?>) origin).getFrame()
63 63
                     .getInputHandler().clearInputField();
64 64
         } else {
65
-            ((WritableFrameContainer) origin).getFrame()
65
+            ((WritableFrameContainer<?>) origin).getFrame()
66 66
                     .getInputHandler().addToInputField(args.getArgumentsAsString());
67 67
         }
68 68
     }

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/Notify.java 查看文件

@@ -51,7 +51,7 @@ public final class Notify extends GlobalCommand implements IntelligentCommand {
51 51
     
52 52
     /** {@inheritDoc} */
53 53
     @Override
54
-    public void execute(final FrameContainer origin, final boolean isSilent,
54
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
55 55
             final CommandArguments args) {
56 56
         if (args.getArguments().length == 0) {
57 57
             showUsage(origin, isSilent, "notify", "<colour>");

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/ReloadActions.java 查看文件

@@ -48,7 +48,7 @@ public final class ReloadActions extends GlobalCommand implements IntelligentCom
48 48
     
49 49
     /** {@inheritDoc} */
50 50
     @Override
51
-    public void execute(final FrameContainer origin, final boolean isSilent,
51
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
52 52
             final CommandArguments args) {
53 53
         ActionManager.loadActions();
54 54
         sendLine(origin, isSilent, FORMAT_OUTPUT, "Actions reloaded.");

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/ReloadIdentities.java 查看文件

@@ -46,7 +46,7 @@ public class ReloadIdentities extends GlobalCommand implements IntelligentComman
46 46
 
47 47
     /** {@inheritDoc} */
48 48
     @Override    
49
-    public void execute(final FrameContainer origin, final boolean isSilent,
49
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
50 50
             final CommandArguments args) {
51 51
         IdentityManager.loadUser();
52 52
         

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/SaveConfig.java 查看文件

@@ -48,7 +48,7 @@ public final class SaveConfig extends GlobalCommand implements IntelligentComman
48 48
     
49 49
     /** {@inheritDoc} */
50 50
     @Override
51
-    public void execute(final FrameContainer origin, final boolean isSilent,
51
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
52 52
             final CommandArguments args) {
53 53
         IdentityManager.save();
54 54
         

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/UnloadPlugin.java 查看文件

@@ -49,7 +49,7 @@ public final class UnloadPlugin extends GlobalCommand implements IntelligentComm
49 49
     
50 50
     /** {@inheritDoc} */
51 51
     @Override
52
-    public void execute(final FrameContainer origin, final boolean isSilent,
52
+    public void execute(final FrameContainer<?> origin, final boolean isSilent,
53 53
             final CommandArguments args) {
54 54
         if (args.getArguments().length == 0) {
55 55
             showUsage(origin, isSilent, "unloadplugin", "<plugin>");

+ 2
- 2
src/com/dmdirc/commandparser/commands/server/OpenQuery.java 查看文件

@@ -52,7 +52,7 @@ public final class OpenQuery extends ServerCommand implements
52 52
     
53 53
     /** {@inheritDoc} */
54 54
     @Override
55
-    public void execute(final FrameContainer origin, final Server server,
55
+    public void execute(final FrameContainer<?> origin, final Server server,
56 56
             final boolean isSilent, final CommandArguments args) {
57 57
         if (args.getArguments().length == 0) {
58 58
             showUsage(origin, isSilent, "query", "<target> <message>");
@@ -72,7 +72,7 @@ public final class OpenQuery extends ServerCommand implements
72 72
         if (server.hasQuery(args.getArguments()[0])) {
73 73
             server.getQuery(args.getArguments()[0]).activateFrame();
74 74
         } else {
75
-            server.getQuery(args.getArguments()[0]).show();
75
+            server.getQuery(args.getArguments()[0]).activateFrame();
76 76
         }
77 77
 
78 78
         if (args.getArguments().length > 1) {

+ 6
- 4
src/com/dmdirc/commandparser/parsers/ChannelCommandParser.java 查看文件

@@ -61,8 +61,10 @@ public final class ChannelCommandParser extends CommandParser {
61 61
 
62 62
     /** {@inheritDoc} */
63 63
     @Override
64
-    public void setOwner(final FrameContainer owner) {
65
-        channel = (Channel) owner;
64
+    public void setOwner(final FrameContainer<?> owner) {
65
+        if (channel == null) {
66
+            channel = (Channel) owner;
67
+        }
66 68
     }
67 69
     
68 70
     /** {@inheritDoc} */
@@ -74,7 +76,7 @@ public final class ChannelCommandParser extends CommandParser {
74 76
     
75 77
     /** {@inheritDoc} */
76 78
     @Override
77
-    protected void executeCommand(final FrameContainer origin,
79
+    protected void executeCommand(final FrameContainer<?> origin,
78 80
             final boolean isSilent, final Command command, final CommandArguments args) {
79 81
         if (command instanceof ChannelCommand) {
80 82
             ((ChannelCommand) command).execute(origin, channel.getServer(), channel, isSilent, args);
@@ -95,7 +97,7 @@ public final class ChannelCommandParser extends CommandParser {
95 97
      * @param line The line input by the user
96 98
      */
97 99
     @Override
98
-    protected void handleNonCommand(final FrameContainer origin, final String line) {
100
+    protected void handleNonCommand(final FrameContainer<?> origin, final String line) {
99 101
         channel.sendLine(line);
100 102
     }
101 103
     

+ 9
- 9
src/com/dmdirc/commandparser/parsers/CommandParser.java 查看文件

@@ -83,7 +83,7 @@ public abstract class CommandParser implements Serializable {
83 83
      * @param owner The container which owns this parser
84 84
      * @since 0.6.4
85 85
      */
86
-    public abstract void setOwner(final FrameContainer owner);
86
+    public abstract void setOwner(final FrameContainer<?> owner);
87 87
 
88 88
     /** Loads the relevant commands into the parser. */
89 89
     protected abstract void loadCommands();
@@ -127,7 +127,7 @@ public abstract class CommandParser implements Serializable {
127 127
      * @param parseChannel Whether or not to try and parse the first argument
128 128
      * as a channel name
129 129
      */
130
-    public final void parseCommand(final FrameContainer origin,
130
+    public final void parseCommand(final FrameContainer<?> origin,
131 131
             final String line, final boolean parseChannel) {
132 132
         final CommandArguments args = new CommandArguments(line);
133 133
 
@@ -161,7 +161,7 @@ public abstract class CommandParser implements Serializable {
161 161
      * @param parseChannel Whether or not to try parsing channel names
162 162
      * @return True iff the command was handled, false otherwise
163 163
      */
164
-    protected boolean handleChannelCommand(final FrameContainer origin,
164
+    protected boolean handleChannelCommand(final FrameContainer<?> origin,
165 165
             final CommandArguments args, final boolean parseChannel) {
166 166
         final boolean silent = args.isSilent();
167 167
         final String command = args.getCommandName();
@@ -188,7 +188,7 @@ public abstract class CommandParser implements Serializable {
188 188
                 }
189 189
 
190 190
                 if (server.hasChannel(channel)) {
191
-                    server.getChannel(channel).getFrame().getCommandParser()
191
+                    server.getChannel(channel).getCommandParser()
192 192
                             .parseCommand(origin, CommandManager.getCommandChar()
193 193
                             + args.getCommandName() + " " + args.getWordsAsString(2), false);
194 194
                 } else {
@@ -250,7 +250,7 @@ public abstract class CommandParser implements Serializable {
250 250
      * @param origin The window in which the command was typed
251 251
      * @param line The line to be parsed
252 252
      */
253
-    public final void parseCommand(final FrameContainer origin,
253
+    public final void parseCommand(final FrameContainer<?> origin,
254 254
             final String line) {
255 255
         parseCommand(origin, line, true);
256 256
     }
@@ -261,7 +261,7 @@ public abstract class CommandParser implements Serializable {
261 261
      * @param origin The window in which the command was typed
262 262
      * @param line The line to be parsed
263 263
      */
264
-    public final void parseCommandCtrl(final FrameContainer origin, final String line) {
264
+    public final void parseCommandCtrl(final FrameContainer<?> origin, final String line) {
265 265
         handleNonCommand(origin, line);
266 266
     }
267 267
 
@@ -274,7 +274,7 @@ public abstract class CommandParser implements Serializable {
274 274
      * @param args The arguments to the command
275 275
      * @since 0.6.3m1
276 276
      */
277
-    protected abstract void executeCommand(final FrameContainer origin,
277
+    protected abstract void executeCommand(final FrameContainer<?> origin,
278 278
             final boolean isSilent, final Command command, final CommandArguments args);
279 279
 
280 280
     /**
@@ -286,7 +286,7 @@ public abstract class CommandParser implements Serializable {
286 286
      * @param args The arguments passed to the command
287 287
      * @since 0.6.3m1
288 288
      */
289
-    protected void handleInvalidCommand(final FrameContainer origin,
289
+    protected void handleInvalidCommand(final FrameContainer<?> origin,
290 290
             final CommandArguments args) {
291 291
         if (origin == null) {
292 292
             ActionManager.processEvent(CoreActionType.UNKNOWN_COMMAND, null,
@@ -308,7 +308,7 @@ public abstract class CommandParser implements Serializable {
308 308
      * @param origin The window in which the command was typed
309 309
      * @param line The line input by the user
310 310
      */
311
-    protected abstract void handleNonCommand(final FrameContainer origin,
311
+    protected abstract void handleNonCommand(final FrameContainer<?> origin,
312 312
             final String line);
313 313
 
314 314
     /**

+ 3
- 3
src/com/dmdirc/commandparser/parsers/GlobalCommandParser.java 查看文件

@@ -58,7 +58,7 @@ public final class GlobalCommandParser extends CommandParser {
58 58
 
59 59
     /** {@inheritDoc} */
60 60
     @Override
61
-    public void setOwner(final FrameContainer owner) {
61
+    public void setOwner(final FrameContainer<?> owner) {
62 62
         // Don't care
63 63
     }
64 64
     
@@ -82,7 +82,7 @@ public final class GlobalCommandParser extends CommandParser {
82 82
     
83 83
     /** {@inheritDoc} */
84 84
     @Override
85
-    protected void executeCommand(final FrameContainer origin,
85
+    protected void executeCommand(final FrameContainer<?> origin,
86 86
             final boolean isSilent, final Command command, final CommandArguments args) {
87 87
         ((GlobalCommand) command).execute(origin, isSilent, args);
88 88
     }
@@ -94,7 +94,7 @@ public final class GlobalCommandParser extends CommandParser {
94 94
      * @param line The line input by the user
95 95
      */
96 96
     @Override
97
-    protected void handleNonCommand(final FrameContainer origin, final String line) {
97
+    protected void handleNonCommand(final FrameContainer<?> origin, final String line) {
98 98
         if (origin == null) {
99 99
             Logger.userError(ErrorLevel.MEDIUM, "Invalid global command: " + line);
100 100
         } else {

+ 6
- 4
src/com/dmdirc/commandparser/parsers/QueryCommandParser.java 查看文件

@@ -61,8 +61,10 @@ public final class QueryCommandParser extends CommandParser {
61 61
 
62 62
     /** {@inheritDoc} */
63 63
     @Override
64
-    public void setOwner(final FrameContainer owner) {
65
-        query = (Query) owner;
64
+    public void setOwner(final FrameContainer<?> owner) {
65
+        if (query == null) {
66
+            query = (Query) owner;
67
+        }
66 68
     }
67 69
     
68 70
     /** Loads the relevant commands into the parser. */
@@ -74,7 +76,7 @@ public final class QueryCommandParser extends CommandParser {
74 76
     
75 77
     /** {@inheritDoc} */
76 78
     @Override
77
-    protected void executeCommand(final FrameContainer origin,
79
+    protected void executeCommand(final FrameContainer<?> origin,
78 80
             final boolean isSilent, final Command command, final CommandArguments args) {
79 81
         if (command instanceof QueryCommand) {
80 82
             ((QueryCommand) command).execute(origin, query.getServer(), query, isSilent, args);
@@ -94,7 +96,7 @@ public final class QueryCommandParser extends CommandParser {
94 96
      * @param line The line input by the user
95 97
      */
96 98
     @Override
97
-    protected void handleNonCommand(final FrameContainer origin, final String line) {
99
+    protected void handleNonCommand(final FrameContainer<?> origin, final String line) {
98 100
         query.sendLine(line);
99 101
     }
100 102
     

+ 6
- 6
src/com/dmdirc/commandparser/parsers/RawCommandParser.java 查看文件

@@ -38,8 +38,8 @@ public class RawCommandParser extends ServerCommandParser {
38 38
      */
39 39
     private static final long serialVersionUID = 1;
40 40
 
41
-    /** The server this parser is for. */
42
-    private Server server;
41
+    /** The container that owns this parser. */
42
+    private FrameContainer<?> owner;
43 43
 
44 44
     /**
45 45
      * Creates a new raw command parser for the specified server.
@@ -50,14 +50,14 @@ public class RawCommandParser extends ServerCommandParser {
50 50
 
51 51
     /** {@inheritDoc} */
52 52
     @Override
53
-    public void setOwner(final FrameContainer owner) {
54
-        server = owner.getServer();
53
+    public void setOwner(final FrameContainer<?> owner) {
54
+        this.owner = owner;
55 55
     }
56 56
 
57 57
     /** {@inheritDoc} */
58 58
     @Override
59
-    protected void handleNonCommand(final FrameContainer origin, final String line) {
60
-        server.getParser().sendRawMessage(line);
59
+    protected void handleNonCommand(final FrameContainer<?> origin, final String line) {
60
+        owner.getServer().getParser().sendRawMessage(line);
61 61
     }
62 62
 
63 63
 }

+ 6
- 4
src/com/dmdirc/commandparser/parsers/ServerCommandParser.java 查看文件

@@ -59,8 +59,10 @@ public class ServerCommandParser extends CommandParser {
59 59
 
60 60
     /** {@inheritDoc} */
61 61
     @Override
62
-    public void setOwner(final FrameContainer owner) {
63
-        server = (Server) owner;
62
+    public void setOwner(final FrameContainer<?> owner) {
63
+        if (server == null) {
64
+            server = (Server) owner;
65
+        }
64 66
     }
65 67
     
66 68
     /** Loads the relevant commands into the parser. */
@@ -71,7 +73,7 @@ public class ServerCommandParser extends CommandParser {
71 73
     
72 74
     /** {@inheritDoc} */
73 75
     @Override
74
-    protected void executeCommand(final FrameContainer origin,
76
+    protected void executeCommand(final FrameContainer<?> origin,
75 77
             final boolean isSilent, final Command command, final CommandArguments args) {
76 78
         if (command instanceof ServerCommand) {
77 79
             if (hasCommandOptions(command) && !getCommandOptions(command).allowOffline()
@@ -96,7 +98,7 @@ public class ServerCommandParser extends CommandParser {
96 98
      * @param line The line input by the user
97 99
      */
98 100
     @Override
99
-    protected void handleNonCommand(final FrameContainer origin, final String line) {
101
+    protected void handleNonCommand(final FrameContainer<?> origin, final String line) {
100 102
         server.sendLine(line);
101 103
     }
102 104
     

+ 5
- 5
src/com/dmdirc/config/ConfigTarget.java 查看文件

@@ -31,7 +31,7 @@ import java.io.Serializable;
31 31
  *
32 32
  * @author chris
33 33
  */
34
-public class ConfigTarget implements Comparable, Serializable {
34
+public class ConfigTarget implements Comparable<ConfigTarget>, Serializable {
35 35
 
36 36
     /** The possible target types. */
37 37
     public static enum TYPE {
@@ -218,11 +218,11 @@ public class ConfigTarget implements Comparable, Serializable {
218 218
      * equal, or a positive integer if this is more specific
219 219
      */
220 220
     @Override
221
-    public int compareTo(final Object target) {
222
-        if (type.equals(((ConfigTarget) target).getType())) {
223
-            return ((ConfigTarget) target).getOrder() - order;
221
+    public int compareTo(final ConfigTarget target) {
222
+        if (type.equals(target.getType())) {
223
+            return target.getOrder() - order;
224 224
         } else {
225
-            return type.compareTo(((ConfigTarget) target).getType());
225
+            return type.compareTo(target.getType());
226 226
         }
227 227
     }
228 228
 

+ 1
- 1
src/com/dmdirc/config/prefs/validator/OptionalValidator.java 查看文件

@@ -42,7 +42,7 @@ public class OptionalValidator implements Validator<String> {
42 42
      *
43 43
      * @return Secondary validator
44 44
      */
45
-    public Validator getValidator() {
45
+    public Validator<String> getValidator() {
46 46
         return validator;
47 47
     }
48 48
     

+ 3
- 3
src/com/dmdirc/interfaces/FrameInfoListener.java 查看文件

@@ -41,7 +41,7 @@ public interface FrameInfoListener extends EventListener {
41 41
      * @param window The window whose icon changed
42 42
      * @param icon The new icon for the window
43 43
      */
44
-    void iconChanged(final FrameContainer window, final String icon);
44
+    void iconChanged(final FrameContainer<?> window, final String icon);
45 45
 
46 46
     /**
47 47
      * Called when a window's name is changed.
@@ -49,7 +49,7 @@ public interface FrameInfoListener extends EventListener {
49 49
      * @param window The window whose name changed
50 50
      * @param name The new name for the window
51 51
      */
52
-    void nameChanged(final FrameContainer window, final String name);
52
+    void nameChanged(final FrameContainer<?> window, final String name);
53 53
 
54 54
     /**
55 55
      * Called when a window's title is changed.
@@ -57,6 +57,6 @@ public interface FrameInfoListener extends EventListener {
57 57
      * @param window The window whose title changed
58 58
      * @param title The new title for the window
59 59
      */
60
-    void titleChanged(final FrameContainer window, final String title);
60
+    void titleChanged(final FrameContainer<?> window, final String title);
61 61
 
62 62
 }

+ 2
- 2
src/com/dmdirc/interfaces/NotificationListener.java 查看文件

@@ -41,12 +41,12 @@ public interface NotificationListener extends EventListener {
41 41
      * @param window The window whose notification has changed
42 42
      * @param colour The new colour of the notification
43 43
      */
44
-    void notificationSet(final FrameContainer window, final Color colour);
44
+    void notificationSet(final FrameContainer<?> window, final Color colour);
45 45
 
46 46
     /**
47 47
      * Called when a notification has been cleared.
48 48
      *
49 49
      * @param window The window whose notification has been cleared
50 50
      */
51
-    void notificationCleared(final FrameContainer window);
51
+    void notificationCleared(final FrameContainer<?> window);
52 52
 }

+ 1
- 1
src/com/dmdirc/interfaces/SelectionListener.java 查看文件

@@ -39,6 +39,6 @@ public interface SelectionListener extends EventListener {
39 39
      *
40 40
      * @param window The window that's now selected
41 41
      */
42
-    void selectionChanged(final FrameContainer window);
42
+    void selectionChanged(final FrameContainer<?> window);
43 43
 
44 44
 }

+ 37
- 34
src/com/dmdirc/ui/WindowManager.java 查看文件

@@ -37,6 +37,7 @@ import com.dmdirc.ui.interfaces.Window;
37 37
 import java.util.ArrayList;
38 38
 import java.util.Collection;
39 39
 import java.util.List;
40
+import java.util.concurrent.CopyOnWriteArrayList;
40 41
 
41 42
 /**
42 43
  * The WindowManager maintains a list of all open windows, and their
@@ -47,8 +48,8 @@ import java.util.List;
47 48
 public class WindowManager {
48 49
 
49 50
     /** A list of root windows. */
50
-    private final static List<FrameContainer> rootWindows
51
-            = new ArrayList<FrameContainer>();
51
+    private final static List<FrameContainer<?>> rootWindows
52
+            = new CopyOnWriteArrayList<FrameContainer<?>>();
52 53
     
53 54
     /** A list of frame listeners. */
54 55
     private final static List<FrameListener> frameListeners
@@ -63,7 +64,7 @@ public class WindowManager {
63 64
             = new WMSelectionListener();
64 65
 
65 66
     /** Active window. */
66
-    private static FrameContainer activeWindow;
67
+    private static FrameContainer<?> activeWindow;
67 68
 
68 69
     /**
69 70
      * Creates a new instance of WindowManager.
@@ -132,7 +133,7 @@ public class WindowManager {
132 133
         "The specified Window is not null",
133 134
         "The specified Window has not already been added"
134 135
     })
135
-    public static void addWindow(final FrameContainer window) {
136
+    public static void addWindow(final FrameContainer<?> window) {
136 137
         addWindow(window, true);
137 138
     }
138 139
 
@@ -147,7 +148,7 @@ public class WindowManager {
147 148
         "The specified Window is not null",
148 149
         "The specified Window has not already been added"
149 150
     })
150
-    public static void addWindow(final FrameContainer window, final boolean focus) {
151
+    public static void addWindow(final FrameContainer<?> window, final boolean focus) {
151 152
         Logger.assertTrue(window != null);
152 153
         Logger.assertTrue(!rootWindows.contains(window));
153 154
 
@@ -196,8 +197,8 @@ public class WindowManager {
196 197
     @Precondition({
197 198
         "The specified Windows are not null"
198 199
     })
199
-    public static void addWindow(final FrameContainer parent,
200
-            final FrameContainer child) {
200
+    public static void addWindow(final FrameContainer<?> parent,
201
+            final FrameContainer<?> child) {
201 202
         addWindow(parent, child, true);
202 203
     }
203 204
 
@@ -212,8 +213,8 @@ public class WindowManager {
212 213
     @Precondition({
213 214
         "The specified Windows are not null"
214 215
     })
215
-    public static void addWindow(final FrameContainer parent,
216
-            final FrameContainer child, final boolean focus) {
216
+    public static void addWindow(final FrameContainer<?> parent,
217
+            final FrameContainer<?> child, final boolean focus) {
217 218
         Logger.assertTrue(parent != null);
218 219
         Logger.assertTrue(child != null);
219 220
 
@@ -267,7 +268,7 @@ public class WindowManager {
267 268
      * @since 0.6.4
268 269
      */
269 270
     @Precondition("The specified Window is not null")
270
-    public static void removeWindow(final FrameContainer window) {
271
+    public static void removeWindow(final FrameContainer<?> window) {
271 272
         removeWindow(window, false);
272 273
     }
273 274
 
@@ -283,7 +284,7 @@ public class WindowManager {
283 284
      * @since 0.6.3
284 285
      */
285 286
     @Precondition("The specified Window is not null")
286
-    public static void removeWindow(final FrameContainer window, final boolean canWait) {
287
+    public static void removeWindow(final FrameContainer<?> window, final boolean canWait) {
287 288
         Logger.assertTrue(window != null);
288 289
 
289 290
         if (!window.getChildren().isEmpty()) {
@@ -298,7 +299,7 @@ public class WindowManager {
298 299
                 return;
299 300
             }
300 301
 
301
-            for (FrameContainer child : window.getChildren()) {
302
+            for (FrameContainer<?> child : window.getChildren()) {
302 303
                 child.close();
303 304
             }
304 305
 
@@ -317,7 +318,7 @@ public class WindowManager {
317 318
                 fireSelectionChanged(null);
318 319
             }
319 320
         } else {
320
-            final FrameContainer parent = window.getParent();
321
+            final FrameContainer<?> parent = window.getParent();
321 322
             fireDeleteWindow(parent, window);
322 323
 
323 324
             if (parent == null) {
@@ -343,7 +344,7 @@ public class WindowManager {
343 344
      * @return The specified custom window, or null
344 345
      */
345 346
     @Precondition("The specified window name is not null")
346
-    public static FrameContainer findCustomWindow(final String name) {
347
+    public static FrameContainer<?> findCustomWindow(final String name) {
347 348
         Logger.assertTrue(name != null);
348 349
 
349 350
         return findCustomWindow(rootWindows, name);
@@ -362,7 +363,8 @@ public class WindowManager {
362 363
         "The specified parent window is not null",
363 364
         "The specified parent window has been added to the Window Manager"
364 365
     })
365
-    public static FrameContainer findCustomWindow(final FrameContainer parent, final String name) {
366
+    public static FrameContainer<?> findCustomWindow(final FrameContainer<?> parent,
367
+            final String name) {
366 368
         Logger.assertTrue(parent != null);
367 369
         Logger.assertTrue(name != null);
368 370
 
@@ -377,9 +379,9 @@ public class WindowManager {
377 379
      * @param name The name of the custom window to search for
378 380
      * @return The custom window if found, or null otherwise
379 381
      */
380
-    private static FrameContainer findCustomWindow(final Collection<FrameContainer> windows,
382
+    private static FrameContainer<?> findCustomWindow(final Collection<FrameContainer<?>> windows,
381 383
             final String name) {
382
-        for (FrameContainer window : windows) {
384
+        for (FrameContainer<?> window : windows) {
383 385
             if (window instanceof CustomWindow
384 386
                     && ((CustomWindow) window).getName().equals(name)) {
385 387
                 return window;
@@ -399,18 +401,18 @@ public class WindowManager {
399 401
      * @deprecated Call {@link FrameContainer#getParent()} directly
400 402
      */
401 403
     @Deprecated
402
-    public static FrameContainer getParent(final FrameContainer window) {
404
+    public static FrameContainer<?> getParent(final FrameContainer<?> window) {
403 405
         return window.getParent();
404 406
     }
405 407
     
406 408
     /**
407 409
      * Retrieves all known root (parent-less) windows.
408 410
      * 
409
-     * @since 0.6
410
-     * @return An array of all known root windows.
411
+     * @since 0.6.4
412
+     * @return A collection of all known root windows.
411 413
      */
412
-    public static FrameContainer[] getRootWindows() {
413
-        return rootWindows.toArray(new FrameContainer[rootWindows.size()]);
414
+    public static Collection<FrameContainer<?>> getRootWindows() {
415
+        return rootWindows;
414 416
     }
415 417
 
416 418
     /**
@@ -419,7 +421,7 @@ public class WindowManager {
419 421
      * @return Focused window or null
420 422
      * @since 0.6.3
421 423
      */
422
-    public static FrameContainer getActiveWindow() {
424
+    public static FrameContainer<?> getActiveWindow() {
423 425
         return activeWindow;
424 426
     }
425 427
 
@@ -436,14 +438,14 @@ public class WindowManager {
436 438
     /**
437 439
      * Retrieves all children of the specified window.
438 440
      * 
439
-     * @since 0.6
441
+     * @since 0.6.4
440 442
      * @param window The window whose children are being requested
441
-     * @return An array of all known child windows.
443
+     * @return A collection of all known child windows.
442 444
      * @deprecated Call {@link FrameContainer#getChildren()} directly
443 445
      */
444 446
     @Deprecated
445
-    public static FrameContainer[] getChildren(final FrameContainer window) {
446
-        return window.getChildren().toArray(new FrameContainer[window.getChildren().size()]);
447
+    public static Collection<FrameContainer<?>> getChildren(final FrameContainer<?> window) {
448
+        return window.getChildren();
447 449
     }
448 450
     
449 451
     /**
@@ -452,7 +454,7 @@ public class WindowManager {
452 454
      * @param window The window that was added
453 455
      * @param focus Should this window become focused
454 456
      */
455
-    private static void fireAddWindow(final FrameContainer window, final boolean focus) {
457
+    private static void fireAddWindow(final FrameContainer<?> window, final boolean focus) {
456 458
         for (FrameListener listener : frameListeners) {
457 459
             listener.addWindow(window, focus);
458 460
         }
@@ -466,8 +468,8 @@ public class WindowManager {
466 468
      * @param focus Should this window become focused
467 469
      *
468 470
      */
469
-    private static void fireAddWindow(final FrameContainer parent, 
470
-            final FrameContainer child, final boolean focus) {
471
+    private static void fireAddWindow(final FrameContainer<?> parent,
472
+            final FrameContainer<?> child, final boolean focus) {
471 473
         for (FrameListener listener : frameListeners) {
472 474
             listener.addWindow(parent, child, focus);
473 475
         }
@@ -478,7 +480,7 @@ public class WindowManager {
478 480
      * 
479 481
      * @param window The window that was removed
480 482
      */
481
-    private static void fireDeleteWindow(final FrameContainer window) {
483
+    private static void fireDeleteWindow(final FrameContainer<?> window) {
482 484
         for (FrameListener listener : frameListeners) {
483 485
             listener.delWindow(window);
484 486
         }
@@ -490,7 +492,8 @@ public class WindowManager {
490 492
      * @param parent The parent window
491 493
      * @param child The child window that was removed
492 494
      */
493
-    private static void fireDeleteWindow(final FrameContainer parent, final FrameContainer child) {
495
+    private static void fireDeleteWindow(final FrameContainer<?> parent,
496
+            final FrameContainer<?> child) {
494 497
         for (FrameListener listener : frameListeners) {
495 498
             listener.delWindow(parent, child);
496 499
         }
@@ -502,7 +505,7 @@ public class WindowManager {
502 505
      *
503 506
      * @param window The window that is now focused (or null)
504 507
      */
505
-    private static void fireSelectionChanged(final FrameContainer window) {
508
+    private static void fireSelectionChanged(final FrameContainer<?> window) {
506 509
         for (SelectionListener listener : selListeners) {
507 510
             listener.selectionChanged(window);
508 511
         }
@@ -517,7 +520,7 @@ public class WindowManager {
517 520
 
518 521
         /** {@inheritDoc} */
519 522
         @Override
520
-        public void selectionChanged(final FrameContainer window) {
523
+        public void selectionChanged(final FrameContainer<?> window) {
521 524
             activeWindow = window;
522 525
 
523 526
             fireSelectionChanged(window);

+ 4
- 4
src/com/dmdirc/ui/interfaces/FrameListener.java 查看文件

@@ -38,14 +38,14 @@ public interface FrameListener {
38 38
      * @param window The server to be added
39 39
      * @param focus Should this window become focused
40 40
      */
41
-    void addWindow(FrameContainer window, final boolean focus);
41
+    void addWindow(FrameContainer<?> window, final boolean focus);
42 42
 
43 43
     /**
44 44
      * Removes a window from this frame manager.
45 45
      *
46 46
      * @param window The server to be removed
47 47
      */
48
-    void delWindow(FrameContainer window);
48
+    void delWindow(FrameContainer<?> window);
49 49
 
50 50
     /**
51 51
      * Adds a new window to this frame manager.
@@ -54,7 +54,7 @@ public interface FrameListener {
54 54
      * @param window The custom window to be added
55 55
      * @param focus Should this window become focused
56 56
      */
57
-    void addWindow(FrameContainer parent, FrameContainer window, final boolean focus);
57
+    void addWindow(FrameContainer<?> parent, FrameContainer<?> window, final boolean focus);
58 58
 
59 59
     /**
60 60
      * Removes a window from this frame manager.
@@ -62,6 +62,6 @@ public interface FrameListener {
62 62
      * @param parent The parent to which the window belongs, or null
63 63
      * @param window The custom window to be removed
64 64
      */
65
-    void delWindow(FrameContainer parent, FrameContainer window);
65
+    void delWindow(FrameContainer<?> parent, FrameContainer<?> window);
66 66
 
67 67
 }

+ 1
- 1
src/com/dmdirc/ui/interfaces/InputWindow.java 查看文件

@@ -65,6 +65,6 @@ public interface InputWindow extends Window {
65 65
      * @return The container that owns this command window.
66 66
      */
67 67
     @Override
68
-    WritableFrameContainer getContainer();    
68
+    WritableFrameContainer<? extends InputWindow> getContainer();
69 69
     
70 70
 }

+ 2
- 4
src/com/dmdirc/ui/interfaces/UIController.java 查看文件

@@ -27,7 +27,6 @@ import com.dmdirc.FrameContainer;
27 27
 import com.dmdirc.Query;
28 28
 import com.dmdirc.Server;
29 29
 import com.dmdirc.WritableFrameContainer;
30
-import com.dmdirc.commandparser.parsers.CommandParser;
31 30
 import com.dmdirc.config.prefs.PreferencesInterface;
32 31
 import com.dmdirc.ui.WindowManager;
33 32
 import com.dmdirc.ui.core.dialogs.sslcertificate.SSLCertificateDialogModel;
@@ -88,16 +87,15 @@ public interface UIController {
88 87
      * @param owner The owner of the input window
89 88
      * @return A new custom window
90 89
      */
91
-    Window getWindow(FrameContainer owner);
90
+    Window getWindow(FrameContainer<?> owner);
92 91
     
93 92
     /**
94 93
      * Creates a new custom input window instance.
95 94
      *
96 95
      * @param owner The owner of the input window
97
-     * @param commandParser The command parser to be used
98 96
      * @return A new custom input window
99 97
      */
100
-    InputWindow getInputWindow(WritableFrameContainer owner);
98
+    InputWindow getInputWindow(WritableFrameContainer<?> owner);
101 99
     
102 100
     /**
103 101
      * Returns an updater dialog for the specified updates.

+ 10
- 2
src/com/dmdirc/ui/interfaces/Window.java 查看文件

@@ -87,7 +87,7 @@ public interface Window {
87 87
      *
88 88
      * @return The container that owns this command window.
89 89
      */
90
-    FrameContainer getContainer();
90
+    FrameContainer<?> getContainer();
91 91
 
92 92
     /**
93 93
      * Determines if the current window is visible.
@@ -174,6 +174,14 @@ public interface Window {
174 174
     /**
175 175
      * Requests that this object's frame be activated.
176 176
      */
177
-    public void activateFrame();
177
+    void activateFrame();
178
+
179
+    /**
180
+     * Retrieves the UI controller this window is associated with.
181
+     *
182
+     * @return This window's UI controller
183
+     * @since 0.6.4
184
+     */
185
+    UIController getController();
178 186
 
179 187
 }

+ 2
- 2
src/com/dmdirc/ui/messages/IRCDocument.java 查看文件

@@ -56,7 +56,7 @@ public class IRCDocument implements Serializable, ConfigChangeListener {
56 56
     /** Cached attributed strings. */
57 57
     private transient RollingList<AttributedString> cachedStrings;
58 58
     /** Container that owns this document. */
59
-    private final FrameContainer container;
59
+    private final FrameContainer<?> container;
60 60
     /** Font size. */
61 61
     private int fontSize;
62 62
     /** Font name. */
@@ -70,7 +70,7 @@ public class IRCDocument implements Serializable, ConfigChangeListener {
70 70
      * @param container The container that owns this document
71 71
      * @since 0.6.3
72 72
      */
73
-    public IRCDocument(final FrameContainer container) {
73
+    public IRCDocument(final FrameContainer<?> container) {
74 74
         this.container = container;
75 75
 
76 76
         lines = new ArrayList<Line>();

+ 2
- 2
src/com/dmdirc/ui/messages/Styliser.java 查看文件

@@ -139,7 +139,7 @@ public class Styliser implements ConfigChangeListener {
139 139
     private Color uriColour, channelColour;
140 140
 
141 141
     /** The container that owns this styliser. */
142
-    private final FrameContainer owner;
142
+    private final FrameContainer<?> owner;
143 143
     
144 144
     /**
145 145
      * Creates a new instance of Styliser.
@@ -147,7 +147,7 @@ public class Styliser implements ConfigChangeListener {
147 147
      * @param owner The {@link FrameContainer} that owns this styliser.
148 148
      * @since 0.6.3
149 149
      */
150
-    public Styliser(final FrameContainer owner) {
150
+    public Styliser(final FrameContainer<?> owner) {
151 151
         this.owner = owner;
152 152
 
153 153
         owner.getConfigManager().addChangeListener("ui", "linkcolour", this);

+ 0
- 19
test/com/dmdirc/ServerManagerTest.java 查看文件

@@ -101,26 +101,7 @@ public class ServerManagerTest {
101 101
         
102 102
         assertEquals(instance.getServers().size(), instance.numServers());
103 103
     }
104
-    
105
-    @Test
106
-    public void testGetServerFromFrame() throws URISyntaxException {
107
-        final Server serverA = new Server(new URI("irc-test://255.255.255.255"),
108
-                IdentityManager.getProfiles().get(0));
109
-        final Server serverB = new Server(new URI("irc-test://255.255.255.254"),
110
-                IdentityManager.getProfiles().get(0));
111
-        serverA.connect();
112
-        serverB.connect();
113
-        
114
-        final ServerManager sm = ServerManager.getServerManager();
115 104
         
116
-        assertEquals(serverA, sm.getServerFromFrame(serverA.getFrame()));
117
-        assertEquals(serverB, sm.getServerFromFrame(serverB.getFrame()));
118
-        assertNull(sm.getServerFromFrame(new DummyQueryWindow(serverB)));
119
-        
120
-        serverA.close();
121
-        serverB.close();
122
-    }
123
-    
124 105
     @Test
125 106
     public void testGetServerByAddress() {
126 107
         final Server serverA = mock(Server.class);

+ 5
- 2
test/com/dmdirc/WritableFrameContainerTest.java 查看文件

@@ -25,6 +25,7 @@ package com.dmdirc;
25 25
 import com.dmdirc.config.IdentityManager;
26 26
 import com.dmdirc.config.InvalidIdentityFileException;
27 27
 import com.dmdirc.harness.TestWritableFrameContainer;
28
+import com.dmdirc.ui.interfaces.InputWindow;
28 29
 
29 30
 import java.util.Arrays;
30 31
 import org.junit.BeforeClass;
@@ -40,7 +41,8 @@ public class WritableFrameContainerTest {
40 41
     
41 42
     @Test
42 43
     public void testGetNumLines() {
43
-        final WritableFrameContainer container10 = new TestWritableFrameContainer(10);
44
+        final WritableFrameContainer<?> container10
45
+                = new TestWritableFrameContainer<InputWindow>(10, InputWindow.class);
44 46
         
45 47
         final int res0a = container10.getNumLines("");
46 48
         final int res0b = container10.getNumLines("\r");
@@ -69,7 +71,8 @@ public class WritableFrameContainerTest {
69 71
 
70 72
     @Test
71 73
     public void testSplitLine() {
72
-        final WritableFrameContainer container10 = new TestWritableFrameContainer(10);
74
+        final WritableFrameContainer<?> container10
75
+                = new TestWritableFrameContainer<InputWindow>(10, InputWindow.class);
73 76
         final String[][][] tests = new String[][][]{
74 77
             {{""}, {""}},
75 78
             {{"0123456789"}, {"0123456789"}},

+ 1
- 1
test/com/dmdirc/commandparser/commands/channel/BanTest.java 查看文件

@@ -41,7 +41,7 @@ public class BanTest {
41 41
 
42 42
     @Test
43 43
     public void testUsage() {
44
-        final FrameContainer tiw = mock(FrameContainer.class);
44
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
45 45
         command.execute(tiw, null, null, false, new CommandArguments("/ban"));
46 46
         
47 47
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());

+ 4
- 4
test/com/dmdirc/commandparser/commands/channel/KickReasonTest.java 查看文件

@@ -45,7 +45,7 @@ public class KickReasonTest {
45 45
 
46 46
     @Test
47 47
     public void testUsage() {
48
-        final FrameContainer tiw = mock(FrameContainer.class);
48
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
49 49
         command.execute(tiw, null, null, false, new CommandArguments("/kick"));
50 50
         
51 51
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -53,7 +53,7 @@ public class KickReasonTest {
53 53
 
54 54
     @Test
55 55
     public void testUnknown() {
56
-        final FrameContainer tiw = mock(FrameContainer.class);
56
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
57 57
         final IRCChannelInfo channelInfo = mock(IRCChannelInfo.class);
58 58
         final Channel channel = mock(Channel.class);
59 59
 
@@ -67,7 +67,7 @@ public class KickReasonTest {
67 67
 
68 68
     @Test
69 69
     public void testWithReason() {
70
-        final FrameContainer tiw = mock(FrameContainer.class);
70
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
71 71
         final IRCChannelInfo channelInfo = mock(IRCChannelInfo.class);
72 72
         final Channel channel = mock(Channel.class);
73 73
         final IRCChannelClientInfo cci = mock(IRCChannelClientInfo.class);
@@ -82,7 +82,7 @@ public class KickReasonTest {
82 82
 
83 83
     @Test
84 84
     public void testWithoutReason() {
85
-        final FrameContainer tiw = mock(FrameContainer.class);
85
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
86 86
         final ConfigManager manager = mock(ConfigManager.class);
87 87
         final IRCChannelInfo channelInfo = mock(IRCChannelInfo.class);
88 88
         final Channel channel = mock(Channel.class);

+ 4
- 4
test/com/dmdirc/commandparser/commands/channel/ModeTest.java 查看文件

@@ -66,7 +66,7 @@ public class ModeTest {
66 66
 
67 67
     @Test
68 68
     public void testWithoutArgs() {
69
-        final FrameContainer origin = mock(FrameContainer.class);
69
+        final FrameContainer<?> origin = mock(FrameContainer.class);
70 70
         
71 71
         command.execute(origin, server, channel, false, new CommandArguments("/mode"));
72 72
 
@@ -75,7 +75,7 @@ public class ModeTest {
75 75
 
76 76
     @Test
77 77
     public void testWithArgs() {
78
-        final FrameContainer origin = mock(FrameContainer.class);
78
+        final FrameContainer<?> origin = mock(FrameContainer.class);
79 79
 
80 80
         command.execute(origin, server, channel, false, new CommandArguments("/mode +hello -bye"));
81 81
 
@@ -84,7 +84,7 @@ public class ModeTest {
84 84
 
85 85
     @Test
86 86
     public void testExternalWithArgs() {
87
-        final FrameContainer origin = mock(FrameContainer.class);
87
+        final FrameContainer<?> origin = mock(FrameContainer.class);
88 88
 
89 89
         command.execute(origin, server, "#chan", false,
90 90
                 new CommandArguments("/mode +hello -bye"));
@@ -94,7 +94,7 @@ public class ModeTest {
94 94
 
95 95
     @Test
96 96
     public void testExternalWithoutArgs() {
97
-        final FrameContainer origin = mock(FrameContainer.class);
97
+        final FrameContainer<?> origin = mock(FrameContainer.class);
98 98
 
99 99
         command.execute(origin, server, "#chan", false,
100 100
                 new CommandArguments("/mode"));

+ 1
- 1
test/com/dmdirc/commandparser/commands/channel/PartTest.java 查看文件

@@ -38,7 +38,7 @@ public class PartTest {
38 38
 
39 39
     private final Part command = new Part();
40 40
     private Channel channel;
41
-    private FrameContainer origin;
41
+    private FrameContainer<?> origin;
42 42
     private ConfigManager manager;
43 43
 
44 44
     @BeforeClass

+ 3
- 3
test/com/dmdirc/commandparser/commands/channel/SetNickColourTest.java 查看文件

@@ -40,7 +40,7 @@ public class SetNickColourTest {
40 40
 
41 41
     @Test
42 42
     public void testUsageNoArgs() {
43
-        final FrameContainer tiw = mock(FrameContainer.class);
43
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
44 44
         command.execute(tiw, null, null, false, new CommandArguments("/foo"));
45 45
         
46 46
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -48,7 +48,7 @@ public class SetNickColourTest {
48 48
     
49 49
     @Test
50 50
     public void testUsageNicklist() {
51
-        final FrameContainer tiw = mock(FrameContainer.class);
51
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
52 52
         command.execute(tiw, null, null, false, new CommandArguments("/foo --nicklist"));
53 53
         
54 54
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -56,7 +56,7 @@ public class SetNickColourTest {
56 56
     
57 57
     @Test
58 58
     public void testUsageText() {
59
-        final FrameContainer tiw = mock(FrameContainer.class);
59
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
60 60
         command.execute(tiw, null, null, false, new CommandArguments("/foo --text"));
61 61
         
62 62
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());

+ 2
- 2
test/com/dmdirc/commandparser/commands/chat/MeTest.java 查看文件

@@ -41,7 +41,7 @@ public class MeTest {
41 41
 
42 42
     @Test
43 43
     public void testUsage() {
44
-        final FrameContainer tiw = mock(FrameContainer.class);
44
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
45 45
         command.execute(tiw, null, null, false, new CommandArguments("/foo"));
46 46
         
47 47
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -49,7 +49,7 @@ public class MeTest {
49 49
     
50 50
     @Test
51 51
     public void testSend() {
52
-        final MessageTarget mtt = mock(MessageTarget.class);
52
+        final MessageTarget<?> mtt = mock(MessageTarget.class);
53 53
         command.execute(null, null, mtt, false, new CommandArguments("/foo hello meep moop"));
54 54
 
55 55
         verify(mtt).sendAction("hello meep moop");

+ 2
- 2
test/com/dmdirc/commandparser/commands/global/AliasCommandTest.java 查看文件

@@ -40,7 +40,7 @@ public class AliasCommandTest {
40 40
 
41 41
     @Test
42 42
     public void testUsageNoArgs() {
43
-        final FrameContainer tiw = mock(FrameContainer.class);
43
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
44 44
 
45 45
         command.execute(tiw, false, new CommandArguments("/foo"));
46 46
         
@@ -49,7 +49,7 @@ public class AliasCommandTest {
49 49
     
50 50
     @Test
51 51
     public void testUsageOneArg() {
52
-        final FrameContainer tiw = mock(FrameContainer.class);
52
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
53 53
         
54 54
         command.execute(tiw, false, new CommandArguments("/foo --remove"));
55 55
         

+ 2
- 2
test/com/dmdirc/commandparser/commands/global/DebugTest.java 查看文件

@@ -39,7 +39,7 @@ public class DebugTest {
39 39
 
40 40
     @Test
41 41
     public void testUsage() {
42
-        final FrameContainer tiw = mock(FrameContainer.class);
42
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
43 43
 
44 44
         command.execute(tiw, false, new CommandArguments("/foo"));
45 45
         
@@ -48,7 +48,7 @@ public class DebugTest {
48 48
     
49 49
     @Test
50 50
     public void testInvalidArg() {
51
-        final FrameContainer tiw = mock(FrameContainer.class);
51
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
52 52
 
53 53
         command.execute(tiw, false, new CommandArguments("/foo flubadee"));
54 54
         

+ 2
- 2
test/com/dmdirc/commandparser/commands/global/IfpluginTest.java 查看文件

@@ -40,7 +40,7 @@ public class IfpluginTest {
40 40
 
41 41
     @Test
42 42
     public void testUsageNoArgs() {
43
-        final FrameContainer tiw = mock(FrameContainer.class);
43
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
44 44
         command.execute(tiw, false, new CommandArguments("/foo"));
45 45
         
46 46
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -48,7 +48,7 @@ public class IfpluginTest {
48 48
     
49 49
     @Test
50 50
     public void testUsageOneArg() {
51
-        final FrameContainer tiw = mock(FrameContainer.class);
51
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
52 52
         command.execute(tiw, false, new CommandArguments("/foo bar"));
53 53
         
54 54
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());

+ 4
- 4
test/com/dmdirc/commandparser/commands/global/NewServerTest.java 查看文件

@@ -40,7 +40,7 @@ public class NewServerTest {
40 40
 
41 41
     @Test
42 42
     public void testUsageNoArgs() {
43
-        final FrameContainer tiw = mock(FrameContainer.class);
43
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
44 44
         command.execute(tiw, false, new CommandArguments("/foo"));
45 45
         
46 46
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -48,7 +48,7 @@ public class NewServerTest {
48 48
     
49 49
     @Test
50 50
     public void testInvalidPort() {
51
-        final FrameContainer tiw = mock(FrameContainer.class);
51
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
52 52
         command.execute(tiw, false, new CommandArguments("/foo foo:abc"));
53 53
         
54 54
         verify(tiw).addLine(eq("commandError"), anyString());
@@ -56,7 +56,7 @@ public class NewServerTest {
56 56
     
57 57
     @Test
58 58
     public void testOutOfRangePort1() {
59
-        final FrameContainer tiw = mock(FrameContainer.class);
59
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
60 60
         command.execute(tiw, false, new CommandArguments("/foo foo:0"));
61 61
         
62 62
         verify(tiw).addLine(eq("commandError"), anyString());
@@ -64,7 +64,7 @@ public class NewServerTest {
64 64
     
65 65
     @Test
66 66
     public void testOutOfRangePort2() {
67
-        final FrameContainer tiw = mock(FrameContainer.class);
67
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
68 68
         command.execute(tiw, false, new CommandArguments("/foo foo:65537"));
69 69
         
70 70
         verify(tiw).addLine(eq("commandError"), anyString());

+ 8
- 8
test/com/dmdirc/commandparser/commands/server/ChangeServerTest.java 查看文件

@@ -44,7 +44,7 @@ public class ChangeServerTest {
44 44
 
45 45
     @Test
46 46
     public void testUsageNoArgs() {
47
-        final FrameContainer tiw = mock(FrameContainer.class);
47
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
48 48
         command.execute(tiw, null, false, new CommandArguments("/server"));
49 49
         
50 50
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -52,7 +52,7 @@ public class ChangeServerTest {
52 52
     
53 53
     @Test
54 54
     public void testInvalidPort() {
55
-        final FrameContainer tiw = mock(FrameContainer.class);
55
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
56 56
         command.execute(tiw, null, false, new CommandArguments("/server foo:abc"));
57 57
         
58 58
         verify(tiw).addLine(eq("commandError"), anyString());
@@ -60,7 +60,7 @@ public class ChangeServerTest {
60 60
     
61 61
     @Test
62 62
     public void testOutOfRangePort1() {
63
-        final FrameContainer tiw = mock(FrameContainer.class);
63
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
64 64
         command.execute(tiw, null, false, new CommandArguments("/server foo:0"));
65 65
         
66 66
         verify(tiw).addLine(eq("commandError"), anyString());
@@ -68,7 +68,7 @@ public class ChangeServerTest {
68 68
     
69 69
     @Test
70 70
     public void testOutOfRangePort2() {
71
-        final FrameContainer tiw = mock(FrameContainer.class);
71
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
72 72
         command.execute(tiw, null, false, new CommandArguments("/server foo:65537"));
73 73
         
74 74
         verify(tiw).addLine(eq("commandError"), anyString());
@@ -76,7 +76,7 @@ public class ChangeServerTest {
76 76
 
77 77
     @Test
78 78
     public void testExecuteBasic() throws URISyntaxException {
79
-        final FrameContainer tiw = mock(FrameContainer.class);
79
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
80 80
         final Identity profile = mock(Identity.class);
81 81
         final Server server = mock(Server.class);
82 82
         when(server.getProfile()).thenReturn(profile);
@@ -88,7 +88,7 @@ public class ChangeServerTest {
88 88
 
89 89
     @Test
90 90
     public void testExecuteNoPort() throws URISyntaxException {
91
-        final FrameContainer tiw = mock(FrameContainer.class);
91
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
92 92
         final Identity profile = mock(Identity.class);
93 93
         final Server server = mock(Server.class);
94 94
         when(server.getProfile()).thenReturn(profile);
@@ -100,7 +100,7 @@ public class ChangeServerTest {
100 100
 
101 101
     @Test
102 102
     public void testDeprecatedSSL() throws URISyntaxException {
103
-        final FrameContainer tiw = mock(FrameContainer.class);
103
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
104 104
         final Identity profile = mock(Identity.class);
105 105
         final Server server = mock(Server.class);
106 106
         when(server.getProfile()).thenReturn(profile);
@@ -112,7 +112,7 @@ public class ChangeServerTest {
112 112
 
113 113
     @Test
114 114
     public void testExecuteComplex() throws URISyntaxException {
115
-        final FrameContainer tiw = mock(FrameContainer.class);
115
+        final FrameContainer<?> tiw = mock(FrameContainer.class);
116 116
         final Identity profile = mock(Identity.class);
117 117
         final Server server = mock(Server.class);
118 118
         when(server.getProfile()).thenReturn(profile);

+ 4
- 4
test/com/dmdirc/harness/TestCommandParser.java 查看文件

@@ -49,7 +49,7 @@ public class TestCommandParser extends CommandParser {
49 49
     }
50 50
 
51 51
     @Override
52
-    protected void executeCommand(FrameContainer origin, boolean isSilent,
52
+    protected void executeCommand(FrameContainer<?> origin, boolean isSilent,
53 53
                                   Command command, CommandArguments args) {
54 54
         executedCommand = command;
55 55
         wasSilent = isSilent;
@@ -57,18 +57,18 @@ public class TestCommandParser extends CommandParser {
57 57
     }
58 58
 
59 59
     @Override
60
-    protected void handleNonCommand(FrameContainer origin, String line) {
60
+    protected void handleNonCommand(FrameContainer<?> origin, String line) {
61 61
         nonCommandLine = line;
62 62
     }
63 63
 
64 64
     @Override
65
-    protected void handleInvalidCommand(FrameContainer origin,
65
+    protected void handleInvalidCommand(FrameContainer<?> origin,
66 66
                                         CommandArguments args) {
67 67
         invalidCommand = args.getCommandName();
68 68
     }
69 69
 
70 70
     @Override
71
-    public void setOwner(FrameContainer owner) {
71
+    public void setOwner(FrameContainer<?> owner) {
72 72
         // Don't care
73 73
     }
74 74
 }

+ 11
- 11
test/com/dmdirc/harness/TestWritableFrameContainer.java 查看文件

@@ -28,22 +28,22 @@ import com.dmdirc.commandparser.parsers.GlobalCommandParser;
28 28
 import com.dmdirc.config.ConfigManager;
29 29
 import com.dmdirc.config.IdentityManager;
30 30
 import com.dmdirc.ui.WindowManager;
31
+import com.dmdirc.ui.input.TabCompleter;
31 32
 import com.dmdirc.ui.interfaces.InputWindow;
32 33
 
33
-public class TestWritableFrameContainer extends WritableFrameContainer {
34
+public class TestWritableFrameContainer<T extends InputWindow> extends WritableFrameContainer<T> {
34 35
 
35
-    public InputWindow window = null;
36 36
     private final int lineLength;
37 37
 
38 38
     public TestWritableFrameContainer(final int lineLength,
39
-            final ConfigManager cm) {
40
-        super("raw", "Raw", "(Raw)", cm, GlobalCommandParser.getGlobalCommandParser());
39
+            final ConfigManager cm, final Class<T> clazz) {
40
+        super("raw", "Raw", "(Raw)", clazz, cm, GlobalCommandParser.getGlobalCommandParser());
41 41
 
42 42
         this.lineLength = lineLength;
43 43
     }
44 44
 
45
-    public TestWritableFrameContainer(final int lineLength) {
46
-        this(lineLength, IdentityManager.getGlobalConfig());
45
+    public TestWritableFrameContainer(final int lineLength, final Class<T> clazz) {
46
+        this(lineLength, IdentityManager.getGlobalConfig(), clazz);
47 47
     }
48 48
 
49 49
     @Override
@@ -51,11 +51,6 @@ public class TestWritableFrameContainer extends WritableFrameContainer {
51 51
         // Do nothing
52 52
     }
53 53
 
54
-    @Override
55
-    public InputWindow getFrame() {
56
-        return window;
57
-    }
58
-
59 54
     @Override
60 55
     public int getMaxLineLength() {
61 56
         return lineLength;
@@ -76,4 +71,9 @@ public class TestWritableFrameContainer extends WritableFrameContainer {
76 71
     public Server getServer() {
77 72
         return null;
78 73
     }
74
+
75
+    @Override
76
+    public TabCompleter getTabCompleter() {
77
+        return new TabCompleter();
78
+    }
79 79
 }

+ 20
- 40
test/com/dmdirc/ui/WindowManagerTest.java 查看文件

@@ -31,7 +31,6 @@ import com.dmdirc.ui.interfaces.Window;
31 31
 
32 32
 import org.junit.BeforeClass;
33 33
 import org.junit.Test;
34
-import static org.junit.Assert.*;
35 34
 import static org.mockito.Mockito.*;
36 35
 
37 36
 public class WindowManagerTest {
@@ -44,39 +43,38 @@ public class WindowManagerTest {
44 43
     @Test
45 44
     public void testAddRoot() {
46 45
         final FrameListener tfm = mock(FrameListener.class);
47
-        final Window parent = new DummyInputWindow(new TestWritableFrameContainer(512), null);
46
+        final Window parent = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);
48 47
         
49 48
         WindowManager.addFrameListener(tfm);
50 49
 
51
-        verify(tfm, never()).addWindow((FrameContainer) anyObject(), true);
52
-        verify(tfm, never()).addWindow((FrameContainer) anyObject(), (FrameContainer) anyObject(), true);
50
+        verify(tfm, never()).addWindow((FrameContainer<?>) anyObject(), true);
51
+        verify(tfm, never()).addWindow((FrameContainer<?>) anyObject(), (FrameContainer<?>) anyObject(), true);
53 52
         
54 53
         WindowManager.addWindow(parent);
55 54
         
56 55
         verify(tfm).addWindow(same(parent.getContainer()), true);
57
-        verify(tfm, never()).addWindow((FrameContainer) anyObject(), (FrameContainer) anyObject(), true);
56
+        verify(tfm, never()).addWindow((FrameContainer<?>) anyObject(), (FrameContainer<?>) anyObject(), true);
58 57
     }
59 58
 
60 59
     @Test
61 60
     public void testAddChild() {
62 61
         final FrameListener tfm = mock(FrameListener.class);
63
-        final Window parent = new DummyInputWindow(new TestWritableFrameContainer(512), null);
64
-        final Window child = new DummyInputWindow(new TestWritableFrameContainer(512), null);
62
+        final Window parent = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);
63
+        final Window child = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);
65 64
         WindowManager.addWindow(parent);
66 65
         WindowManager.addFrameListener(tfm);
67 66
         
68 67
         WindowManager.addWindow(parent, child);
69 68
         
70
-        verify(tfm, never()).addWindow((FrameContainer) anyObject(), true);
69
+        verify(tfm, never()).addWindow((FrameContainer<?>) anyObject(), true);
71 70
         verify(tfm).addWindow(same(parent.getContainer()), same(child.getContainer()), true);
72 71
     }
73 72
 
74 73
     @Test
75 74
     public void testRemoveRoot() {
76 75
         final FrameListener tfm = mock(FrameListener.class);
77
-        final Window parent = new DummyInputWindow(new TestWritableFrameContainer(512), null);
78
-        final Window child = new DummyInputWindow(new TestWritableFrameContainer(512), null);
79
-        WindowManager.addWindow(parent);
76
+        final Window parent = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);
77
+        final Window child = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);        WindowManager.addWindow(parent);
80 78
         WindowManager.addFrameListener(tfm);
81 79
 
82 80
         WindowManager.removeWindow(parent);
@@ -87,25 +85,25 @@ public class WindowManagerTest {
87 85
     @Test
88 86
     public void testRemoveChild() {
89 87
         final FrameListener tfm = mock(FrameListener.class);
90
-        final Window parent = new DummyInputWindow(new TestWritableFrameContainer(512), null);
91
-        final Window child = new DummyInputWindow(new TestWritableFrameContainer(512), null);
88
+        final Window parent = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);
89
+        final Window child = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);
92 90
         WindowManager.addWindow(parent);
93 91
         WindowManager.addWindow(parent, child);
94 92
         WindowManager.addFrameListener(tfm);
95 93
 
96 94
         WindowManager.removeWindow(child);
97 95
 
98
-        verify(tfm, never()).addWindow((FrameContainer) anyObject(), true);
99
-        verify(tfm, never()).addWindow((FrameContainer) anyObject(), (FrameContainer) anyObject(), true);
100
-        verify(tfm, never()).delWindow((FrameContainer) anyObject());
96
+        verify(tfm, never()).addWindow((FrameContainer<?>) anyObject(), true);
97
+        verify(tfm, never()).addWindow((FrameContainer<?>) anyObject(), (FrameContainer<?>) anyObject(), true);
98
+        verify(tfm, never()).delWindow((FrameContainer<?>) anyObject());
101 99
         verify(tfm).delWindow(same(parent.getContainer()), same(child.getContainer()));
102 100
     }
103 101
 
104 102
     @Test
105 103
     public void testRemoveFrameManager() {
106 104
         final FrameListener tfm = mock(FrameListener.class);
107
-        final Window parent = new DummyInputWindow(new TestWritableFrameContainer(512), null);
108
-        final Window child = new DummyInputWindow(new TestWritableFrameContainer(512), null);
105
+        final Window parent = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);
106
+        final Window child = new DummyInputWindow(new TestWritableFrameContainer<DummyInputWindow>(512, DummyInputWindow.class), null);
109 107
         WindowManager.addWindow(parent);
110 108
         
111 109
         WindowManager.addFrameListener(tfm);
@@ -113,28 +111,10 @@ public class WindowManagerTest {
113 111
         WindowManager.removeFrameListener(tfm);
114 112
         WindowManager.addWindow(parent, child);
115 113
         
116
-        verify(tfm, never()).addWindow((FrameContainer) anyObject(), true);
117
-        verify(tfm, never()).addWindow((FrameContainer) anyObject(), (FrameContainer) anyObject(), true);
118
-        verify(tfm, never()).delWindow((FrameContainer) anyObject());
119
-        verify(tfm, never()).delWindow((FrameContainer) anyObject(), (FrameContainer) anyObject());
120
-    }
121
-    
122
-    @Test
123
-    public void testGetParent() {
124
-        final Window parent1 = new DummyInputWindow(new TestWritableFrameContainer(512), null);
125
-        final Window parent2 = new DummyInputWindow(new TestWritableFrameContainer(512), null);
126
-        final Window child1 = new DummyInputWindow(new TestWritableFrameContainer(512), null);
127
-        final Window child2 = new DummyInputWindow(new TestWritableFrameContainer(512), null);
128
-        
129
-        WindowManager.addWindow(parent1);
130
-        WindowManager.addWindow(parent2);
131
-        WindowManager.addWindow(parent1, child1);
132
-        WindowManager.addWindow(parent2, child2);
133
-        
134
-        assertSame(parent1.getContainer(), WindowManager.getParent(child1.getContainer()));
135
-        assertSame(parent2.getContainer(), WindowManager.getParent(child2.getContainer()));
136
-        assertNull(WindowManager.getParent(parent1.getContainer()));
137
-        assertNull(WindowManager.getParent(parent2.getContainer()));
114
+        verify(tfm, never()).addWindow((FrameContainer<?>) anyObject(), true);
115
+        verify(tfm, never()).addWindow((FrameContainer<?>) anyObject(), (FrameContainer<?>) anyObject(), true);
116
+        verify(tfm, never()).delWindow((FrameContainer<?>) anyObject());
117
+        verify(tfm, never()).delWindow((FrameContainer<?>) anyObject(), (FrameContainer<?>) anyObject());
138 118
     }
139 119
     
140 120
 }

+ 1
- 1
test/com/dmdirc/ui/messages/IntelligentLinkingTest.java 查看文件

@@ -45,7 +45,7 @@ public class IntelligentLinkingTest {
45 45
         this.input = input;
46 46
         this.expected = expected;
47 47
 
48
-        final FrameContainer container = mock(FrameContainer.class);
48
+        final FrameContainer<?> container = mock(FrameContainer.class);
49 49
         final ConfigManager manager = mock(ConfigManager.class);
50 50
         final Server server = mock(Server.class);
51 51
         when(server.getChannelPrefixes()).thenReturn("#&+");

+ 1
- 1
test/com/dmdirc/ui/messages/StyliserStylesTest.java 查看文件

@@ -65,7 +65,7 @@ public class StyliserStylesTest {
65 65
         final DefaultStyledDocument doc = new DefaultStyledDocument();
66 66
         final StringBuilder builder = new StringBuilder();
67 67
 
68
-        final FrameContainer container = mock(FrameContainer.class);
68
+        final FrameContainer<?> container = mock(FrameContainer.class);
69 69
         final ConfigManager manager = mock(ConfigManager.class);
70 70
         when(container.getConfigManager()).thenReturn(manager);
71 71
 

+ 1
- 1
test/com/dmdirc/ui/messages/StyliserTest.java 查看文件

@@ -86,7 +86,7 @@ public class StyliserTest {
86 86
         final String input1 = ((char) 18) + "abc" + ((char) 2) + "def" + ((char) 31) + "ghi";
87 87
         final String input2 = "abcdefghi";
88 88
 
89
-        final FrameContainer container = mock(FrameContainer.class);
89
+        final FrameContainer<?> container = mock(FrameContainer.class);
90 90
         final ConfigManager manager = mock(ConfigManager.class);
91 91
         when(container.getConfigManager()).thenReturn(manager);
92 92
         

Loading…
取消
儲存