Browse Source

Merge branch 'master' of https://github.com/DMDirc/Plugins into dev4

pull/339/head
Greg Holmes 9 years ago
parent
commit
1d7c677815

+ 1
- 5
circle.yml View File

37
 
37
 
38
 test:
38
 test:
39
   override:
39
   override:
40
-    - ./gradlew --stacktrace --parallel plugins:jar plugins:test:
41
-        pwd:
42
-          ../meta
43
-  post:
44
-    - ./gradlew plugins:coveralls:
40
+    - ./gradlew --stacktrace plugins:jar plugins:test plugins:coveralls:
45
         pwd:
41
         pwd:
46
           ../meta
42
           ../meta
47
 
43
 

+ 2
- 2
contactlist/src/com/dmdirc/addons/contactlist/ContactListCommand.java View File

62
             final CommandArguments args, final CommandContext context) {
62
             final CommandArguments args, final CommandContext context) {
63
         final ChannelCommandContext chanContext = (ChannelCommandContext) context;
63
         final ChannelCommandContext chanContext = (ChannelCommandContext) context;
64
 
64
 
65
-        final ContactListListener listener = new ContactListListener(chanContext.getChannel());
65
+        final ContactListListener listener = new ContactListListener(chanContext.getGroupChat());
66
         listener.addListeners();
66
         listener.addListeners();
67
-        chanContext.getChannel().getUsers().forEach(listener::clientAdded);
67
+        chanContext.getGroupChat().getUsers().forEach(listener::clientAdded);
68
     }
68
     }
69
 
69
 
70
     @Override
70
     @Override

+ 6
- 5
logging/src/com/dmdirc/addons/logging/LogFileLocator.java View File

27
 import com.dmdirc.commandline.CommandLineOptionsModule.Directory;
27
 import com.dmdirc.commandline.CommandLineOptionsModule.Directory;
28
 import com.dmdirc.config.ConfigBinding;
28
 import com.dmdirc.config.ConfigBinding;
29
 import com.dmdirc.events.UserErrorEvent;
29
 import com.dmdirc.events.UserErrorEvent;
30
+import com.dmdirc.interfaces.Connection;
31
+import com.dmdirc.interfaces.GroupChat;
30
 import com.dmdirc.interfaces.User;
32
 import com.dmdirc.interfaces.User;
31
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
33
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
32
 import com.dmdirc.logger.ErrorLevel;
34
 import com.dmdirc.logger.ErrorLevel;
33
-import com.dmdirc.parser.interfaces.ChannelInfo;
34
 import com.dmdirc.plugins.PluginDomain;
35
 import com.dmdirc.plugins.PluginDomain;
35
 
36
 
36
 import java.io.File;
37
 import java.io.File;
39
 import java.security.NoSuchAlgorithmException;
40
 import java.security.NoSuchAlgorithmException;
40
 import java.text.SimpleDateFormat;
41
 import java.text.SimpleDateFormat;
41
 import java.util.Date;
42
 import java.util.Date;
43
+import java.util.Optional;
42
 
44
 
43
 import javax.annotation.Nullable;
45
 import javax.annotation.Nullable;
44
 import javax.inject.Inject;
46
 import javax.inject.Inject;
103
      *
105
      *
104
      * @return the name of the log file to use for this object.
106
      * @return the name of the log file to use for this object.
105
      */
107
      */
106
-    public String getLogFile(final ChannelInfo channel) {
108
+    public String getLogFile(final GroupChat channel) {
107
         final StringBuffer directory = getLogDirectory();
109
         final StringBuffer directory = getLogDirectory();
108
         final StringBuffer file = new StringBuffer();
110
         final StringBuffer file = new StringBuffer();
109
-        if (channel.getParser() != null) {
110
-            addNetworkDir(directory, file, channel.getParser().getNetworkName());
111
-        }
111
+        final Optional<String> network = channel.getConnection().map(Connection::getNetwork);
112
+        network.ifPresent(n -> addNetworkDir(directory, file, n));
112
         file.append(sanitise(channel.getName().toLowerCase()));
113
         file.append(sanitise(channel.getName().toLowerCase()));
113
         return getPath(directory, file, channel.getName());
114
         return getPath(directory, file, channel.getName());
114
     }
115
     }

+ 11
- 11
logging/src/com/dmdirc/addons/logging/LoggingManager.java View File

260
 
260
 
261
     @Handler
261
     @Handler
262
     public void handleChannelMessage(final BaseChannelMessageEvent event) {
262
     public void handleChannelMessage(final BaseChannelMessageEvent event) {
263
-        final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
263
+        final String filename = locator.getLogFile(event.getChannel());
264
         appendLine(filename, "<%s> %s", getDisplayName(event.getClient()), event.getMessage());
264
         appendLine(filename, "<%s> %s", getDisplayName(event.getClient()), event.getMessage());
265
     }
265
     }
266
 
266
 
267
     @Handler
267
     @Handler
268
     public void handleChannelAction(final BaseChannelActionEvent event) {
268
     public void handleChannelAction(final BaseChannelActionEvent event) {
269
-        final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
269
+        final String filename = locator.getLogFile(event.getChannel());
270
         appendLine(filename, "* %s %s", getDisplayName(event.getClient()), event.getMessage());
270
         appendLine(filename, "* %s %s", getDisplayName(event.getClient()), event.getMessage());
271
     }
271
     }
272
 
272
 
273
     @Handler
273
     @Handler
