feat(api): access node under caret/mouse and jump (PR #1903)

* Access node under caret/mouse and jump
* Apply lint
This commit is contained in:
Yoav Sternberg
2023-06-09 17:50:57 +03:00
committed by GitHub
parent 347d6e2c2e
commit f558203a9d
6 changed files with 217 additions and 0 deletions
@@ -40,6 +40,17 @@ class Gui(
context().copyToClipboard(str)
}
fun open(ref: ICodeNodeRef): Boolean = context().open(ref)
val nodeUnderCaret: ICodeNodeRef?
get() = context().nodeUnderCaret
val nodeUnderMouse: ICodeNodeRef?
get() = context().nodeUnderMouse
val enclosingNodeUnderCaret: ICodeNodeRef?
get() = context().enclosingNodeUnderCaret
val enclosingNodeUnderMouse: ICodeNodeRef?
get() = context().enclosingNodeUnderMouse
private fun context(): JadxGuiContext =
guiContext ?: throw IllegalStateException("GUI plugins context not available!")
}