Package ghidra.plugin.importer
Class ImporterUtilities
- java.lang.Object
-
- ghidra.plugin.importer.ImporterUtilities
-
public class ImporterUtilities extends java.lang.ObjectUtilities for importing files.Note: if a method takes a
TaskMonitor, then that method should only be called from a background task.
-
-
Field Summary
Fields Modifier and Type Field Description static GhidraFileFilterCONTAINER_FILES_FILTERFile extension filter for well known 'container' files for GhidraFileChoosers.static GhidraFileFilterLOADABLE_FILES_FILTERFile extension filter for well known 'loadable' files for GhidraFileChoosers.
-
Constructor Summary
Constructors Constructor Description ImporterUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddContentToProgram(PluginTool tool, Program program, FSRL fsrl, LoadSpec loadSpec, java.util.List<Option> options, TaskMonitor monitor)static voidimportSingleFile(PluginTool tool, ProgramManager programManager, FSRL fsrl, DomainFolder destFolder, LoadSpec loadSpec, java.lang.String programName, java.util.List<Option> options, TaskMonitor monitor)Perform file import and open using optional programManagerstatic voidsetProgramProperties(Program program, FSRL fsrl, TaskMonitor monitor)Ensure that aProgram's metadata includes its import origin.static voidshowAddToProgramDialog(FSRL fsrl, Program program, PluginTool tool, TaskMonitor monitor)static voidshowImportDialog(PluginTool tool, ProgramManager programManager, FSRL fsrl, DomainFolder destinationFolder, java.lang.String suggestedPath)Displays the appropriate import dialog for the specifiedfile.static voidshowImportDialog(PluginTool tool, ProgramManager programManager, FSRL fsrl, DomainFolder destinationFolder, java.lang.String suggestedPath, TaskMonitor monitor)Displays the appropriate import dialog for the specifiedfile.
-
-
-
Field Detail
-
LOADABLE_FILES_FILTER
public static final GhidraFileFilter LOADABLE_FILES_FILTER
File extension filter for well known 'loadable' files for GhidraFileChoosers. TODO: will be refactored to use file_extension_icon.xml file info.
-
CONTAINER_FILES_FILTER
public static final GhidraFileFilter CONTAINER_FILES_FILTER
File extension filter for well known 'container' files for GhidraFileChoosers. TODO: will be refactored to use file_extension_icon.xml file info.
-
-
Method Detail
-
setProgramProperties
public static void setProgramProperties(Program program, FSRL fsrl, TaskMonitor monitor) throws CancelledException, java.io.IOException
Ensure that aProgram's metadata includes its import origin.- Parameters:
program- importedProgramto modifyfsrl-FSRLof the import source.monitor-TaskMonitorto use when accessing filesystem stuff.- Throws:
CancelledException- if user cancelsjava.io.IOException- if IO error
-
showImportDialog
public static void showImportDialog(PluginTool tool, ProgramManager programManager, FSRL fsrl, DomainFolder destinationFolder, java.lang.String suggestedPath)
Displays the appropriate import dialog for the specifiedfile.If the file is a container of other files, a batch import dialog will be used, otherwise the normal single file import dialog will be shown.
- Parameters:
tool-PluginToolwill be used as the parent tool for dialogsprogramManager- optionalProgramManagerinstance to use to open imported binaries with, or nullfsrl-FSRLof the file to importdestinationFolder-DomainFolderdestination folder where the imported file will default to. (the user will be able to choose a different location)suggestedPath- optional string path that will automatically be pre-pended to the destination filename
-
showImportDialog
public static void showImportDialog(PluginTool tool, ProgramManager programManager, FSRL fsrl, DomainFolder destinationFolder, java.lang.String suggestedPath, TaskMonitor monitor)
Displays the appropriate import dialog for the specifiedfile.If the file is a container of other files, a batch import dialog will be used, otherwise the normal single file import dialog will be shown.]
If you are not in a monitored task, then call
showImportDialog(PluginTool, ProgramManager, FSRL, DomainFolder, String).- Parameters:
tool-PluginToolwill be used as the parent tool for dialogsprogramManager- optionalProgramManagerinstance to use to open imported binaries with, or nullfsrl-FSRLof the file to importdestinationFolder-DomainFolderdestination folder where the imported file will default to. (the user will be able to choose a different location)suggestedPath- optional string path that will automatically be pre-pended to the destination filenamemonitor- the task monitor to use for monitoring; cannot be null
-
showAddToProgramDialog
public static void showAddToProgramDialog(FSRL fsrl, Program program, PluginTool tool, TaskMonitor monitor)
-
importSingleFile
public static void importSingleFile(PluginTool tool, ProgramManager programManager, FSRL fsrl, DomainFolder destFolder, LoadSpec loadSpec, java.lang.String programName, java.util.List<Option> options, TaskMonitor monitor)
Perform file import and open using optional programManager- Parameters:
tool- tool to which popup dialogs should be associatedprogramManager- program manager to open imported file with or nullfsrl- import file locationdestFolder- project destination folderloadSpec- importLoadSpecprogramName- program nameoptions- import optionsmonitor- task monitor
-
addContentToProgram
public static void addContentToProgram(PluginTool tool, Program program, FSRL fsrl, LoadSpec loadSpec, java.util.List<Option> options, TaskMonitor monitor)
-
-