void (@NotNull UsageView usageView) { myUsageView = usageView; final MessageBusConnection connection = mySearchContext.getProject().getMessageBus().connect(usageView); connection.subscribe(DynamicPluginListener.TOPIC, new DynamicPluginListener() { @Override public void beforePluginUnload(@NotNull IdeaPluginDescriptor pluginDescriptor, boolean isUpdate) { myUsageView.close(); } }); }