Package ghidra.framework.plugintool.mgr
Class OptionsManager
java.lang.Object
ghidra.framework.plugintool.mgr.OptionsManager
- All Implemented Interfaces:
OptionsService
,OptionsChangeListener
Created by PluginTool to manage the set of Options for each category.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deregisterOwner
(Plugin ownerPlugin) Deregister the owner from the options; if options are empty, then remove the options from the map.void
dispose()
void
org.jdom.Element
Write this object out; first remove any unused options so they do not hang around.Get the list of options for all categories.getOptions
(String category) Get the options for the given category name.boolean
hasOptions
(String category) Return whether an Options object exists for the given category.void
optionsChanged
(ToolOptions options, String name, Object oldValue, Object newValue) Notification that an option changed.void
registerOptionNameChanged
(String oldName, String newName) Updates saved options from an old name to a new name.void
void
setConfigState
(org.jdom.Element root) Restore Options objects using the given XML Element.void
showOptionsDialog
(String category, String filterText) Shows Options Dialog with the node denoted by "category" being displayed.void
-
Constructor Details
-
OptionsManager
Constructor- Parameters:
tool
- associated with this OptionsManager
-
-
Method Details
-
dispose
public void dispose() -
getOptions
Description copied from interface:OptionsService
Get the options for the given category name. If no options exist with the given name, then a new options object is created.Note: the given name should not contains options path separator characters. Any sub-options needed must be retrieved from the ToolOptions object returned from this method.
- Specified by:
getOptions
in interfaceOptionsService
- Parameters:
category
- name of category- Returns:
- the options for the given category name.
-
registerOptionNameChanged
Updates saved options from an old name to a new name. NOTE: this must be called before any calls to register or get options.- Parameters:
oldName
- the old name of the options.newName
- the new name of the options.
-
hasOptions
Description copied from interface:OptionsService
Return whether an Options object exists for the given category.- Specified by:
hasOptions
in interfaceOptionsService
- Parameters:
category
- name of the category- Returns:
- true if an Options object exists
-
showOptionsDialog
Description copied from interface:OptionsService
Shows Options Dialog with the node denoted by "category" being displayed. The value is expected to be the name of a node in the options tree, residing under the root node. You may also provide the name of such a node, followed by the options delimiter, followed by the name of a child node under that node. For example, suppose in the options tree exists a node Root->Foo You may pass the value "Foo" to get that node. Or, suppose in the options tree exists a node Root->Foo->childNode1 In this case, you may pass the value "Foo.childNode1", where the '.' character is the delimiter of theToolOptions
class (this is the value at the time of writing this documentation).The filter text parameter is used to set the contents filter text of the options. You may use this parameter to filter the tree; for example, to show only the node in the tree that you want the user to see.
- Specified by:
showOptionsDialog
in interfaceOptionsService
- Parameters:
category
- The category of options to have displayedfilterText
- An optional value used to filter the nodes visible in the options tree. You may passnull
or the empty string""
here if you do not desire filtering.
-
getOptions
Description copied from interface:OptionsService
Get the list of options for all categories.- Specified by:
getOptions
in interfaceOptionsService
- Returns:
- the list of options for all categories.
-
deregisterOwner
Deregister the owner from the options; if options are empty, then remove the options from the map.- Parameters:
ownerPlugin
- the owner plugin
-
getConfigState
public org.jdom.Element getConfigState()Write this object out; first remove any unused options so they do not hang around.- Returns:
- XML element containing the state of all the options
-
removeUnusedOptions
public void removeUnusedOptions() -
setConfigState
public void setConfigState(org.jdom.Element root) Restore Options objects using the given XML Element.- Parameters:
root
- element to use to restore the Options objects
-
editOptions
public void editOptions() -
validateOptions
public void validateOptions() -
optionsChanged
Description copied from interface:OptionsChangeListener
Notification that an option changed.Note: to reject an options change, you can throw a
OptionsVetoException
.- Specified by:
optionsChanged
in interfaceOptionsChangeListener
- Parameters:
options
- options object containing the property that changedname
- name of option that changedoldValue
- old value of the optionnewValue
- new value of the option
-