Change CodeBrowser Listing Cursor Color Highlight for a Specific Address #7905
-
Hello, I am instrumenting a Ghidra version: 11.0.3 |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
Not sure if this is what you are looking for., but you can use the
|
Beta Was this translation helpful? Give feedback.
-
Digging into the source code I have found the option @dragonmacher, I have found the following way to change the cursor color highlight. CodeBrowserPlugin plugin = null;
for(Plugin p: tool.getManagedPlugins()) {
if (p instanceof CodeBrowserPlugin){
plugin = (CodeBrowserPlugin) p;
break;
}
}
plugin.optionsChanged(
new ToolOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS),
GhidraOptions.HIGHLIGHT_CURSOR_LINE_COLOR,
null,
new Color(246, 6, 6)
); It works nice ! Now propably the best way would be to wrap the call to Any way to set an event handler on cursor location change ? |
Beta Was this translation helpful? Give feedback.
-
I can think of few solutions dirtier 😄 That being said, your code helped me better understand what you are trying to do. We did not explicitly allow for this behavior, but you should be able to accomplish this by changing the correct theme value. Below is a script snippet that does just this. Every time you run the script, it will update the color. Note that the script is only changing the focused color. There is also an 'unfocused' color you may wish to change, which defaults to a lighter version of the focused color.
|
Beta Was this translation helpful? Give feedback.
-
Regarding the code not working, I put that same code inside of the CodeBrower plugin's
You should not need the transaction code at all. If your code is responding to location events, then you do not need the other SystemUtilities call either. Regarding the dialogs, I added this call to the plugin's
|
Beta Was this translation helpful? Give feedback.
-
I actually just edited the |
Beta Was this translation helpful? Give feedback.
Found !
It is possible to add a
PluginEventListener
to the CodeBrowser tool viaPluginTool.addListenerForAllPluginEvents()
, when the listing cursor location change aProgramLocationPluginEvent
is generated and provide thegetLocation()
method to retrieve the new location of the cursor, next a call toCodeBrowserPlugin.optionsChanged()
( see previous answer ) allows to set the cursor color according the new location address value.@dragonmacher, a last question in this feed, using
CodeBrowserPlugin.optionsChanged()
to change the cursor color is not too dirty ? Maybe a better way exist ?