274
     public void handleChannelGotTopic(final ChannelGotTopicEvent event) {
274
     public void handleChannelGotTopic(final ChannelGotTopicEvent event) {
275
-        final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
275
+        final String filename = locator.getLogFile(event.getChannel());
276
         final DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
276
         final DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
277
         final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
277
         final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
278
 
278
 
286
 
286
 
287
     @Handler
287
     @Handler
288
     public void handleChannelTopicChange(final ChannelTopicChangeEvent event) {
288
     public void handleChannelTopicChange(final ChannelTopicChangeEvent event) {
289
-        final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
289
+        final String filename = locator.getLogFile(event.getChannel());
290
         appendLine(filename, "*** %s Changed the topic to: %s",
290
         appendLine(filename, "*** %s Changed the topic to: %s",
291
                 event.getTopic().getClient().map(this::getDisplayName).orElse(""), event.getTopic());
291
                 event.getTopic().getClient().map(this::getDisplayName).orElse(""), event.getTopic());
292
     }
292
     }
293
 
293
 
294
     @Handler
294
     @Handler
295
     public void handleChannelJoin(final ChannelJoinEvent event) {
295
     public void handleChannelJoin(final ChannelJoinEvent event) {
296
-        final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
296
+        final String filename = locator.getLogFile(event.getChannel());
297
         final GroupChatUser channelClient = event.getClient();
297
         final GroupChatUser channelClient = event.getClient();
298
         appendLine(filename, "*** %s (%s) joined the channel", getDisplayName(channelClient),
298
         appendLine(filename, "*** %s (%s) joined the channel", getDisplayName(channelClient),
299
                 channelClient.getNickname());
299
                 channelClient.getNickname());
301
 
301
 
302
     @Handler
302
     @Handler
303
     public void handleChannelPart(final ChannelPartEvent event) {
303
     public void handleChannelPart(final ChannelPartEvent event) {
304
-        final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
304
+        final String filename = locator.getLogFile(event.getChannel());
305
         final String message = event.getMessage();
305
         final String message = event.getMessage();
306
         final GroupChatUser channelClient = event.getClient();
306
         final GroupChatUser channelClient = event.getClient();
307
         if (message.isEmpty()) {
307
         if (message.isEmpty()) {
315
 
315
 
316
     @Handler
316
     @Handler
317
     public void handleChannelQuit(final ChannelQuitEvent event) {
317
     public void handleChannelQuit(final ChannelQuitEvent event) {
318
-        final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
318
+        final String filename = locator.getLogFile(event.getChannel());
319
         final String reason = event.getMessage();
319
         final String reason = event.getMessage();
320
         final GroupChatUser channelClient = event.getClient();
320
         final GroupChatUser channelClient = event.getClient();
321
         if (reason.isEmpty()) {
321
         if (reason.isEmpty()) {
332
         final GroupChatUser victim = event.getVictim();
332
         final GroupChatUser victim = event.getVictim();
333
         final GroupChatUser perpetrator = event.getClient();
333
         final GroupChatUser perpetrator = event.getClient();
334
         final String reason = event.getReason();
334
         final String reason = event.getReason();
335
-        final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
335
+        final String filename = locator.getLogFile(event.getChannel());
336
 
336
 
337
         if (reason.isEmpty()) {
337
         if (reason.isEmpty()) {
338
             appendLine(filename, "*** %s was kicked by %s",
338
             appendLine(filename, "*** %s was kicked by %s",
345
 
345
 
346
     @Handler
346
     @Handler
347
     public void handleNickChange(final ChannelNickChangeEvent event) {
347
     public void handleNickChange(final ChannelNickChangeEvent event) {
348
-        final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
348
+        final String filename = locator.getLogFile(event.getChannel());
349
         appendLine(filename, "*** %s is now %s", getDisplayName(event.getClient(),
349
         appendLine(filename, "*** %s is now %s", getDisplayName(event.getClient(),
350
                 event.getOldNick()), getDisplayName(event.getClient()));
350
                 event.getOldNick()), getDisplayName(event.getClient()));
351
     }
351
     }
352
 
352
 
353
     @Handler
353
     @Handler
354
     public void handleModeChange(final ChannelModeChangeEvent event) {
354
     public void handleModeChange(final ChannelModeChangeEvent event) {
355
-        final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
355
+        final String filename = locator.getLogFile(event.getChannel());
356
         if (event.getClient().getNickname().isEmpty()) {
356
         if (event.getClient().getNickname().isEmpty()) {
357
             appendLine(filename, "*** Channel modes are: %s", event.getModes());
357
             appendLine(filename, "*** Channel modes are: %s", event.getModes());
358
         } else {
358
         } else {
371
         final String filename = locator.getLogFile(event.getChannel().getName());
371
         final String filename = locator.getLogFile(event.getChannel().getName());
372
 
372
 
373
         if (autobackbuffer) {
373
         if (autobackbuffer) {
374
-            showBackBuffer(event.getChannel(), filename);
374
+            showBackBuffer(event.getChannel().getWindowModel(), filename);
375
         }
375
         }
376
 
376
 
377
         synchronized (FORMAT_LOCK) {
377
         synchronized (FORMAT_LOCK) {

+ 4
- 4
ui_swing/src/com/dmdirc/addons/ui_swing/commands/ChannelSettings.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.commands;
23
 package com.dmdirc.addons.ui_swing.commands;
24
 
24
 
25
-import com.dmdirc.Channel;
26
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
27
 import com.dmdirc.addons.ui_swing.dialogs.channelsetting.ChannelSettingsDialog;
26
 import com.dmdirc.addons.ui_swing.dialogs.channelsetting.ChannelSettingsDialog;
28
 import com.dmdirc.addons.ui_swing.injection.KeyedDialogProvider;
27
 import com.dmdirc.addons.ui_swing.injection.KeyedDialogProvider;
36
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
35
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
37
 import com.dmdirc.commandparser.commands.context.CommandContext;
36
 import com.dmdirc.commandparser.commands.context.CommandContext;
38
 import com.dmdirc.interfaces.CommandController;
37
 import com.dmdirc.interfaces.CommandController;
38
+import com.dmdirc.interfaces.GroupChat;
39
 import com.dmdirc.ui.input.AdditionalTabTargets;
39
 import com.dmdirc.ui.input.AdditionalTabTargets;
40
 
40
 
41
 import javax.annotation.Nonnull;
41
 import javax.annotation.Nonnull;
51
     public static final CommandInfo INFO = new BaseCommandInfo("channelsettings",
51
     public static final CommandInfo INFO = new BaseCommandInfo("channelsettings",
52
             "channelsettings - opens the channel settings window", CommandType.TYPE_CHANNEL);
52
             "channelsettings - opens the channel settings window", CommandType.TYPE_CHANNEL);
53
     /** The controller to use to show the settings window. */
53
     /** The controller to use to show the settings window. */
54
-    private final KeyedDialogProvider<Channel, ChannelSettingsDialog> dialogProvider;
54
+    private final KeyedDialogProvider<GroupChat, ChannelSettingsDialog> dialogProvider;
55
 
55
 
56
     /**
56
     /**
57
      * Creates a new instance of the {@link ChannelSettings} command.
57
      * Creates a new instance of the {@link ChannelSettings} command.
62
     @Inject
62
     @Inject
63
     public ChannelSettings(
63
     public ChannelSettings(
64
             final CommandController commandController,
64
             final CommandController commandController,
65
-            final KeyedDialogProvider<Channel, ChannelSettingsDialog> dialogProvider) {
65
+            final KeyedDialogProvider<GroupChat, ChannelSettingsDialog> dialogProvider) {
66
         super(commandController);
66
         super(commandController);
67
         this.dialogProvider = dialogProvider;
67
         this.dialogProvider = dialogProvider;
68
     }
68
     }
70
     @Override
70
     @Override
71
     public void execute(@Nonnull final FrameContainer origin,
71
     public void execute(@Nonnull final FrameContainer origin,
72
             final CommandArguments args, final CommandContext context) {
72
             final CommandArguments args, final CommandContext context) {
73
-        dialogProvider.displayOrRequestFocus(((ChannelCommandContext) context).getChannel());
73
+        dialogProvider.displayOrRequestFocus(((ChannelCommandContext) context).getGroupChat());
74
     }
74
     }
75
 
75
 
76
     @Override
76
     @Override

+ 15
- 17
ui_swing/src/com/dmdirc/addons/ui_swing/components/frames/ChannelFrame.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.components.frames;
23
 package com.dmdirc.addons.ui_swing.components.frames;
24
 
24
 
25
-import com.dmdirc.Channel;
26
 import com.dmdirc.DMDircMBassador;
25
 import com.dmdirc.DMDircMBassador;
27
 import com.dmdirc.ServerState;
26
 import com.dmdirc.ServerState;
28
 import com.dmdirc.addons.ui_swing.EDTInvocation;
27
 import com.dmdirc.addons.ui_swing.EDTInvocation;
58
 import static com.dmdirc.addons.ui_swing.SwingPreconditions.checkOnEDT;
57
 import static com.dmdirc.addons.ui_swing.SwingPreconditions.checkOnEDT;
59
 
58
 
60
 /**
59
 /**
61
- * The channel frame is the GUI component that represents a channel to the user.
60
+ * The groupChat frame is the GUI component that represents a groupChat to the user.
62
  */
61
  */
63
 public final class ChannelFrame extends InputTextFrame {
62
 public final class ChannelFrame extends InputTextFrame {
64
 
63
 
79
     /** Config to read settings from. */
78
     /** Config to read settings from. */
80
     private final AggregateConfigProvider globalConfig;
79
     private final AggregateConfigProvider globalConfig;
81
     /** Channel settings dialog provider. */
80
     /** Channel settings dialog provider. */
82
-    private final KeyedDialogProvider<Channel, ChannelSettingsDialog> dialogProvider;
83
-    /** Channel instance. */
84
-    private final Channel channel;
81
+    private final KeyedDialogProvider<GroupChat, ChannelSettingsDialog> dialogProvider;
82
+    /** Group chat instance. */
83
+    private final GroupChat groupChat;
85
     /** Config binder. */
84
     /** Config binder. */
86
     private final ConfigBinder binder;
85
     private final ConfigBinder binder;
87
 
86
 
91
      *
90
      *
92
      * @param deps               The dependencies required by text frames.
91
      * @param deps               The dependencies required by text frames.
93
      * @param inputFieldProvider The provider to use to create a new input field.
92
      * @param inputFieldProvider The provider to use to create a new input field.
94
-     * @param identityFactory    The factory to use to create a channel identity.
93
+     * @param identityFactory    The factory to use to create a group chat identity.
95
      * @param topicBarFactory    The factory to use to create topic bars.
94
      * @param topicBarFactory    The factory to use to create topic bars.
96
-     * @param owner              The Channel object that owns this frame
95
+     * @param owner              The group chat object that owns this frame
97
      * @param domain             The domain to read settings from
96
      * @param domain             The domain to read settings from
98
-     * @param dialogProvider     The dialog provider to get the channel settings dialog from.
97
+     * @param dialogProvider     The dialog provider to get the group chat settings dialog from.
99
      */
98
      */
100
     public ChannelFrame(
99
     public ChannelFrame(
101
             final String domain,
100
             final String domain,
102
             final TextFrameDependencies deps,
101
             final TextFrameDependencies deps,
103
             final Provider<SwingInputField> inputFieldProvider,
102
             final Provider<SwingInputField> inputFieldProvider,
104
             final IdentityFactory identityFactory,
103
             final IdentityFactory identityFactory,
105
-            final KeyedDialogProvider<Channel, ChannelSettingsDialog> dialogProvider,
104
+            final KeyedDialogProvider<GroupChat, ChannelSettingsDialog> dialogProvider,
106
             final InputTextFramePasteActionFactory inputTextFramePasteActionFactory,
105
             final InputTextFramePasteActionFactory inputTextFramePasteActionFactory,
107
             final TopicBarFactory topicBarFactory,
106
             final TopicBarFactory topicBarFactory,
108
-            final Channel owner) {
109
-        super(deps, inputFieldProvider, inputTextFramePasteActionFactory, owner);
107
+            final GroupChat owner) {
108
+        super(deps, inputFieldProvider, inputTextFramePasteActionFactory, owner.getWindowModel());
110
 
109
 
111
         this.eventBus = deps.eventBus;
110
         this.eventBus = deps.eventBus;
112
         this.globalConfig = deps.globalConfig;
111
         this.globalConfig = deps.globalConfig;
113
         this.dialogProvider = dialogProvider;
112
         this.dialogProvider = dialogProvider;
114
-        this.channel = owner;
113
+        this.groupChat = owner;
115
 
114
 
116
         initComponents(topicBarFactory, deps.colourManagerFactory);
115
         initComponents(topicBarFactory, deps.colourManagerFactory);
117
         binder = getContainer().getConfigManager().getBinder().withDefaultDomain(domain);
116
         binder = getContainer().getConfigManager().getBinder().withDefaultDomain(domain);
118
 
117
 
119
         identity = identityFactory.createChannelConfig(owner.getConnection().get().getNetwork(),
118
         identity = identityFactory.createChannelConfig(owner.getConnection().get().getNetwork(),
120
-                owner.getChannelInfo().getName());
119
+                owner.getName());
121
     }
120
     }
122
 
121
 
123
     /**
122
     /**
142
 
141
 
143
         nicklist = new NickList(this, getContainer().getConfigManager(), colourManagerFactory);
142
         nicklist = new NickList(this, getContainer().getConfigManager(), colourManagerFactory);
144
         settingsMI = new JMenuItem("Settings");
143
         settingsMI = new JMenuItem("Settings");
145
-        settingsMI.addActionListener(l ->
146
-                dialogProvider.displayOrRequestFocus((Channel) getContainer()));
144
+        settingsMI.addActionListener(l -> dialogProvider.displayOrRequestFocus(groupChat));
147
 
145
 
148
         splitPane = new SplitPane(globalConfig, SplitPane.Orientation.HORIZONTAL);
146
         splitPane = new SplitPane(globalConfig, SplitPane.Orientation.HORIZONTAL);
149
 
147
 
212
 
210
 
213
     @Override
211
     @Override
214
     public void addCustomPopupItems(final JPopupMenu popupMenu) {
212
     public void addCustomPopupItems(final JPopupMenu popupMenu) {
215
-        if (channel.getConnection().get().getState() == ServerState.CONNECTED) {
213
+        if (groupChat.getConnection().get().getState() == ServerState.CONNECTED) {
216
             settingsMI.setEnabled(true);
214
             settingsMI.setEnabled(true);
217
         } else {
215
         } else {
218
             settingsMI.setEnabled(false);
216
             settingsMI.setEnabled(false);
228
     public void windowClosing(final FrameClosingEvent event) {
226
     public void windowClosing(final FrameClosingEvent event) {
229
         saveSplitPanePosition();
227
         saveSplitPanePosition();
230
         topicBar.close();
228
         topicBar.close();
231
-        dialogProvider.dispose(channel);
229
+        dialogProvider.dispose(groupChat);
232
         super.windowClosing(event);
230
         super.windowClosing(event);
233
     }
231
     }
234
 
232
 

+ 5
- 4
ui_swing/src/com/dmdirc/addons/ui_swing/components/frames/ChannelFrameFactory.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.components.frames;
23
 package com.dmdirc.addons.ui_swing.components.frames;
24
 
24
 
25
-import com.dmdirc.Channel;
26
 import com.dmdirc.DMDircMBassador;
25
 import com.dmdirc.DMDircMBassador;
27
 import com.dmdirc.FrameContainer;
26
 import com.dmdirc.FrameContainer;
28
 import com.dmdirc.addons.ui_swing.SwingController;
27
 import com.dmdirc.addons.ui_swing.SwingController;
31
 import com.dmdirc.addons.ui_swing.components.inputfields.SwingInputField;
30
 import com.dmdirc.addons.ui_swing.components.inputfields.SwingInputField;
32
 import com.dmdirc.addons.ui_swing.dialogs.channelsetting.ChannelSettingsDialog;
31
 import com.dmdirc.addons.ui_swing.dialogs.channelsetting.ChannelSettingsDialog;
33
 import com.dmdirc.addons.ui_swing.injection.KeyedDialogProvider;
32
 import com.dmdirc.addons.ui_swing.injection.KeyedDialogProvider;
33
+import com.dmdirc.interfaces.GroupChat;
34
 import com.dmdirc.interfaces.config.IdentityFactory;
34
 import com.dmdirc.interfaces.config.IdentityFactory;
35
 import com.dmdirc.plugins.PluginDomain;
35
 import com.dmdirc.plugins.PluginDomain;
36
 import com.dmdirc.ui.core.components.WindowComponent;
36
 import com.dmdirc.ui.core.components.WindowComponent;
56
     private final Provider<SwingInputField> inputFieldProvider;
56
     private final Provider<SwingInputField> inputFieldProvider;
57
     private final IdentityFactory identityFactory;
57
     private final IdentityFactory identityFactory;
58
     private final InputTextFramePasteActionFactory inputTextFramePasteActionFactory;
58
     private final InputTextFramePasteActionFactory inputTextFramePasteActionFactory;
59
-    private final Provider<KeyedDialogProvider<Channel, ChannelSettingsDialog>> dialogProvider;
59
+    private final Provider<KeyedDialogProvider<GroupChat, ChannelSettingsDialog>> dialogProvider;
60
     private final TopicBarFactory topicBarFactory;
60
     private final TopicBarFactory topicBarFactory;
61
     private final DMDircMBassador eventBus;
61
     private final DMDircMBassador eventBus;
62
 
62
 
68
             final Provider<SwingInputField> inputFieldProvider,
68
             final Provider<SwingInputField> inputFieldProvider,
69
             final InputTextFramePasteActionFactory inputTextFramePasteActionFactory,
69
             final InputTextFramePasteActionFactory inputTextFramePasteActionFactory,
70
             final IdentityFactory identityFactory,
70
             final IdentityFactory identityFactory,
71
-            final Provider<KeyedDialogProvider<Channel, ChannelSettingsDialog>> dialogProvider,
71
+            final Provider<KeyedDialogProvider<GroupChat, ChannelSettingsDialog>> dialogProvider,
72
             final TopicBarFactory topicBarFactory) {
72
             final TopicBarFactory topicBarFactory) {
73
         this.eventBus = eventBus;
73
         this.eventBus = eventBus;
74
         this.domain = domain;
74
         this.domain = domain;
84
     public TextFrame getWindow(final FrameContainer container) {
84
     public TextFrame getWindow(final FrameContainer container) {
85
         final ChannelFrame frame = new ChannelFrame(domain, dependencies.get(), inputFieldProvider,
85
         final ChannelFrame frame = new ChannelFrame(domain, dependencies.get(), inputFieldProvider,
86
                 identityFactory, dialogProvider.get(), inputTextFramePasteActionFactory,
86
                 identityFactory, dialogProvider.get(), inputTextFramePasteActionFactory,
87
-                topicBarFactory, (Channel) container);
87
+                topicBarFactory, (GroupChat) container);
88
+                // TODO: Can't assume containers are GroupChats...
88
         eventBus.subscribe(frame);
89
         eventBus.subscribe(frame);
89
         return frame;
90
         return frame;
90
     }
91
     }

+ 3
- 7
ui_swing/src/com/dmdirc/addons/ui_swing/components/frames/DesktopWindowFrame.java View File

23
 package com.dmdirc.addons.ui_swing.components.frames;
23
 package com.dmdirc.addons.ui_swing.components.frames;
24
 
24
 
25
 import com.dmdirc.addons.ui_swing.EdtHandlerInvocation;
25
 import com.dmdirc.addons.ui_swing.EdtHandlerInvocation;
26
+import com.dmdirc.addons.ui_swing.components.IconManager;
26
 import com.dmdirc.events.FrameIconChangedEvent;
27
 import com.dmdirc.events.FrameIconChangedEvent;
27
 import com.dmdirc.events.FrameTitleChangedEvent;
28
 import com.dmdirc.events.FrameTitleChangedEvent;
28
-import com.dmdirc.addons.ui_swing.components.IconManager;
29
-
30
-import java.awt.Point;
29
+import com.dmdirc.ui.CoreUIUtils;
31
 
30
 
32
 import javax.swing.JFrame;
31
 import javax.swing.JFrame;
33
 
32
 
46
     /** TextFrame associated with this popout window. */
45
     /** TextFrame associated with this popout window. */
47
     private final TextFrame windowWindow;
46
     private final TextFrame windowWindow;
48
     private final IconManager iconManager;
47
     private final IconManager iconManager;
49
-    /** Initial location for popped out window. */
50
-    private final Point initialLocation;
51
 
48
 
52
     /**
49
     /**
53
      * Creates a new instance of DesktopWindowFrame.
50
      * Creates a new instance of DesktopWindowFrame.
57
     public DesktopWindowFrame(final TextFrame windowWindow, final IconManager iconManager) {
54
     public DesktopWindowFrame(final TextFrame windowWindow, final IconManager iconManager) {
58
         this.windowWindow = windowWindow;
55
         this.windowWindow = windowWindow;
59
         this.iconManager = iconManager;
56
         this.iconManager = iconManager;
60
-        initialLocation = windowWindow.getLocationOnScreen();
61
 
57
 
62
         setLayout(new MigLayout("fill, ins rel"));
58
         setLayout(new MigLayout("fill, ins rel"));
63
         add(windowWindow, "grow");
59
         add(windowWindow, "grow");
71
      */
67
      */
72
     public void display() {
68
     public void display() {
73
         pack();
69
         pack();
70
+        CoreUIUtils.centreWindow(this);
74
         setVisible(true);
71
         setVisible(true);
75
-        setLocation(initialLocation);
76
     }
72
     }
77
 
73
 
78
     @Handler(invocation = EdtHandlerInvocation.class, delivery = Invoke.Asynchronously)
74
     @Handler(invocation = EdtHandlerInvocation.class, delivery = Invoke.Asynchronously)

+ 2
- 2
ui_swing/src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java View File

182
             popoutFrame.dispose();
182
             popoutFrame.dispose();
183
             eventBus.unsubscribe(popoutFrame);
183
             eventBus.unsubscribe(popoutFrame);
184
             popoutFrame = null;
184
             popoutFrame = null;
185
-            // TODO: This is a horrible hack really.
186
-            swingEventBus.publishAsync(new SwingActiveWindowChangeRequestEvent(Optional.of(this)));
187
         }
185
         }
186
+        // TODO: This is a horrible hack really.
187
+        swingEventBus.publishAsync(new SwingActiveWindowChangeRequestEvent(Optional.of(this)));
188
     }
188
     }
189
 
189
 
190
     /**
190
     /**

+ 6
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/components/menubar/ChannelMenu.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.components.menubar;
23
 package com.dmdirc.addons.ui_swing.components.menubar;
24
 
24
 
25
-import com.dmdirc.Channel;
26
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
27
 import com.dmdirc.ServerState;
26
 import com.dmdirc.ServerState;
28
 import com.dmdirc.addons.ui_swing.MainFrame;
27
 import com.dmdirc.addons.ui_swing.MainFrame;
34
 import com.dmdirc.addons.ui_swing.injection.KeyedDialogProvider;
33
 import com.dmdirc.addons.ui_swing.injection.KeyedDialogProvider;
35
 import com.dmdirc.addons.ui_swing.interfaces.ActiveFrameManager;
34
 import com.dmdirc.addons.ui_swing.interfaces.ActiveFrameManager;
36
 import com.dmdirc.interfaces.Connection;
35
 import com.dmdirc.interfaces.Connection;
36
+import com.dmdirc.interfaces.GroupChat;
37
 import com.dmdirc.parser.common.ChannelJoinRequest;
37
 import com.dmdirc.parser.common.ChannelJoinRequest;
38
 import com.dmdirc.addons.ui_swing.components.IconManager;
38
 import com.dmdirc.addons.ui_swing.components.IconManager;
39
 
39
 
60
     /** Main frame. */
60
     /** Main frame. */
61
     private final MainFrame mainFrame;
61
     private final MainFrame mainFrame;
62
     /** Dialog provider. */
62
     /** Dialog provider. */
63
-    private final KeyedDialogProvider<Channel, ChannelSettingsDialog> dialogProvider;
63
+    private final KeyedDialogProvider<GroupChat, ChannelSettingsDialog> dialogProvider;
64
     /** Channel list dialog provider. */
64
     /** Channel list dialog provider. */
65
     private final DialogProvider<ChannelListDialog> channelListDialogProvider;
65
     private final DialogProvider<ChannelListDialog> channelListDialogProvider;
66
     /** Active frame manager. */
66
     /** Active frame manager. */
73
     @Inject
73
     @Inject
74
     public ChannelMenu(
74
     public ChannelMenu(
75
             final ActiveFrameManager activeFrameManager,
75
             final ActiveFrameManager activeFrameManager,
76
-            final KeyedDialogProvider<Channel, ChannelSettingsDialog> dialogProvider,
76
+            final KeyedDialogProvider<GroupChat, ChannelSettingsDialog> dialogProvider,
77
             final MainFrame mainFrame,
77
             final MainFrame mainFrame,
78
             final IconManager iconManager,
78
             final IconManager iconManager,
79
             final DialogProvider<ChannelListDialog> channelListDialogProvider) {
79
             final DialogProvider<ChannelListDialog> channelListDialogProvider) {
121
 
121
 
122
     private void showChannelSettings() {
122
     private void showChannelSettings() {
123
         activeFrameManager.getActiveFrame().ifPresent(f -> {
123
         activeFrameManager.getActiveFrame().ifPresent(f -> {
124
-            if (f.getContainer() instanceof Channel) {
125
-                dialogProvider.displayOrRequestFocus((Channel) f.getContainer());
124
+            // TODO: Can't assume containers will be group chats.
125
+            if (f.getContainer() instanceof GroupChat) {
126
+                dialogProvider.displayOrRequestFocus((GroupChat) f.getContainer());
126
             }
127
             }
127
         });
128
         });
128
     }
129
     }

+ 25
- 19
ui_swing/src/com/dmdirc/addons/ui_swing/components/modes/ChannelModesPane.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.components.modes;
23
 package com.dmdirc.addons.ui_swing.components.modes;
24
 
24
 
25
-import com.dmdirc.Channel;
26
-import com.dmdirc.parser.interfaces.Parser;
27
 import com.dmdirc.addons.ui_swing.components.IconManager;
25
 import com.dmdirc.addons.ui_swing.components.IconManager;
26
+import com.dmdirc.interfaces.GroupChat;
27
+import com.dmdirc.parser.interfaces.Parser;
28
 
28
 
29
 /** Non list mode panel. */
29
 /** Non list mode panel. */
30
 public final class ChannelModesPane extends ModesPane {
30
 public final class ChannelModesPane extends ModesPane {
31
 
31
 
32
     /** Serial version UID. */
32
     /** Serial version UID. */
33
     private static final long serialVersionUID = 1;
33
     private static final long serialVersionUID = 1;
34
-    /** Parent channel. */
35
-    private final Channel channel;
34
+    /** Parent group chat. */
35
+    private final GroupChat groupChat;
36
 
36
 
37
     /**
37
     /**
38
      * Creates a new instance of ChannelModesPane.
38
      * Creates a new instance of ChannelModesPane.
39
      *
39
      *
40
-     * @param channel Parent channel
40
+     * @param groupChat Parent group chat
41
      * @param iconManager The icon manager to use
41
      * @param iconManager The icon manager to use
42
      */
42
      */
43
-    public ChannelModesPane(final Channel channel, final IconManager iconManager) {
44
-        super(channel.getConfigManager(), iconManager);
43
+    public ChannelModesPane(final GroupChat groupChat, final IconManager iconManager) {
44
+        super(groupChat.getWindowModel().getConfigManager(), iconManager);
45
 
45
 
46
-        this.channel = channel;
46
+        this.groupChat = groupChat;
47
         initModesPanel();
47
         initModesPanel();
48
     }
48
     }
49
 
49
 
50
     @Override
50
     @Override
51
     public boolean hasModeValue(final String mode) {
51
     public boolean hasModeValue(final String mode) {
52
-        return channel.getWindowModel().getConfigManager().hasOptionString("server", "mode" + mode);
52
+        return groupChat.getWindowModel().getConfigManager().hasOptionString("server",
53
+                "mode" + mode);
53
     }
54
     }
54
 
55
 
55
     @Override
56
     @Override
56
     public String getModeValue(final String mode) {
57
     public String getModeValue(final String mode) {
57
-        return channel.getWindowModel().getConfigManager().getOption("server", "mode" + mode);
58
+        return groupChat.getWindowModel().getConfigManager().getOption("server", "mode" + mode);
58
     }
59
     }
59
 
60
 
60
     @Override
61
     @Override
61
     public boolean isModeEnabled(final String mode) {
62
     public boolean isModeEnabled(final String mode) {
62
-        return !channel.getWindowModel().getConfigManager().hasOptionString("server",
63
-                "enablemode" + mode) || channel.getWindowModel().getConfigManager()
63
+        return !groupChat.getWindowModel().getConfigManager().hasOptionString("server",
64
+                "enablemode" + mode) || groupChat.getWindowModel().getConfigManager()
64
                 .getOptionBool("server", "enablemode" + mode);
65
                 .getOptionBool("server", "enablemode" + mode);
65
     }
66
     }
66
 
67
 
67
     @Override
68
     @Override
68
     public boolean isModeSettable(final String mode) {
69
     public boolean isModeSettable(final String mode) {
69
-        return channel.getConnection().get().getParser().get().isUserSettable(mode.toCharArray()
70
+        return groupChat.getConnection().get().getParser().get().isUserSettable(mode.toCharArray()
70
                 [0]);
71
                 [0]);
71
     }
72
     }
72
 
73
 
73
     @Override
74
     @Override
74
     public String getAvailableBooleanModes() {
75
     public String getAvailableBooleanModes() {
75
-        return channel.getConnection().get().getParser().get().getBooleanChannelModes();
76
+        return groupChat.getConnection().get().getParser().get().getBooleanChannelModes();
76
     }
77
     }
77
 
78
 
78
     @Override
79
     @Override
79
     public String getOurBooleanModes() {
80
     public String getOurBooleanModes() {
80
-        return channel.getChannelInfo().getModes();
81
+        return groupChat.getModes();
81
     }
82
     }
82
 
83
 
83
     @Override
84
     @Override
84
     public String getAllParamModes() {
85
     public String getAllParamModes() {
85
-        final Parser parser = channel.getConnection().get().getParser().get();
86
+        final Parser parser = groupChat.getConnection().get().getParser().get();
86
         return parser.getParameterChannelModes()
87
         return parser.getParameterChannelModes()
87
                 + parser.getDoubleParameterChannelModes();
88
                 + parser.getDoubleParameterChannelModes();
88
     }
89
     }
89
 
90
 
90
     @Override
91
     @Override
91
     public String getParamModeValue(final String mode) {
92
     public String getParamModeValue(final String mode) {
92
-        return channel.getChannelInfo().getMode(mode.charAt(0));
93
+        return groupChat.getModeValue(mode.charAt(0));
93
     }
94
     }
94
 
95
 
95
     @Override
96
     @Override
101
         } else {
102
         } else {
102
             state = getParamModes().get(mode).getState();
103
             state = getParamModes().get(mode).getState();
103
         }
104
         }
104
-        channel.getChannelInfo().alterMode(state, mode.charAt(0), parameter);
105
+
106
+        if (state) {
107
+            groupChat.setMode(mode.charAt(0), parameter);
108
+        } else {
109
+            groupChat.removeMode(mode.charAt(0), parameter);
110
+        }
105
     }
111
     }
106
 
112
 
107
     @Override
113
     @Override
108
     public void flushModes() {
114
     public void flushModes() {
109
-        channel.getChannelInfo().flushModes();
115
+        groupChat.flushModes();
110
     }
116
     }
111
 
117
 
112
 }
118
 }

+ 26
- 23
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/ChannelListModesPane.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.dialogs.channelsetting;
23
 package com.dmdirc.addons.ui_swing.dialogs.channelsetting;
24
 
24
 
25
-import com.dmdirc.Channel;
26
 import com.dmdirc.addons.ui_swing.UIUtilities;
25
 import com.dmdirc.addons.ui_swing.UIUtilities;
26
+import com.dmdirc.addons.ui_swing.components.IconManager;
27
 import com.dmdirc.addons.ui_swing.components.renderers.ListModeCellRenderer;
27
 import com.dmdirc.addons.ui_swing.components.renderers.ListModeCellRenderer;
28
 import com.dmdirc.addons.ui_swing.dialogs.StandardInputDialog;
28
 import com.dmdirc.addons.ui_swing.dialogs.StandardInputDialog;
29
+import com.dmdirc.interfaces.GroupChat;
29
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
30
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
30
 import com.dmdirc.interfaces.config.ConfigChangeListener;
31
 import com.dmdirc.interfaces.config.ConfigChangeListener;
31
 import com.dmdirc.interfaces.config.ConfigProvider;
32
 import com.dmdirc.interfaces.config.ConfigProvider;
32
 import com.dmdirc.parser.common.ChannelListModeItem;
33
 import com.dmdirc.parser.common.ChannelListModeItem;
33
-import com.dmdirc.addons.ui_swing.components.IconManager;
34
 import com.dmdirc.util.collections.MapList;
34
 import com.dmdirc.util.collections.MapList;
35
 import com.dmdirc.util.validators.NotEmptyValidator;
35
 import com.dmdirc.util.validators.NotEmptyValidator;
36
 
36
 
70
 
70
 
71
     /** A version number for this class. */
71
     /** A version number for this class. */
72
     private static final long serialVersionUID = 5;
72
     private static final long serialVersionUID = 5;
73
-    /** Channel. */
74
-    private final Channel channel;
73
+    /** Group chat. */
74
+    private final GroupChat groupChat;
75
     /** Combox box used to switch between list modes. */
75
     /** Combox box used to switch between list modes. */
76
     private final JComboBox<String> listModesMenu;
76
     private final JComboBox<String> listModesMenu;
77
     /** Arraylist of jpanels containing the listmodes. */
77
     /** Arraylist of jpanels containing the listmodes. */
111
      * @param globalConfig The config to read settings from.
111
      * @param globalConfig The config to read settings from.
112
      * @param userConfig   The config to write settings to.
112
      * @param userConfig   The config to write settings to.
113
      * @param iconManager  The manager to use to retrieve icons for dialogs and validation.
113
      * @param iconManager  The manager to use to retrieve icons for dialogs and validation.
114
-     * @param channel      Parent channel
114
+     * @param groupChat    Parent group chat
115
      * @param parentWindow Parent window
115
      * @param parentWindow Parent window
116
      */
116
      */
117
     public ChannelListModesPane(
117
     public ChannelListModesPane(
118
             final AggregateConfigProvider globalConfig,
118
             final AggregateConfigProvider globalConfig,
119
             final ConfigProvider userConfig,
119
             final ConfigProvider userConfig,
120
             final IconManager iconManager,
120
             final IconManager iconManager,
121
-            final Channel channel,
121
+            final GroupChat groupChat,
122
             final Window parentWindow) {
122
             final Window parentWindow) {
123
 
123
 
124
         this.globalConfig = checkNotNull(globalConfig);
124
         this.globalConfig = checkNotNull(globalConfig);
125
         this.userConfig = checkNotNull(userConfig);
125
         this.userConfig = checkNotNull(userConfig);
126
         this.iconManager = checkNotNull(iconManager);
126
         this.iconManager = checkNotNull(iconManager);
127
-        this.channel = checkNotNull(channel);
127
+        this.groupChat = checkNotNull(groupChat);
128
         this.parentWindow = checkNotNull(parentWindow);
128
         this.parentWindow = checkNotNull(parentWindow);
129
         setOpaque(UIUtilities.getTabbedPaneOpaque());
129
         setOpaque(UIUtilities.getTabbedPaneOpaque());
130
 
130
 
131
         list = new JList<>();
131
         list = new JList<>();
132
         nativeRenderer = list.getCellRenderer();
132
         nativeRenderer = list.getCellRenderer();
133
-        if (channel.getConfigManager().getOptionBool("general", "extendedListModes")) {
133
+        if (groupChat.getWindowModel().getConfigManager()
134
+                .getOptionBool("general", "extendedListModes")) {
134
             renderer = new ExtendedListModeCellRenderer();
135
             renderer = new ExtendedListModeCellRenderer();
135
         } else {
136
         } else {
136
             renderer = new ListModeCellRenderer(nativeRenderer);
137
             renderer = new ListModeCellRenderer(nativeRenderer);
137
         }
138
         }
138
         listModesPanel = new JScrollPane();
139
         listModesPanel = new JScrollPane();
139
         listModesPanels = new ArrayList<>();
140
         listModesPanels = new ArrayList<>();
140
-        listModesArray = channel.getConnection().get().getParser().get()
141
+        listModesArray = groupChat.getConnection().get().getParser().get()
141
                 .getListChannelModes().toCharArray();
142
                 .getListChannelModes().toCharArray();
142
         existingListItems = new MapList<>();
143
         existingListItems = new MapList<>();
143
         listModesMenu = new JComboBox<>(new DefaultComboBoxModel<>());
144
         listModesMenu = new JComboBox<>(new DefaultComboBoxModel<>());
145
         removeListModeButton = new JButton("Remove");
146
         removeListModeButton = new JButton("Remove");
146
         removeListModeButton.setEnabled(false);
147
         removeListModeButton.setEnabled(false);
147
         modeCount = new JLabel();
148
         modeCount = new JLabel();
148
-        toggle = new JCheckBox("Show extended information",
149
-                channel.getConfigManager().getOptionBool("general", "extendedListModes"));
149
+        toggle = new JCheckBox("Show extended information", groupChat.getWindowModel()
150
+                .getConfigManager().getOptionBool("general", "extendedListModes"));
150
         toggle.setOpaque(UIUtilities.getTabbedPaneOpaque());
151
         toggle.setOpaque(UIUtilities.getTabbedPaneOpaque());
151
 
152
 
152
         initListModesPanel();
153
         initListModesPanel();
157
     public void update() {
158
     public void update() {
158
         existingListItems.clear();
159
         existingListItems.clear();
159
 
160
 
160
-        if (channel.getChannelInfo() == null) {
161
+        if (!groupChat.isOnChannel()) {
161
             return;
162
             return;
162
         }
163
         }
164
+
163
         for (int i = 0; i < listModesArray.length; i++) {
165
         for (int i = 0; i < listModesArray.length; i++) {
164
             final char mode = listModesArray[i];
166
             final char mode = listModesArray[i];
165
-            final Collection<ChannelListModeItem> listItems = channel
166
-                    .getChannelInfo().getListMode(mode);
167
+            final Collection<ChannelListModeItem> listItems = groupChat.getListModeItems(mode);
167
             if (listItems == null) {
168
             if (listItems == null) {
168
                 continue;
169
                 continue;
169
             }
170
             }
191
                 getModel();
192
                 getModel();
192
         for (char mode : listModesArray) {
193
         for (char mode : listModesArray) {
193
             String modeText = mode + " list";
194
             String modeText = mode + " list";
194
-            if (channel.getConfigManager().hasOptionString("server", "mode" + mode)) {
195
-                modeText = channel.getConfigManager().getOption("server",
195
+            if (groupChat.getWindowModel().getConfigManager()
196
+                    .hasOptionString("server", "mode" + mode)) {
197
+                modeText = groupChat.getWindowModel().getConfigManager().getOption("server",
196
                         "mode" + mode) + " list [+" + mode + ']';
198
                         "mode" + mode) + " list [+" + mode + ']';
197
             }
199
             }
198
             model.addElement(modeText);
200
             model.addElement(modeText);
236
         removeListModeButton.addActionListener(this);
238
         removeListModeButton.addActionListener(this);
237
         listModesMenu.addActionListener(this);
239
         listModesMenu.addActionListener(this);
238
         toggle.addActionListener(this);
240
         toggle.addActionListener(this);
239
-        channel.getConfigManager().addChangeListener("general", "extendedListModes", this);
241
+        groupChat.getWindowModel().getConfigManager()
242
+                .addChangeListener("general", "extendedListModes", this);
240
 
243
 
241
     }
244
     }
242
 
245
 
266
             if (currentModes.containsKey(entry.getKey())) {
269
             if (currentModes.containsKey(entry.getKey())) {
267
                 currentModes.remove(entry.getKey());
270
                 currentModes.remove(entry.getKey());
268
             } else {
271
             } else {
269
-                channel.getChannelInfo().alterMode(true, entry.getValue(), entry.getKey().getItem());
272
+                groupChat.setMode(entry.getValue(), entry.getKey().getItem());
270
             }
273
             }
271
         }
274
         }
272
 
275
 
273
         for (Entry<ChannelListModeItem, Character> entry : currentModes.entrySet()) {
276
         for (Entry<ChannelListModeItem, Character> entry : currentModes.entrySet()) {
274
-            channel.getChannelInfo().alterMode(false, entry.getValue(), entry.getKey().getItem());
277
+            groupChat.removeMode(entry.getValue(), entry.getKey().getItem());
275
         }
278
         }
276
 
279
 
277
-        channel.getChannelInfo().flushModes();
280
+        groupChat.flushModes();
278
         userConfig.setOption("general", "extendedListModes", toggle.isSelected());
281
         userConfig.setOption("general", "extendedListModes", toggle.isSelected());
279
     }
282
     }
280
 
283
 
282
     private void addListMode() {
285
     private void addListMode() {
283
         final int selectedIndex = listModesMenu.getSelectedIndex();
286
         final int selectedIndex = listModesMenu.getSelectedIndex();
284
         String modeText = String.valueOf(listModesArray[selectedIndex]);
287
         String modeText = String.valueOf(listModesArray[selectedIndex]);
285
-        if (channel.getConfigManager().hasOptionString("server", "mode"
288
+        if (groupChat.getWindowModel().getConfigManager().hasOptionString("server", "mode"
286
                 + listModesArray[selectedIndex])) {
289
                 + listModesArray[selectedIndex])) {
287
-            modeText = channel.getConfigManager().
290
+            modeText = groupChat.getWindowModel().getConfigManager().
288
                     getOption("server", "mode" + listModesArray[selectedIndex]);
291
                     getOption("server", "mode" + listModesArray[selectedIndex]);
289
         }
292
         }
290
         new StandardInputDialog(parentWindow, ModalityType.DOCUMENT_MODAL,
293
         new StandardInputDialog(parentWindow, ModalityType.DOCUMENT_MODAL,
354
 
357
 
355
         final int selected = listModesMenu.getSelectedIndex();
358
         final int selected = listModesMenu.getSelectedIndex();
356
         final int current = listModesPanels.get(selected).getModel().getSize();
359
         final int current = listModesPanels.get(selected).getModel().getSize();
357
-        final int maxModes = channel.getConnection().get().getParser().get().
360
+        final int maxModes = groupChat.getConnection().get().getParser().get().
358
                 getMaxListModes(listModesArray[selected]);
361
                 getMaxListModes(listModesArray[selected]);
359
 
362
 
360
         if (maxModes == -1) {
363
         if (maxModes == -1) {

+ 9
- 10
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/ChannelSettingsDialog.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.dialogs.channelsetting;
23
 package com.dmdirc.addons.ui_swing.dialogs.channelsetting;
24
 
24
 
25
-import com.dmdirc.Channel;
26
 import com.dmdirc.DMDircMBassador;
25
 import com.dmdirc.DMDircMBassador;
27
 import com.dmdirc.addons.ui_swing.PrefsComponentFactory;
26
 import com.dmdirc.addons.ui_swing.PrefsComponentFactory;
28
 import com.dmdirc.addons.ui_swing.SwingWindowFactory;
27
 import com.dmdirc.addons.ui_swing.SwingWindowFactory;
29
 import com.dmdirc.addons.ui_swing.UIUtilities;
28
 import com.dmdirc.addons.ui_swing.UIUtilities;
29
+import com.dmdirc.addons.ui_swing.components.IconManager;
30
 import com.dmdirc.addons.ui_swing.components.expandingsettings.SettingsPanel;
30
 import com.dmdirc.addons.ui_swing.components.expandingsettings.SettingsPanel;
31
 import com.dmdirc.addons.ui_swing.components.modes.ChannelModesPane;
31
 import com.dmdirc.addons.ui_swing.components.modes.ChannelModesPane;
32
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
32
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
33
 import com.dmdirc.config.prefs.PreferencesManager;
33
 import com.dmdirc.config.prefs.PreferencesManager;
34
 import com.dmdirc.interfaces.CommandController;
34
 import com.dmdirc.interfaces.CommandController;
35
+import com.dmdirc.interfaces.GroupChat;
35
 import com.dmdirc.interfaces.config.ConfigProvider;
36
 import com.dmdirc.interfaces.config.ConfigProvider;
36
 import com.dmdirc.interfaces.config.IdentityFactory;
37
 import com.dmdirc.interfaces.config.IdentityFactory;
37
 import com.dmdirc.interfaces.ui.InputWindow;
38
 import com.dmdirc.interfaces.ui.InputWindow;
38
 import com.dmdirc.plugins.ServiceManager;
39
 import com.dmdirc.plugins.ServiceManager;
39
-import com.dmdirc.addons.ui_swing.components.IconManager;
40
 import com.dmdirc.ui.input.TabCompleterUtils;
40
 import com.dmdirc.ui.input.TabCompleterUtils;
41
 import com.dmdirc.ui.messages.ColourManagerFactory;
41
 import com.dmdirc.ui.messages.ColourManagerFactory;
42
 
42
 
62
     /** Serial version UID. */
62
     /** Serial version UID. */
63
     private static final long serialVersionUID = 8;
63
     private static final long serialVersionUID = 8;
64
     /** The channel object that this dialog belongs to. */
64
     /** The channel object that this dialog belongs to. */
65
-    private final Channel channel;
65
+    private final GroupChat channel;
66
     /** Channel identity file. */
66
     /** Channel identity file. */
67
     private final ConfigProvider identity;
67
     private final ConfigProvider identity;
68
     /** Channel window. */
68
     /** Channel window. */
104
      * @param serviceManager     Service manager
104
      * @param serviceManager     Service manager
105
      * @param preferencesManager Preferences Manager
105
      * @param preferencesManager Preferences Manager
106
      * @param compFactory        Preferences setting component factory
106
      * @param compFactory        Preferences setting component factory
107
-     * @param channel            The channel object that we're editing settings for
107
+     * @param groupChat          The group chat object that we're editing settings for
108
      * @param parentWindow       Parent window
108
      * @param parentWindow       Parent window
109
      * @param clipboard          Clipboard to copy and paste from
109
      * @param clipboard          Clipboard to copy and paste from
110
      * @param commandController  The controller to use to retrieve command information.
110
      * @param commandController  The controller to use to retrieve command information.
117
             final ServiceManager serviceManager,
117
             final ServiceManager serviceManager,
118
             final PreferencesManager preferencesManager,
118
             final PreferencesManager preferencesManager,
119
             final PrefsComponentFactory compFactory,
119
             final PrefsComponentFactory compFactory,
120
-            final Channel channel,
120
+            final GroupChat groupChat,
121
             final Window parentWindow,
121
             final Window parentWindow,
122
             final Clipboard clipboard,
122
             final Clipboard clipboard,
123
             final CommandController commandController,
123
             final CommandController commandController,
131
         this.serviceManager = checkNotNull(serviceManager);
131
         this.serviceManager = checkNotNull(serviceManager);
132
         this.preferencesManager = checkNotNull(preferencesManager);
132
         this.preferencesManager = checkNotNull(preferencesManager);
133
         this.compFactory = checkNotNull(compFactory);
133
         this.compFactory = checkNotNull(compFactory);
134
-        this.channel = checkNotNull(channel);
134
+        this.channel = checkNotNull(groupChat);
135
         this.clipboard = clipboard;
135
         this.clipboard = clipboard;
136
         this.commandController = checkNotNull(commandController);
136
         this.commandController = checkNotNull(commandController);
137
         this.eventBus = eventBus;
137
         this.eventBus = eventBus;
138
         this.colourManagerFactory = colourManagerFactory;
138
         this.colourManagerFactory = colourManagerFactory;
139
         this.iconManager = iconManager;
139
         this.iconManager = iconManager;
140
 
140
 
141
-        identity = identityFactory.createChannelConfig(
142
-                channel.getConnection().get().getNetwork(),
143
-                channel.getChannelInfo().getName());
144
-        channelWindow = (InputWindow) windowFactory.getSwingWindow(channel);
141
+        identity = identityFactory.createChannelConfig(groupChat.getConnection().get().getNetwork(),
142
+                groupChat.getName());
143
+        channelWindow = (InputWindow) windowFactory.getSwingWindow(groupChat.getWindowModel());
145
 
144
 
146
         initComponents(tabCompleterUtils);
145
         initComponents(tabCompleterUtils);
147
         initListeners();
146
         initListeners();

+ 4
- 0
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/profile/ProfileManagerController.java View File

285
         } else {
285
         } else {
286
             selectionModel.setLeadSelectionIndex(-1);
286
             selectionModel.setLeadSelectionIndex(-1);
287
         }
287
         }
288
+        addNickname.setEnabled(model.getSelectedProfile().isPresent());
289
+        editNickname.setEnabled(model.getSelectedProfile().isPresent());
290
+        addHighlight.setEnabled(model.getSelectedProfile().isPresent());
291
+        editHighlight.setEnabled(model.getSelectedProfile().isPresent());
288
         name.setEnabled(model.getSelectedProfile().isPresent());
292
         name.setEnabled(model.getSelectedProfile().isPresent());
289
         name.setText(model.getSelectedProfileName().orElse(""));
293
         name.setText(model.getSelectedProfileName().orElse(""));
290
         nicknames.setEnabled(model.getSelectedProfile().isPresent());
294
         nicknames.setEnabled(model.getSelectedProfile().isPresent());

+ 4
- 4
ui_swing/src/com/dmdirc/addons/ui_swing/injection/DialogModule.java View File

22
 
22
 
23
 package com.dmdirc.addons.ui_swing.injection;
23
 package com.dmdirc.addons.ui_swing.injection;
24
 
24
 
25
-import com.dmdirc.Channel;
26
 import com.dmdirc.ClientModule.UserConfig;
25
 import com.dmdirc.ClientModule.UserConfig;
27
 import com.dmdirc.DMDircMBassador;
26
 import com.dmdirc.DMDircMBassador;
28
 import com.dmdirc.addons.ui_swing.MainFrame;
27
 import com.dmdirc.addons.ui_swing.MainFrame;
44
 import com.dmdirc.config.prefs.PreferencesManager;
43
 import com.dmdirc.config.prefs.PreferencesManager;
45
 import com.dmdirc.interfaces.CommandController;
44
 import com.dmdirc.interfaces.CommandController;
46
 import com.dmdirc.interfaces.Connection;
45
 import com.dmdirc.interfaces.Connection;
46
+import com.dmdirc.interfaces.GroupChat;
47
 import com.dmdirc.interfaces.LifecycleController;
47
 import com.dmdirc.interfaces.LifecycleController;
48
 import com.dmdirc.interfaces.config.ConfigProvider;
48
 import com.dmdirc.interfaces.config.ConfigProvider;
49
 import com.dmdirc.interfaces.config.IdentityFactory;
49
 import com.dmdirc.interfaces.config.IdentityFactory;
186
 
186
 
187
     @Provides
187
     @Provides
188
     @Singleton
188
     @Singleton
189
-    public KeyedDialogProvider<Channel, ChannelSettingsDialog> getChannelSettingsDialogProvider(
189
+    public KeyedDialogProvider<GroupChat, ChannelSettingsDialog> getChannelSettingsDialogProvider(
190
             final IdentityFactory identityFactory,
190
             final IdentityFactory identityFactory,
191
             final SwingWindowFactory windowFactory,
191
             final SwingWindowFactory windowFactory,
192
             @UserConfig final ConfigProvider userConfig,
192
             @UserConfig final ConfigProvider userConfig,
200
             final ColourManagerFactory colourManagerFactory,
200
             final ColourManagerFactory colourManagerFactory,
201
             final TabCompleterUtils tabCompleterUtils,
201
             final TabCompleterUtils tabCompleterUtils,
202
             final IconManager iconManager) {
202
             final IconManager iconManager) {
203
-        return new KeyedDialogProvider<Channel, ChannelSettingsDialog>() {
203
+        return new KeyedDialogProvider<GroupChat, ChannelSettingsDialog>() {
204
             @Override
204
             @Override
205
-            protected ChannelSettingsDialog getInstance(final Channel key) {
205
+            protected ChannelSettingsDialog getInstance(final GroupChat key) {
206
                 return new ChannelSettingsDialog(identityFactory, windowFactory,
206
                 return new ChannelSettingsDialog(identityFactory, windowFactory,
207
                         userConfig, serviceManager, preferencesManager, compFactory, key,
207
                         userConfig, serviceManager, preferencesManager, compFactory, key,
208
                         parentWindow, clipboard, commandController, eventBus,
208
                         parentWindow, clipboard, commandController, eventBus,

Loading…
Cancel
Save