[platform] move code which closes the tip dialog to the corresponding module (GTW-9854)

Otherwise, if 'intellij.platform.tips' module isn't loaded (e.g. in the frontend process), TipAndTrickManager.getInstance() fails with exception and no plugin can be dynamically unloaded.

GitOrigin-RevId: e7b22f39d122e1802e13cdf56122c7cb73b4c920
This commit is contained in:
Nikolay Chashnikov
2024-10-02 15:31:52 +02:00
committed by intellij-monorepo-bot
parent 936e994d82
commit a5cb350b15
3 changed files with 16 additions and 3 deletions

View File

@@ -21,7 +21,6 @@ import com.intellij.ide.plugins.cl.PluginAwareClassLoader
import com.intellij.ide.plugins.cl.PluginClassLoader
import com.intellij.ide.ui.TopHitCache
import com.intellij.ide.ui.UIThemeProvider
import com.intellij.ide.util.TipAndTrickManager
import com.intellij.idea.IdeaLogger
import com.intellij.lang.Language
import com.intellij.notification.NotificationType
@@ -514,8 +513,6 @@ object DynamicPlugins {
}
try {
TipAndTrickManager.getInstance().closeTipDialog()
app.messageBus.syncPublisher(DynamicPluginListener.TOPIC).beforePluginUnload(pluginDescriptor, options.isUpdate)
IdeEventQueue.getInstance().flushQueue()
}

View File

@@ -28,6 +28,10 @@
restartRequired="false"/>
</extensions>
<applicationListeners>
<listener class="com.intellij.platform.tips.CloseTipDialogOnPluginUnloadingListener" topic="com.intellij.ide.plugins.DynamicPluginListener"/>
</applicationListeners>
<projectListeners>
<listener class="com.intellij.ide.util.TipsUsageManager$TipsUsageListener"
activeInTestMode="false"

View File

@@ -0,0 +1,12 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.tips
import com.intellij.ide.plugins.DynamicPluginListener
import com.intellij.ide.plugins.IdeaPluginDescriptor
import com.intellij.ide.util.TipAndTrickManager
internal class CloseTipDialogOnPluginUnloadingListener : DynamicPluginListener {
override fun beforePluginUnload(pluginDescriptor: IdeaPluginDescriptor, isUpdate: Boolean) {
TipAndTrickManager.getInstance().closeTipDialog()
}
}