Package ghidra.framework.options
Class ToolOptions
- java.lang.Object
-
- ghidra.framework.options.AbstractOptions
-
- ghidra.framework.options.ToolOptions
-
- All Implemented Interfaces:
Options
public class ToolOptions extends AbstractOptions
Class to manage a set of option name/value pairs for a category.The values may be primitives or
WrappedOptions that are containers for primitive components.The name/value pair has an owner so that the option name can be removed from the Options object when it is no longer being used.
Note: Property Names can have
Options.DELIMITERcharacters to create a hierarchy. So too can sub-options accessed viaAbstractOptions.getOptions(String).The Options Dialog shows the delimited hierarchy in tree format.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ghidra.framework.options.AbstractOptions
AbstractOptions.AliasBinding
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<java.lang.Class<?>>PRIMITIVE_CLASSESstatic java.util.Set<java.lang.Class<?>>WRAPPABLE_CLASSESstatic java.lang.StringXML_ELEMENT_NAME-
Fields inherited from class ghidra.framework.options.AbstractOptions
aliasMap, categoryHelpMap, listeners, name, optionsEditorMap, SUPPORTED_CLASSES, valueMap
-
Fields inherited from interface ghidra.framework.options.Options
DELIMITER, DELIMITER_STRING, ILLEGAL_DELIMITER
-
-
Constructor Summary
Constructors Constructor Description ToolOptions(java.lang.String name)ToolOptions(org.jdom.Element root)Construct a new Options object from the given XML element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOptionsChangeListener(OptionsChangeListener l)Add the options change listener.ToolOptionscopy()voidcopyOptions(Options newOptions)Adds all the options name/value pairs to this Options.protected OptioncreateRegisteredOption(java.lang.String optionName, OptionType type, java.lang.String description, HelpLocation help, java.lang.Object defaultValue, java.beans.PropertyEditor editor)protected OptioncreateUnregisteredOption(java.lang.String optionName, OptionType type, java.lang.Object defaultValue)booleanequals(java.lang.Object obj)org.jdom.ElementgetXmlRoot(boolean includeDefaultBindings)Return an XML element for the option names and values.inthashCode()protected booleannotifyOptionChanged(java.lang.String optionName, java.lang.Object oldValue, java.lang.Object newValue)voidregisterOptions(ToolOptions oldOptions)voidremoveOptionsChangeListener(OptionsChangeListener l)Remove the options change listener.voidremoveUnusedOptions()Check each option to ensure that an owner is still registered for it; if there is no owner, then remove the option.voidtakeListeners(ToolOptions oldOptions)voidvalidateOptions()-
Methods inherited from class ghidra.framework.options.AbstractOptions
contains, createAlias, dispose, findPropertyEditor, getBoolean, getByteArray, getCategoryHelpLocation, getChildOptions, getColor, getCustomOption, getDate, getDefaultValue, getDefaultValueAsString, getDescription, getDouble, getEnum, getFile, getFloat, getFont, getHelpLocation, getID, getInt, getKeyStroke, getLeafOptionNames, getLong, getName, getObject, getOption, getOptionNames, getOptions, getOptionsEditor, getOptionsEditor, getOptionsHelpLocation, getPropertyEditor, getRegisteredPropertyEditor, getString, getType, getValueAsString, isAlias, isDefaultValue, isRegistered, putObject, putObject, registerOption, registerOption, registerOption, registerOptionsEditor, registerOptionsEditor, removeOption, restoreDefaultValue, restoreDefaultValues, setBoolean, setByteArray, setCategoryHelpLocation, setColor, setCustomOption, setDate, setDouble, setEnum, setFile, setFloat, setFont, setInt, setKeyStroke, setLong, setName, setOptionsHelpLocation, setString, toString
-
-
-
-
Field Detail
-
PRIMITIVE_CLASSES
public static final java.util.Set<java.lang.Class<?>> PRIMITIVE_CLASSES
-
WRAPPABLE_CLASSES
public static final java.util.Set<java.lang.Class<?>> WRAPPABLE_CLASSES
-
XML_ELEMENT_NAME
public static final java.lang.String XML_ELEMENT_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
copy
public ToolOptions copy()
-
getXmlRoot
public org.jdom.Element getXmlRoot(boolean includeDefaultBindings)
Return an XML element for the option names and values. Note: only those options which have been explicitly set will be included.- Parameters:
includeDefaultBindings- true to include default key binding values in the xml- Returns:
- the xml root element
-
addOptionsChangeListener
public void addOptionsChangeListener(OptionsChangeListener l)
Add the options change listener. NOTE: The Options uses WeakReferences to manage the listeners; this means that you must supply a listener and maintain a handle to it, or else the listener will be garbage collected and will never get called. So for this reason, do not create the listener in an anonymous inner class.- Parameters:
l- listener to add
-
takeListeners
public void takeListeners(ToolOptions oldOptions)
-
removeOptionsChangeListener
public void removeOptionsChangeListener(OptionsChangeListener l)
Remove the options change listener.- Parameters:
l- listener to remove
-
removeUnusedOptions
public void removeUnusedOptions()
Check each option to ensure that an owner is still registered for it; if there is no owner, then remove the option.
-
copyOptions
public void copyOptions(Options newOptions)
Adds all the options name/value pairs to this Options.- Parameters:
newOptions- the new options into which the current options values will be placed
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
validateOptions
public void validateOptions()
-
registerOptions
public void registerOptions(ToolOptions oldOptions)
-
createRegisteredOption
protected Option createRegisteredOption(java.lang.String optionName, OptionType type, java.lang.String description, HelpLocation help, java.lang.Object defaultValue, java.beans.PropertyEditor editor)
- Specified by:
createRegisteredOptionin classAbstractOptions
-
createUnregisteredOption
protected Option createUnregisteredOption(java.lang.String optionName, OptionType type, java.lang.Object defaultValue)
- Specified by:
createUnregisteredOptionin classAbstractOptions
-
notifyOptionChanged
protected boolean notifyOptionChanged(java.lang.String optionName, java.lang.Object oldValue, java.lang.Object newValue)- Specified by:
notifyOptionChangedin classAbstractOptions
-
-