Can a FileSystem extension set icons for files in the FileSystem viewer/browser? #6953
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You should be able to alter the A cursory look gives some hints: https://ghidra.re/ghidra_docs/api/docking/widgets/tree/GTree.html The documentation for examples and how things are built is very sparse, but fgrep will be your best companion for the time being.
From
In this case a contextual menu is created for image types, using Hopefully this helps you get on the right direction. Edit: you can do whatever it is you want on the object itself (so eventually, you can get to whatever Icon property is associated with it and alter it accordingly). Remember to cleanup/deal with anything you create on runtime if it is not automatically destroyed/released in context. |
Beta Was this translation helpful? Give feedback.
-
You are correct, the icons for files in the file system browser tree are mainly determined by the filename extension. See the code in FSBComponentProvider.java, method renderFile(), about line 195'ish. The icons for actions in a popup menu or a button on the toolbar will be determined by the info you put in the DockingAction. You can add actions to the file system browser by creating your own FSBFileHandler derived class. As an example, I would point to the TextFSBFileHandler class. |
Beta Was this translation helpful? Give feedback.
You should be able to alter the
GIcon
associated with the items, AFAIK. Whether a explicit API exists from Ghidra itself I don't know, but it's all Swing under the hood.A cursory look gives some hints:
https://ghidra.re/ghidra_docs/api/ghidra/formats/gfilesystem/GIconProvider.html#getIconForFile(ghidra.formats.gfilesystem.GFile,ghidra.util.task.TaskMonitor)
https://ghidra.re/ghidra_docs/api/docking/widgets/tree/GTree.html
The documentation for examples and how things are built is very sparse, but fgrep will be your best companion for the time being.
fgrep --include '*.java' -rn getIconForFile .
(from a clone of Ghidra's source)From
./Ghidra/Features/Base/src/main/java/ghidra/plugins/fsb…