protected ProjectConfigRegistry(@NotNull Project project) { this.project = project; this.projectBusClient = MessageBusClient.forProject(project, this); this.applicationBusClient = MessageBusClient.forApplication(this); Disposer.register(project, this); }
public CacheStoreUpdateListener(@NotNull Project project, @NotNull ProjectCacheStore cache, @NotNull Disposable disposableParent) { this.project = project; this.cache = cache; // TODO should be an argument, rather than the cache directly? this.pendingCache = new CachePendingActionHandlerImpl(cache); MessageBusClient.ApplicationClient appClient = MessageBusClient.forApplication(disposableParent); MessageBusClient.ProjectClient projectClient = MessageBusClient.forProject(project, disposableParent); CacheListener listener = new CacheListener(); String cacheId = AbstractCacheMessage.createCacheId(project, CacheStoreUpdateListener.class); ClientActionMessage.addListener(appClient, cacheId, listener); // TODO this causes the event listener to be fired twice. // Somewhere, this ClientOpenCacheMessage call invokes the exact same listener // method twice. Either the listener is registered twice, or the event object // is being passed to send() twice. ClientOpenCacheMessage.addListener(appClient, cacheId, listener); DescribeChangelistCacheMessage.addListener(appClient, cacheId, listener); FileActionMessage.addListener(appClient, cacheId, listener); JobCacheMessage.addListener(appClient, cacheId, listener); JobSpecCacheMessage.addListener(appClient, cacheId, listener); ListClientsForUserCacheMessage.addListener(appClient, cacheId, listener); ServerActionCacheMessage.addListener(appClient, cacheId, listener); ClientConfigRemovedMessage.addListener(projectClient, cacheId, listener); }
MessageBusClient.ApplicationClient appClient = MessageBusClient.forApplication(this); MessageBusClient.ProjectClient projClient = MessageBusClient.forProject(project, this); ClientConfigAddedMessage.addListener(projClient, this, (e) -> clientConfigs.put(e.getRoot(), e.getClientConfig()));
P4ChangeProvider(@NotNull P4Vcs vcs, @NotNull Disposable parentDisposable) { this.project = vcs.getProject(); this.vcs = vcs; this.loader = new HistoryContentLoaderImpl(project); final MessageBusClient.ApplicationClient mbClient = MessageBusClient.forApplication(parentDisposable); final String cacheId = AbstractCacheMessage.createCacheId(project, P4ChangeProvider.class); ClientActionMessage.addListener(mbClient, cacheId, event -> { P4CommandRunner.ClientActionCmd cmd = (P4CommandRunner.ClientActionCmd) event.getAction().getCmd(); try { switch (cmd) { case CREATE_CHANGELIST: onChangelistCreated( (CreateChangelistAction) event.getAction(), (CreateChangelistResult) event.getResult(), event.getState()); break; case DELETE_CHANGELIST: if (event.getState() == ClientActionMessage.ActionState.PENDING) { onChangelistDelete((DeleteChangelistAction) event.getAction()); } break; } } catch (InterruptedException e) { InternalErrorMessage.send(project).cacheLockTimeoutError(new ErrorEvent<>( new VcsInterruptedException(e))); } }); }
@Override public void initComponent() { LOG.info("Initializing InvalidPasswordMonitorComponent"); MessageBusClient.ApplicationClient mbClient = MessageBusClient.forApplication(this); LoginFailureMessage.addListener(mbClient, this, new LoginFailureMessage.Listener() { @Override
MessageBusClient.ApplicationClient appBus = MessageBusClient.forApplication(parentDisposable); MessageBusClient.ProjectClient clientBus = MessageBusClient.forProject(project, parentDisposable);
@SuppressWarnings("Convert2Lambda") @Override public void initComponent() { MessageBusClient.ApplicationClient appClient = MessageBusClient.forApplication(this); MessageBusClient.ProjectClient projClient = MessageBusClient.forProject(project, this); CancellationMessage.addListener(projClient, this, new CancellationMessage.Listener() {