mirror of
https://github.com/chylex/IntelliJ-Keep-Editor-Tooltips-While-Debugging.git
synced 2025-06-05 14:34:05 +02:00
Fix listener being installed multiple times
This commit is contained in:
parent
b9a8bdaeba
commit
fe7a20920c
@ -13,9 +13,16 @@ class PreventHidingPopups : StartupActivity {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private var isInstalled = false
|
||||
|
||||
fun installListener() {
|
||||
if (isInstalled) {
|
||||
return
|
||||
}
|
||||
|
||||
EditorMouseHoverPopupManager.getInstance() // Installs the default listener.
|
||||
EditorMouseHoverPopupControl.getInstance()?.addListener(MouseTrackingDisabledListener)
|
||||
isInstalled = true
|
||||
}
|
||||
|
||||
fun tryUninstallListener(): Boolean {
|
||||
@ -25,6 +32,7 @@ class PreventHidingPopups : StartupActivity {
|
||||
val listenersField = instance.javaClass.getDeclaredField("listeners").also { it.isAccessible = true }
|
||||
val listeners = listenersField.get(instance) as MutableCollection<*>
|
||||
listeners.remove(MouseTrackingDisabledListener)
|
||||
isInstalled = false
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
|
Loading…
Reference in New Issue
Block a user