void () { if (!myListenersInitialized.compareAndSet(false, true)) return; MessageBusConnection connection = myProject.getMessageBus().connect(myProject); connection.subscribe(RunManagerListener.TOPIC, new RunManagerListener() { private volatile boolean myUpdateStarted; @Override public void runConfigurationAdded(@NotNull RunnerAndConfigurationSettings settings) { if (!myUpdateStarted) { syncConfigurations(); updateDashboardIfNeeded(settings); } } @Override public void runConfigurationRemoved(@NotNull RunnerAndConfigurationSettings settings) { myHiddenConfigurations.remove(settings.getConfiguration()); if (!myUpdateStarted) { syncConfigurations(); updateDashboardIfNeeded(settings); } } @Override public void runConfigurationChanged(@NotNull RunnerAndConfigurationSettings settings) { if (!myUpdateStarted) { updateDashboardIfNeeded(settings); } } @Override public void beginUpdate() { myUpdateStarted = true; } @Override public void endUpdate() { myUpdateStarted = false; syncConfigurations(); updateDashboard(true); } }); connection.subscribe(ExecutionManager.EXECUTION_TOPIC, new ExecutionListener() { @Override public void processStarted(@NotNull String executorId, @NotNull ExecutionEnvironment env, final @NotNull ProcessHandler handler) { updateDashboardIfNeeded(env.getRunnerAndConfigurationSettings()); } @Override public void processTerminated(@NotNull String executorId, @NotNull ExecutionEnvironment env, @NotNull ProcessHandler handler, int exitCode) { updateDashboardIfNeeded(env.getRunnerAndConfigurationSettings()); } }); connection.subscribe(RunDashboardManager.DASHBOARD_TOPIC, new RunDashboardListener() { @Override public void configurationChanged(@NotNull RunConfiguration configuration, boolean withStructure) { updateDashboardIfNeeded(configuration, withStructure); } }); connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void exitDumbMode() { updateDashboard(false); } }); myContentManager.addContentManagerListener(myServiceContentManagerListener); }