NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
52.24k stars 5.92k forks source link

Dropdown/Combobox for loader options dialog #1157

Open zeroKilo opened 5 years ago

zeroKilo commented 5 years ago

Is your feature request related to a problem? Please describe. Im writing a loader for C64 programs. Those come in form of disk images that contain multiple programs, I would like to have a way to give an option that contains a list of strings, from which the user can choose. for now I solved it by creating a checkbox for every program, but the user could select multiple and make it unusable (im checking for it now to prevent it)

image

Describe the solution you'd like

List<Option> list = new ArrayList<Option>();
List<String> filenames = ...;
list.add(new Option("Program to load", filenames));

and when testing the value int selIndex = (int)(option.getValue)

Describe alternatives you've considered

Additional context

dev747368 commented 5 years ago

Have you considered implementing a GFileSystem to handle the disk image?

zeroKilo commented 5 years ago

never heard of it, is it a ghidra class? I load the filesystem myself, so what would that bring? how would I make the user choose a program?

dev747368 commented 5 years ago

It is an interface with many implementations in Ghidra. You can see it in action by using the "File System Browser" (File -> Open File System, and pick a supported container file, like zip files or apple firmware images or ext3 linux images, etc). If you implement a C64 disk image filesystem, users will be able to browse the disk images, and select a program and import it from the filesystem browser interface.

zeroKilo commented 5 years ago

hmm sounds like what I need, is there any example code for it or do I have to guess myself through ghidra documentation? thanks anyway

dev747368 commented 5 years ago

I would look at the ghidra.file.formats.zip.ZipFileSystem for an example.

zeroKilo commented 5 years ago

ok, will do, thanks for your time. But I still think a dropdown option would be good to have for other cases tho, so I keep this open for now.