void (@NotNull Collection<? extends IdeaPluginDescriptor> descriptors, @NotNull PluginEnabler pluginEnabler, @NotNull @Nls String content, boolean enabled) { String title = IdeBundle.message(enabled ? "plugins.auto.enabled.notification.title" : "plugins.auto.disabled.notification.title"); Notification switchNotification = UpdateChecker.getNotificationGroupForPluginUpdateResults() .createNotification(content, NotificationType.INFORMATION) .setDisplayId("plugin.auto.switch") .setTitle(title) .addAction(new NotificationAction(IdeBundle.message("plugins.auto.switch.action.name")) { @Override public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { boolean appliedWithoutRestart = enabled ? pluginEnabler.disable(descriptors) : pluginEnabler.enable(descriptors); notification.expire(); notifyIfRestartRequired(!appliedWithoutRestart); } }); Set<PluginId> pluginIds = IdeaPluginDescriptorImplKt.toPluginIdSet(descriptors); DisabledPluginsState.Companion.addDisablePluginListener(new Runnable() { @Override public void run() { Condition<? super PluginId> condition = pluginEnabler::isDisabled; boolean notificationValid = enabled ? !ContainerUtil.exists(pluginIds, condition) : ContainerUtil.and(pluginIds, condition); if (!notificationValid) { switchNotification.expire(); } Balloon balloon = switchNotification.getBalloon(); if (balloon == null || balloon.isDisposed()) { ApplicationManager.getApplication().invokeLater(() -> { DisabledPluginsState.Companion.removeDisablePluginListener(this); }); } } }); switchNotification.notify(null); }