Package ghidra.features.base.values
Class GhidraValuesMap
java.lang.Object
docking.widgets.values.GValuesMap
ghidra.features.base.values.GhidraValuesMap
Extends GValuesMap to add Ghidra specific types such as Address and Program
-
Field Summary
Fields inherited from class docking.widgets.values.GValuesMap
valuesMap
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefineAddress
(String name, Address defaultValue, AddressFactory factory) Defines a value of typeAddress
defineAddress
(String name, Address defaultValue, Program program) Defines a value of typeAddress
defineAddress
(String name, Program program) Defines a value of typeAddress
with no default value.defineLanguage
(String name, LanguageCompilerSpecPair defaultValue) Defines a value of type LanguageCompilerSpecPair (folders in a Ghidra project).defineProgram
(String name) Defines a value of type Program file.defineProgram
(String name, String startPath) Defines a value of type Program file.defineProjectFile
(String name) Defines a value of type DomainFile (files in a Ghidra project).defineProjectFile
(String name, String startingPath) Defines a value of type DomainFile (files in a Ghidra project).defineProjectFolder
(String name) Defines a value of type DomainFolder (folders in a Ghidra project).defineProjectFolder
(String name, String defaultValuePath) Defines a value of type DomainFolder (files in a Ghidra project).getAddress
(String name) Gets theAddress
value for the given name.getLanguage
(String name) Gets the Language (LanguageCompilerSpecPair
) value for the given name.getProgram
(String name, Object consumer, Tool tool, boolean upgradeIfNeeded) Gets (opens) theProgram
value for the given name.getProjectFile
(String name) Gets the project file (DomainFile
) value for the given name.getProjectFolder
(String name) Gets the project folder (DomainFolder
) value for the given name.void
setAddress
(String name, Address address) Sets the address value for the given name.void
setLanguage
(String name, LanguageCompilerSpecPair value) Sets the Language (LanguageCompilerSpecPair
) value for the given name.void
setProgram
(String name, Program program) Sets theProgram
value for the given name.void
setProjectFile
(String name, DomainFile file) Sets the project fileDomainFile
value for the given name.void
setProjectFolder
(String name, DomainFolder folder) Sets the project folderDomainFolder
value for the given name.void
setTaskMonitor
(TaskMonitor monitor) Sets a task monitor to be used when opening programs.Methods inherited from class docking.widgets.values.GValuesMap
addValue, checkDup, copyValues, defineBoolean, defineChoice, defineDirectory, defineDouble, defineDouble, defineFile, defineFile, defineHexInt, defineHexInt, defineHexLong, defineHexLong, defineInt, defineInt, defineLong, defineLong, defineString, defineString, getAbstractValue, getBoolean, getChoice, getDouble, getFile, getInt, getLong, getString, getValue, getValues, hasValue, isDefined, isValid, reset, setBoolean, setChoice, setDouble, setFile, setInt, setLong, setString, setValidator, updateFromComponents
-
Constructor Details
-
GhidraValuesMap
public GhidraValuesMap()
-
-
Method Details
-
setTaskMonitor
Sets a task monitor to be used when opening programs. Otherwise,TaskMonitor.DUMMY
is used.- Parameters:
monitor
- the TaskMonitor to use for opening programs
-
defineAddress
Defines a value of typeAddress
with no default value.- Parameters:
name
- the name for this valueprogram
- the program used to get anAddressFactory
for parsing addresses- Returns:
- the new AddressValue that was defined.
-
defineAddress
Defines a value of typeAddress
- Parameters:
name
- the name for this valuedefaultValue
- an option default valueprogram
- the program used to get anAddressFactory
for parsing addresses- Returns:
- the new AddressValue that was defined.
-
defineAddress
Defines a value of typeAddress
- Parameters:
name
- the name for this valuedefaultValue
- an option default valuefactory
- theAddressFactory
used to parse addresses- Returns:
- the new AddressValue that was defined.
-
defineLanguage
Defines a value of type LanguageCompilerSpecPair (folders in a Ghidra project).- Parameters:
name
- the name for this valuedefaultValue
- the initial value (can be null)- Returns:
- the new ProjectFolderValue that was defined
-
defineProgram
Defines a value of type Program file.- Parameters:
name
- the name for this value- Returns:
- the new ProgramFileValue defined
-
defineProgram
Defines a value of type Program file.- Parameters:
name
- the name for this valuestartPath
- the starting folder to display when picking programs from the chooser- Returns:
- the new ProgramFileValue that was defined
-
defineProjectFile
Defines a value of type DomainFile (files in a Ghidra project).- Parameters:
name
- the name for this value- Returns:
- the new ProjectFileValue that was defined
-
defineProjectFile
Defines a value of type DomainFile (files in a Ghidra project).- Parameters:
name
- the name for this valuestartingPath
- the initial folder path for the chooser widget- Returns:
- the new ProjectFileValue that was defined
-
defineProjectFolder
Defines a value of type DomainFolder (folders in a Ghidra project).- Parameters:
name
- the name for this value- Returns:
- the new ProjectFolderValue that was defined
-
defineProjectFolder
Defines a value of type DomainFolder (files in a Ghidra project).- Parameters:
name
- the name for this valuedefaultValuePath
- the path for the initial value (can be null)- Returns:
- the new ProjectFolderValue that was defined
-
getAddress
Gets theAddress
value for the given name.- Parameters:
name
- the name of a previously defined Address value- Returns:
- the Address
- Throws:
IllegalArgumentException
- if the name hasn't been defined as an Address type
-
getLanguage
Gets the Language (LanguageCompilerSpecPair
) value for the given name.- Parameters:
name
- the name of a previously defined language value- Returns:
- the language value
- Throws:
IllegalArgumentException
- if the name hasn't been defined as a language type
-
getProgram
public Program getProgram(String name, Object consumer, Tool tool, boolean upgradeIfNeeded) throws VersionException, IOException, CancelledException Gets (opens) theProgram
value for the given name. If the program is already open, then the consumer will be added to the program. The caller of this method is responsible for callingDomainObject.release(Object)
with the same consumer when it is done using this program. Program are only closed after all consumers are released. If multiple calls are made to this method, then the consumer will be added multiple times and must be released multiple times.The consumer can be any object, but since the consumer's purpose is to keep the program open while some object is using it, the object itself is typically passed in as the consumer. For example, when used in a script, passing in the java keyword "this" as the consumer will make the script itself the consumer.
- Parameters:
name
- the name of a previously defined program valueconsumer
- the consumer to be used to open the programtool
- if non-null, the program will also be opened in the given tool. Note: the program will only be added to the tool once even if this method is called multiple times.upgradeIfNeeded
- if true, program will be upgraded if needed and possible. If false, the program will only be upgraded after first prompting the user. In headless mode, it will attempt to upgrade only if the parameter is true.- Returns:
- an opened program with the given consumer for the selected domain file or null if no program was selected.
- Throws:
VersionException
- if the Program is out-of-date from the version of GHIDRA and an upgrade was not been performed. In non-headless mode, the user will have already been notified via a popup dialog. current Ghidra Program version.IOException
- if there is an error accessing the Program's DomainObjectCancelledException
- if the operation is cancelledIllegalArgumentException
- if the name hasn't been defined as a project folder type
-
getProjectFile
Gets the project file (DomainFile
) value for the given name.- Parameters:
name
- the name of a previously defined project file value- Returns:
- the project file value
- Throws:
IllegalArgumentException
- if the name hasn't been defined as a project file type
-
getProjectFolder
Gets the project folder (DomainFolder
) value for the given name.- Parameters:
name
- the name of a previously defined project folder value- Returns:
- the project folder value
- Throws:
IllegalArgumentException
- if the name hasn't been defined as a project folder type
-
setAddress
Sets the address value for the given name.- Parameters:
name
- the name of the Address value that was previously definedaddress
- the address to set as the value- Throws:
IllegalArgumentException
- if the name hasn't been defined as an Address type
-
setLanguage
Sets the Language (LanguageCompilerSpecPair
) value for the given name.- Parameters:
name
- the name of the Language value that was previously definedvalue
- the Language to set as the value- Throws:
IllegalArgumentException
- if the name hasn't been defined as a Language type
-
setProgram
Sets theProgram
value for the given name.- Parameters:
name
- the name of the Program value that was previously definedprogram
- the Program to set as the value- Throws:
IllegalArgumentException
- if the name hasn't been defined as a Program type
-
setProjectFile
Sets the project fileDomainFile
value for the given name.- Parameters:
name
- the name of the project file value that was previously definedfile
- the project file to set as the value- Throws:
IllegalArgumentException
- if the name hasn't been defined as a project file type
-
setProjectFolder
Sets the project folderDomainFolder
value for the given name.- Parameters:
name
- the name of the project folder value that was previously definedfolder
- the project folder to set as the value- Throws:
IllegalArgumentException
- if the name hasn't been defined as a project folder type
-