void () { super.addNotify(); myFileEditor.putUserData(EDITOR_TOOLBAR_KEY, this); Project project = myModuleSelector.getProject(); ApplicationManager.getApplication().invokeLater(() -> { try { myJShellHandlerGetter.call(); } catch (Exception e) { JShellDiagnostic.notifyError(e, project); } }, ModalityState.stateForComponent(this), project.getDisposed()); myBusConnection = project.getMessageBus().connect(); myBusConnection.subscribe(ModuleListener.TOPIC, new ModuleListener() { @Override public void modulesAdded(@NotNull Project project, @NotNull List<? extends Module> modules) { reloadModules(); } @Override public void moduleRemoved(@NotNull Project project, @NotNull Module module) { reloadModules(); } @Override public void modulesRenamed(@NotNull Project project, @NotNull List<? extends Module> modules, @NotNull com.intellij.util.Function<? super Module, String> oldNameProvider) { reloadModules(); } }); reloadModules(); }