feat: add events support (#1832)
This commit is contained in:
@@ -22,6 +22,7 @@ sourceSets {
|
||||
main {
|
||||
kotlin.srcDirs(
|
||||
"scripts",
|
||||
"scripts/gui",
|
||||
"context"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import jadx.api.plugins.events.JadxEvents
|
||||
|
||||
/**
|
||||
* Log events
|
||||
*/
|
||||
|
||||
val jadx = getJadxInstance()
|
||||
|
||||
jadx.events.addListener(JadxEvents.NODE_RENAMED_BY_USER) { rename ->
|
||||
log.info { "Rename from '${rename.oldName}' to '${rename.newName}' for node ${rename.node}" }
|
||||
}
|
||||
+4
@@ -7,6 +7,7 @@ import jadx.api.JadxArgs
|
||||
import jadx.api.JadxDecompiler
|
||||
import jadx.api.JavaClass
|
||||
import jadx.api.plugins.JadxPluginContext
|
||||
import jadx.api.plugins.events.IJadxEvents
|
||||
import jadx.api.plugins.pass.JadxPass
|
||||
import jadx.plugins.script.runtime.data.Debug
|
||||
import jadx.plugins.script.runtime.data.Decompile
|
||||
@@ -50,6 +51,9 @@ class JadxScriptInstance(
|
||||
val gui: Gui by lazy { Gui(this, scriptData.pluginContext.guiContext) }
|
||||
val debug: Debug by lazy { Debug(this) }
|
||||
|
||||
val events: IJadxEvents
|
||||
get() = scriptData.pluginContext.events()
|
||||
|
||||
val args: JadxArgs
|
||||
get() = decompiler.args
|
||||
|
||||
|
||||
Reference in New Issue
Block a user