Skip to content

Commit

Permalink
Merge pull request #707 from csmith/master
Browse files Browse the repository at this point in the history
Use EventBus interface.
  • Loading branch information
greboid committed Sep 10, 2016
2 parents 3266257 + 5cc0af4 commit a50a5ec
Show file tree
Hide file tree
Showing 83 changed files with 200 additions and 188 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/dmdirc/ChannelEventHandler.java
Expand Up @@ -47,6 +47,7 @@
import com.dmdirc.events.ChannelUserAwayEvent;
import com.dmdirc.events.ChannelUserBackEvent;
import com.dmdirc.interfaces.Connection;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.parser.common.AwayState;
import com.dmdirc.parser.events.ChannelCTCPEvent;
import com.dmdirc.parser.events.ChannelListModeEvent;
Expand Down Expand Up @@ -76,10 +77,10 @@ public class ChannelEventHandler extends EventHandler {
/** The channel that owns this event handler. */
private final Channel owner;
/** Event bus to send events on. */
private final DMDircMBassador eventBus;
private final EventBus eventBus;
private final GroupChatUserManager groupChatUserManager;

public ChannelEventHandler(final Channel owner, final DMDircMBassador eventBus,
public ChannelEventHandler(final Channel owner, final EventBus eventBus,
final GroupChatUserManager groupChatUserManager) {
this.owner = owner;
this.eventBus = eventBus;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/dmdirc/ChannelFactory.java
Expand Up @@ -27,6 +27,7 @@
import com.dmdirc.events.ChannelOpenedEvent;
import com.dmdirc.interfaces.CommandController;
import com.dmdirc.interfaces.Connection;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.config.ConfigProviderMigrator;
import com.dmdirc.parser.interfaces.ChannelInfo;
import com.dmdirc.ui.WindowManager;
Expand All @@ -44,15 +45,15 @@ public class ChannelFactory {

private final TabCompleterFactory tabCompleterFactory;
private final CommandController commandController;
private final DMDircMBassador eventBus;
private final EventBus eventBus;
private final BackBufferFactory backBufferFactory;
private final GroupChatUserManager groupChatUserManager;
private final WindowManager windowManager;

@Inject
public ChannelFactory(final TabCompleterFactory tabCompleterFactory,
final CommandController commandController,
final DMDircMBassador eventBus, final BackBufferFactory backBufferFactory,
final EventBus eventBus, final BackBufferFactory backBufferFactory,
final GroupChatUserManager groupChatUserManager, final WindowManager windowManager) {
this.tabCompleterFactory = tabCompleterFactory;
this.commandController = commandController;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/dmdirc/ClientModule.java
Expand Up @@ -35,6 +35,7 @@
import com.dmdirc.interfaces.CommandController;
import com.dmdirc.interfaces.ConnectionFactory;
import com.dmdirc.interfaces.ConnectionManager;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.LifecycleController;
import com.dmdirc.interfaces.config.AggregateConfigProvider;
import com.dmdirc.interfaces.config.IdentityController;
Expand Down Expand Up @@ -109,7 +110,7 @@ public ExecutorService getExecutorService() {

@Provides
@Singleton
public DMDircMBassador getMBassador() {
public EventBus getMBassador() {
return new DMDircMBassador();
}

Expand Down Expand Up @@ -137,7 +138,7 @@ public CommandController getCommandController(final CommandManager commandManage
@Provides
@Singleton
public ThemeManager getThemeManager(
final DMDircMBassador eventBus,
final EventBus eventBus,
final IdentityController controller,
@Directory(DirectoryType.THEMES) final String directory) {
final ThemeManager manager = new ThemeManager(controller, directory);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/dmdirc/CustomWindow.java
Expand Up @@ -23,6 +23,7 @@
package com.dmdirc;

import com.dmdirc.interfaces.Connection;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.WindowModel;
import com.dmdirc.interfaces.config.AggregateConfigProvider;
import com.dmdirc.ui.core.components.WindowComponent;
Expand Down Expand Up @@ -60,7 +61,7 @@ public CustomWindow(
final String name,
final String title,
final AggregateConfigProvider configProvider,
final DMDircMBassador eventBus,
final EventBus eventBus,
final BackBufferFactory backBufferFactory) {
super("custom", name, title, configProvider, backBufferFactory,
eventBus, Collections.singletonList(WindowComponent.TEXTAREA.getIdentifier()));
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/dmdirc/FrameContainer.java
Expand Up @@ -29,6 +29,7 @@
import com.dmdirc.events.FrameNameChangedEvent;
import com.dmdirc.events.FrameTitleChangedEvent;
import com.dmdirc.interfaces.Connection;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.InputModel;
import com.dmdirc.interfaces.WindowModel;
import com.dmdirc.interfaces.config.AggregateConfigProvider;
Expand Down Expand Up @@ -65,7 +66,7 @@ public class FrameContainer implements WindowModel {
/** The UI components that this frame requires. */
private final Set<String> components;
/** Event bus to dispatch events to. */
private final DMDircMBassador eventBus;
private final EventBus eventBus;
/** The manager handling this frame's unread status. */
private final UnreadStatusManager unreadStatusManager;
/** The back buffer factory. */
Expand All @@ -88,7 +89,7 @@ public FrameContainer(
final String title,
final AggregateConfigProvider config,
final BackBufferFactory backBufferFactory,
final DMDircMBassador eventBus,
final EventBus eventBus,
final Collection<String> components) {
this.configManager = config;
this.name = name;
Expand Down Expand Up @@ -157,7 +158,7 @@ public AggregateConfigProvider getConfigManager() {
}

@Override
public DMDircMBassador getEventBus() {
public EventBus getEventBus() {
return eventBus;
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/dmdirc/GlobalWindow.java
Expand Up @@ -27,6 +27,7 @@
import com.dmdirc.commandparser.parsers.GlobalCommandParser;
import com.dmdirc.events.CommandErrorEvent;
import com.dmdirc.interfaces.Connection;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.config.AggregateConfigProvider;
import com.dmdirc.interfaces.config.ConfigChangeListener;
import com.dmdirc.ui.WindowManager;
Expand All @@ -53,7 +54,7 @@ public class GlobalWindow extends FrameContainer {
@Inject
public GlobalWindow(@GlobalConfig final AggregateConfigProvider config,
final GlobalCommandParser parser, final TabCompleterFactory tabCompleterFactory,
final DMDircMBassador eventBus, final BackBufferFactory backBufferFactory) {
final EventBus eventBus, final BackBufferFactory backBufferFactory) {
super("icon", "Global", "(Global)", config, backBufferFactory, eventBus,
Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
WindowComponent.INPUTFIELD.getIdentifier()));
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/dmdirc/Main.java
Expand Up @@ -30,6 +30,7 @@
import com.dmdirc.events.FirstRunEvent;
import com.dmdirc.interfaces.CommandController.CommandDetails;
import com.dmdirc.interfaces.ConnectionManager;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.Migrator;
import com.dmdirc.interfaces.SystemLifecycleComponent;
import com.dmdirc.interfaces.config.IdentityController;
Expand Down Expand Up @@ -92,7 +93,7 @@ public class Main {
/** The set of migrators to execute on startup. */
private final Set<Migrator> migrators;
/** The event bus to dispatch events on. */
private final DMDircMBassador eventBus;
private final EventBus eventBus;
/** The commands to load into the command manager. */
private final Set<CommandDetails> commands;
/** Mode alias reporter to use. */
Expand Down Expand Up @@ -123,7 +124,7 @@ public Main(
final GlobalWindowManager globalWindowManager,
final Set<SystemLifecycleComponent> lifecycleComponents,
final Set<Migrator> migrators,
final DMDircMBassador eventBus,
final EventBus eventBus,
final Set<CommandDetails> commands,
final ModeAliasReporter reporter,
final ServiceManager serviceManager,
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/dmdirc/ServerEventHandler.java
Expand Up @@ -52,6 +52,7 @@
import com.dmdirc.events.StatusBarMessageEvent;
import com.dmdirc.events.UserInfoResponseEvent;
import com.dmdirc.interfaces.Connection;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.parser.common.AwayState;
import com.dmdirc.parser.events.AuthNoticeEvent;
import com.dmdirc.parser.events.AwayStateEvent;
Expand Down Expand Up @@ -113,7 +114,7 @@ public class ServerEventHandler extends EventHandler {
/** Group chat manager to poke for channel events. */
private final GroupChatManagerImpl groupChatManager;
/** Event bus to post events to. */
private final DMDircMBassador eventBus;
private final EventBus eventBus;

/**
* Creates a new instance of ServerEventHandler.
Expand All @@ -122,7 +123,7 @@ public class ServerEventHandler extends EventHandler {
* @param eventBus The event bus to post events to
*/
public ServerEventHandler(final Server owner, final GroupChatManagerImpl groupChatManager,
final DMDircMBassador eventBus) {
final EventBus eventBus) {
this.owner = owner;
this.groupChatManager = groupChatManager;
this.eventBus = eventBus;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/dmdirc/ServerFactoryImpl.java
Expand Up @@ -26,6 +26,7 @@
import com.dmdirc.commandparser.parsers.ServerCommandParser;
import com.dmdirc.config.profiles.Profile;
import com.dmdirc.interfaces.CommandController;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.config.ConfigProvider;
import com.dmdirc.interfaces.config.ConfigProviderMigrator;
import com.dmdirc.interfaces.config.IdentityFactory;
Expand All @@ -52,7 +53,7 @@ public class ServerFactoryImpl {
private final IdentityFactory identityFactory;
private final Provider<QueryFactory> queryFactory;
private final Provider<CommandController> commandController;
private final DMDircMBassador eventBus;
private final EventBus eventBus;
private final MessageEncoderFactory messageEncoderFactory;
private final ConfigProvider userSettings;
private final BackBufferFactory backBufferFactory;
Expand All @@ -66,7 +67,7 @@ public ServerFactoryImpl(
final IdentityFactory identityFactory,
final Provider<QueryFactory> queryFactory,
final Provider<CommandController> commandController,
final DMDircMBassador eventBus,
final EventBus eventBus,
final MessageEncoderFactory messageEncoderFactory,
@ClientModule.UserConfig final ConfigProvider userSettings,
final BackBufferFactory backBufferFactory,
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/dmdirc/ServerManager.java
Expand Up @@ -27,6 +27,7 @@
import com.dmdirc.events.FrameClosingEvent;
import com.dmdirc.interfaces.Connection;
import com.dmdirc.interfaces.ConnectionManager;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.config.ConfigProviderMigrator;
import com.dmdirc.interfaces.config.IdentityFactory;
import com.dmdirc.parser.common.ChannelJoinRequest;
Expand Down Expand Up @@ -75,7 +76,7 @@ public class ServerManager implements ConnectionManager {
/** Concrete server factory to use. */
private final ServerFactoryImpl serverFactoryImpl;
/** Event bus for servers. */
private final DMDircMBassador eventBus;
private final EventBus eventBus;

/**
* Creates a new instance of ServerManager.
Expand All @@ -92,7 +93,7 @@ public ServerManager(
final IdentityFactory identityFactory,
final WindowManager windowManager,
final ServerFactoryImpl serverFactory,
final DMDircMBassador eventBus) {
final EventBus eventBus) {
this.profileManager = profileManager;
this.identityFactory = identityFactory;
this.windowManager = windowManager;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/dmdirc/SystemLifecycleController.java
Expand Up @@ -25,6 +25,7 @@
import com.dmdirc.ClientModule.GlobalConfig;
import com.dmdirc.events.ClientClosedEvent;
import com.dmdirc.interfaces.ConnectionManager;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.LifecycleController;
import com.dmdirc.interfaces.SystemLifecycleComponent;
import com.dmdirc.interfaces.config.AggregateConfigProvider;
Expand All @@ -49,7 +50,7 @@ public class SystemLifecycleController implements LifecycleController {
/** Manager to use to disconnect servers. */
private final ConnectionManager connectionManager;
/** The event bus to raise client closed events on. */
private final DMDircMBassador eventBus;
private final EventBus eventBus;
/** The identity controller to save when quitting. */
private final IdentityController identityController;

Expand All @@ -58,7 +59,7 @@ public SystemLifecycleController(
@GlobalConfig final AggregateConfigProvider configProvider,
final Set<SystemLifecycleComponent> lifecycleComponents,
final ConnectionManager connectionManager,
final DMDircMBassador eventBus,
final EventBus eventBus,
final IdentityController identityController) {
this.configProvider = configProvider;
this.lifecycleComponents = new HashSet<>(lifecycleComponents);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/dmdirc/commandparser/PopupManager.java
Expand Up @@ -22,9 +22,9 @@

package com.dmdirc.commandparser;

import com.dmdirc.DMDircMBassador;
import com.dmdirc.events.ClientPopupGeneratedEvent;
import com.dmdirc.interfaces.CommandController;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.config.AggregateConfigProvider;

import javax.inject.Inject;
Expand All @@ -37,7 +37,7 @@ public class PopupManager {
/** The command controller to use for items. */
private final CommandController commandController;
/** The bus to dispatch events on. */
private final DMDircMBassador eventBus;
private final EventBus eventBus;

/**
* Creates a new instance of PopupManager.
Expand All @@ -46,7 +46,7 @@ public class PopupManager {
* @param eventBus The bus to dispatch events on.
*/
@Inject
public PopupManager(final CommandController commandController, final DMDircMBassador eventBus) {
public PopupManager(final CommandController commandController, final EventBus eventBus) {
this.commandController = commandController;
this.eventBus = eventBus;
}
Expand Down
Expand Up @@ -22,7 +22,7 @@

package com.dmdirc.commandparser.auto;

import com.dmdirc.DMDircMBassador;
import com.dmdirc.interfaces.EventBus;

import java.util.Collections;
import java.util.Map;
Expand All @@ -42,7 +42,7 @@
public class AutoCommandManager {

/** The bus to listen for events on. */
private final DMDircMBassador eventBus;
private final EventBus eventBus;
/** The factory to use to create handlers. */
private final AutoCommandHandlerFactory factory;
/** Known auto commands, mapped on to their handlers. */
Expand All @@ -58,7 +58,7 @@ public class AutoCommandManager {
*/
@Inject
public AutoCommandManager(
final DMDircMBassador eventBus,
final EventBus eventBus,
final AutoCommandHandlerFactory factory) {
this.eventBus = eventBus;
this.factory = factory;
Expand Down
Expand Up @@ -24,7 +24,6 @@

import com.dmdirc.ClientModule.GlobalConfig;
import com.dmdirc.CustomWindow;
import com.dmdirc.DMDircMBassador;
import com.dmdirc.commandparser.BaseCommandInfo;
import com.dmdirc.commandparser.CommandArguments;
import com.dmdirc.commandparser.CommandInfo;
Expand All @@ -34,6 +33,7 @@
import com.dmdirc.commandparser.commands.context.CommandContext;
import com.dmdirc.interfaces.CommandController;
import com.dmdirc.interfaces.Connection;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.WindowModel;
import com.dmdirc.interfaces.config.AggregateConfigProvider;
import com.dmdirc.ui.WindowManager;
Expand All @@ -58,7 +58,7 @@ public class OpenWindow extends Command implements IntelligentCommand {
/** Window management. */
private final WindowManager windowManager;
/** The bus to dispatch events on. */
private final DMDircMBassador eventBus;
private final EventBus eventBus;
/** The config provider to retrieve settings from. */
private final AggregateConfigProvider configProvider;
/** Back buffer factory. */
Expand All @@ -71,7 +71,7 @@ public class OpenWindow extends Command implements IntelligentCommand {
public OpenWindow(
final CommandController controller,
final WindowManager windowManager,
final DMDircMBassador eventBus,
final EventBus eventBus,
@GlobalConfig final AggregateConfigProvider configProvider,
final BackBufferFactory backBufferFactory) {
super(controller);
Expand Down
Expand Up @@ -22,7 +22,6 @@

package com.dmdirc.commandparser.commands.server;

import com.dmdirc.DMDircMBassador;
import com.dmdirc.commandparser.BaseCommandInfo;
import com.dmdirc.commandparser.CommandArguments;
import com.dmdirc.commandparser.CommandInfo;
Expand All @@ -34,6 +33,7 @@
import com.dmdirc.events.ClientLineAddedEvent;
import com.dmdirc.interfaces.CommandController;
import com.dmdirc.interfaces.Connection;
import com.dmdirc.interfaces.EventBus;
import com.dmdirc.interfaces.WindowModel;
import com.dmdirc.parser.common.ChannelJoinRequest;
import com.dmdirc.ui.WindowManager;
Expand Down Expand Up @@ -82,7 +82,7 @@ public class JoinChannelCommand extends Command implements IntelligentCommand {
public JoinChannelCommand(
final CommandController controller,
final WindowManager windowManager,
final DMDircMBassador eventBus) {
final EventBus eventBus) {
super(controller);
this.windowManager = windowManager;
eventBus.subscribe(this);
Expand Down

0 comments on commit a50a5ec

Please sign in to comment.