mirror of
https://github.com/chylex/IntelliJ-Keep-Editor-Tooltips-While-Debugging.git
synced 2025-06-23 14:38:54 +02:00
Support disabling or uninstalling the plugin without an IDE restart
This commit is contained in:
parent
43857c2f7f
commit
b9a8bdaeba
src/main
java/com/chylex/intellij/keeppopupswhiledebugging
resources/META-INF
@ -17,7 +17,7 @@ class PluginLoadListener : DynamicPluginListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun beforePluginUnload(pluginDescriptor: IdeaPluginDescriptor, isUpdate: Boolean) {
|
override fun beforePluginUnload(pluginDescriptor: IdeaPluginDescriptor, isUpdate: Boolean) {
|
||||||
if (pluginDescriptor.pluginId.idString == PLUGIN_ID) {
|
if (pluginDescriptor.pluginId.idString == PLUGIN_ID && !PreventHidingPopups.tryUninstallListener()) {
|
||||||
throw CannotUnloadPluginException("A restart is required to unload Keep Editor Tooltips While Debugging plugin.")
|
throw CannotUnloadPluginException("A restart is required to unload Keep Editor Tooltips While Debugging plugin.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,19 @@ class PreventHidingPopups : StartupActivity {
|
|||||||
EditorMouseHoverPopupControl.getInstance()?.addListener(MouseTrackingDisabledListener)
|
EditorMouseHoverPopupControl.getInstance()?.addListener(MouseTrackingDisabledListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun tryUninstallListener(): Boolean {
|
||||||
|
val instance = EditorMouseHoverPopupControl.getInstance() ?: return true
|
||||||
|
|
||||||
|
return try {
|
||||||
|
val listenersField = instance.javaClass.getDeclaredField("listeners").also { it.isAccessible = true }
|
||||||
|
val listeners = listenersField.get(instance) as MutableCollection<*>
|
||||||
|
listeners.remove(MouseTrackingDisabledListener)
|
||||||
|
true
|
||||||
|
} catch (e: Exception) {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun enablePopupsInAllProjects() {
|
fun enablePopupsInAllProjects() {
|
||||||
val projectManager = ProjectManager.getInstanceIfCreated() ?: return
|
val projectManager = ProjectManager.getInstanceIfCreated() ?: return
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
If you hover an element that has tooltips from both the editor and the debugger, both tooltips are shown and moving the cursor on top of one hides the other.
|
If you hover an element that has tooltips from both the editor and the debugger, both tooltips are shown and moving the cursor on top of one hides the other.
|
||||||
<br><br>
|
<br><br>
|
||||||
Installing the plugin automatically re-enables all editor tooltips, even if installed in the middle of a debugging session.
|
Installing the plugin automatically re-enables all editor tooltips, even if installed in the middle of a debugging session.
|
||||||
Disabling or uninstalling the plugin requires an IDE restart.
|
Disabling or uninstalling the plugin takes effect when the next debugging session starts.
|
||||||
<br><br>
|
<br><br>
|
||||||
<a href="https://youtrack.jetbrains.com/issue/IDEA-120435">IDEA-120435</a>
|
<a href="https://youtrack.jetbrains.com/issue/IDEA-120435">IDEA-120435</a>
|
||||||
]]></description>
|
]]></description>
|
||||||
|
Loading…
Reference in New Issue
Block a user