Package ghidra.framework.options
Class SubOptions
- java.lang.Object
-
- ghidra.framework.options.SubOptions
-
-
Field Summary
-
Fields inherited from interface ghidra.framework.options.Options
DELIMITER, DELIMITER_STRING, ILLEGAL_DELIMITER
-
-
Constructor Summary
Constructors Constructor Description SubOptions(AbstractOptions options, java.lang.String name, java.lang.String prefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(java.lang.String optionName)
Return true if a option exists with the given name.void
createAlias(java.lang.String aliasName, Options otherOptions, java.lang.String optionsName)
Create an alias in this options for an existing option in some other options object.boolean
getBoolean(java.lang.String optionName, boolean defaultValue)
Get the boolean value for the given option name.byte[]
getByteArray(java.lang.String optionName, byte[] defaultValue)
Get the byte array for the given option name.java.util.List<Options>
getChildOptions()
Returns a list of Options objects that are nested one level down from this Options object.java.awt.Color
getColor(java.lang.String optionName, java.awt.Color defaultValue)
Get the Color for the given option name.CustomOption
getCustomOption(java.lang.String optionName, CustomOption defaultValue)
Get the custom option value for the given option name.java.util.Date
getDate(java.lang.String optionName, java.util.Date defaultValue)
Get the Date for the given option name.java.lang.Object
getDefaultValue(java.lang.String optionName)
Returns the default value for the given option.java.lang.String
getDefaultValueAsString(java.lang.String optionName)
Returns the default value as a string for the given option.java.lang.String
getDescription(java.lang.String optionName)
Get the description for the given option name.double
getDouble(java.lang.String optionName, double defaultValue)
Get the double value for the given option name.<T extends java.lang.Enum<T>>
TgetEnum(java.lang.String optionName, T defaultValue)
Get the Enum value for the given option name.java.io.File
getFile(java.lang.String optionName, java.io.File defaultValue)
Get the File for the given option name.float
getFloat(java.lang.String optionName, float defaultValue)
Get the float value for the given option name.java.awt.Font
getFont(java.lang.String optionName, java.awt.Font defaultValue)
Get the Font for the given option name.HelpLocation
getHelpLocation(java.lang.String optionName)
Get the location for where help can be found for the option with the given name.java.lang.String
getID(java.lang.String optionName)
Returns a unique id for option in this options with the given name.int
getInt(java.lang.String optionName, int defaultValue)
Get the int value for the given option name.javax.swing.KeyStroke
getKeyStroke(java.lang.String optionName, javax.swing.KeyStroke defaultValue)
Get the KeyStrokg for the given action name.java.util.List<java.lang.String>
getLeafOptionNames()
Returns a list of option names that immediately fall under this options.long
getLong(java.lang.String optionName, long defaultValue)
Get the long value for the given option name.java.lang.String
getName()
Get the name of this options object.java.lang.Object
getObject(java.lang.String optionName, java.lang.Object defaultValue)
Get the object value; called when the options dialog is being populated.java.util.List<java.lang.String>
getOptionNames()
Get the list of option names.Options
getOptions(java.lang.String path)
Returns a Options object that is a sub-options of this options.OptionsEditor
getOptionsEditor()
Get the editor that will handle editing all the values in this options or sub group of options.HelpLocation
getOptionsHelpLocation()
Returns the HelpLocation for this entire Options object.java.beans.PropertyEditor
getPropertyEditor(java.lang.String optionName)
Get the property editor for the option with the given name.java.beans.PropertyEditor
getRegisteredPropertyEditor(java.lang.String optionName)
Get the property editor that was registered for the specific option with the given name.java.lang.String
getString(java.lang.String optionName, java.lang.String defaultValue)
Get the string value for the given option name.OptionType
getType(java.lang.String optionName)
Returns the OptionType of the given option.java.lang.String
getValueAsString(java.lang.String optionName)
Returns the value as a string for the given option.boolean
isAlias(java.lang.String aliasName)
Returnsboolean
isDefaultValue(java.lang.String optionName)
Returns true if the option with the given name's current value is the default value.boolean
isRegistered(java.lang.String optionName)
Returns true if the specified option has been registered.void
putObject(java.lang.String optionName, java.lang.Object obj)
Put the object value.void
registerOption(java.lang.String optionName, OptionType type, java.lang.Object defaultValue, HelpLocation help, java.lang.String description)
Registers an option with a description, help location, and a optional default value.void
registerOption(java.lang.String optionName, OptionType type, java.lang.Object defaultValue, HelpLocation help, java.lang.String description, java.beans.PropertyEditor editor)
Registers an option with a description, help location, and a optional default value.void
registerOption(java.lang.String optionName, java.lang.Object defaultValue, HelpLocation help, java.lang.String description)
Registers an option with a description, help location, and a default value without specifying the option type.void
registerOptionsEditor(OptionsEditor editor)
Register the options editor that will handle the editing for all the options or a sub group of options.void
removeOption(java.lang.String optionName)
Remove the option name.void
restoreDefaultValue(java.lang.String optionName)
Restores the option denoted by the given name to its default value.void
restoreDefaultValues()
Restores all options contained herein to their default values.void
setBoolean(java.lang.String optionName, boolean value)
Sets the boolean value for the option.void
setByteArray(java.lang.String optionName, byte[] value)
Sets the byte[] value for the given option name.void
setColor(java.lang.String optionName, java.awt.Color value)
Sets the Color value for the optionvoid
setCustomOption(java.lang.String optionName, CustomOption value)
Sets the Custom option value for the option.void
setDate(java.lang.String propertyName, java.util.Date value)
Sets the Date value for the option.void
setDouble(java.lang.String optionName, double value)
Sets the double value for the option.<T extends java.lang.Enum<T>>
voidsetEnum(java.lang.String optionName, T value)
Set the Enum value for the option.void
setFile(java.lang.String optionName, java.io.File value)
Sets the File value for the option.void
setFloat(java.lang.String optionName, float value)
Sets the float value for the option.void
setFont(java.lang.String optionName, java.awt.Font value)
Sets the Font value for the optionvoid
setInt(java.lang.String optionName, int value)
Sets the int value for the option.void
setKeyStroke(java.lang.String optionName, javax.swing.KeyStroke value)
Sets the KeyStroke value for the optionvoid
setLong(java.lang.String optionName, long value)
Sets the long value for the option.void
setOptionsHelpLocation(HelpLocation helpLocation)
Set the location for where help can be found for this entire options object.void
setString(java.lang.String optionName, java.lang.String value)
Set the String value for the option.java.lang.String
toString()
-
-
-
Constructor Detail
-
SubOptions
public SubOptions(AbstractOptions options, java.lang.String name, java.lang.String prefix)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:Options
Get the name of this options object.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getPropertyEditor
public java.beans.PropertyEditor getPropertyEditor(java.lang.String optionName)
Description copied from interface:Options
Get the property editor for the option with the given name. Note: This method must be called from the swing thread.- Specified by:
getPropertyEditor
in interfaceOptions
- Returns:
- either the PropertyEditor that was registered for this option or a default editor for the property type if one can be found; otherwise null.
-
getRegisteredPropertyEditor
public java.beans.PropertyEditor getRegisteredPropertyEditor(java.lang.String optionName)
Description copied from interface:Options
Get the property editor that was registered for the specific option with the given name. Unlike the getPropertyEditor() method, this method does not have to be called from the swing thread- Specified by:
getRegisteredPropertyEditor
in interfaceOptions
- Returns:
- the PropertyEditor that was registered for this option.
-
getChildOptions
public java.util.List<Options> getChildOptions()
Description copied from interface:Options
Returns a list of Options objects that are nested one level down from this Options object.- Specified by:
getChildOptions
in interfaceOptions
- Returns:
- a list of Options objects that are nested one level down from this Options object.
-
getHelpLocation
public HelpLocation getHelpLocation(java.lang.String optionName)
Description copied from interface:Options
Get the location for where help can be found for the option with the given name.- Specified by:
getHelpLocation
in interfaceOptions
- Parameters:
optionName
- name of the option- Returns:
- null if the help location was not set on the option
-
registerOption
public void registerOption(java.lang.String optionName, java.lang.Object defaultValue, HelpLocation help, java.lang.String description)
Description copied from interface:Options
Registers an option with a description, help location, and a default value without specifying the option type. This form requires that the default value not be null so that the option type can be inferred from the default value.- Specified by:
registerOption
in interfaceOptions
- Parameters:
optionName
- the name of the option being registered.defaultValue
- the defaultValue for the option. The default value must not be null so that the OptionType can be determined. If the default value should be null, useOptions.registerOption(String, OptionType, Object, HelpLocation, String)
help
- the HelpLocation for this option.description
- a description of the option.
-
registerOption
public void registerOption(java.lang.String optionName, OptionType type, java.lang.Object defaultValue, HelpLocation help, java.lang.String description)
Description copied from interface:Options
Registers an option with a description, help location, and a optional default value. With an optional default value, an OptionType must be passed as it is otherwise derived from the default value.- Specified by:
registerOption
in interfaceOptions
- Parameters:
optionName
- the name of the option being registered.type
- the OptionType for this options.defaultValue
- the defaultValue for the option. In this version of the method, the default value may be null.help
- the HelpLocation for this option.description
- a description of the option.
-
registerOption
public void registerOption(java.lang.String optionName, OptionType type, java.lang.Object defaultValue, HelpLocation help, java.lang.String description, java.beans.PropertyEditor editor)
Description copied from interface:Options
Registers an option with a description, help location, and a optional default value. With an optional default value, an OptionType must be passed as it is otherwise derived from the default value.- Specified by:
registerOption
in interfaceOptions
- Parameters:
optionName
- the name of the option being registered.type
- the OptionType for this options.defaultValue
- the defaultValue for the option. In this version of the method, the default value may be null.help
- the HelpLocation for this option.description
- a description of the option.editor
- an optional custom editor for this property. Note if the option is a custom option, then the property editor can't be null;
-
putObject
public void putObject(java.lang.String optionName, java.lang.Object obj)
Description copied from interface:Options
Put the object value. If the option exists, the type must match the type of the existing object.
-
getObject
public java.lang.Object getObject(java.lang.String optionName, java.lang.Object defaultValue)
Description copied from interface:Options
Get the object value; called when the options dialog is being populated.
-
getBoolean
public boolean getBoolean(java.lang.String optionName, boolean defaultValue)
Description copied from interface:Options
Get the boolean value for the given option name.- Specified by:
getBoolean
in interfaceOptions
- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name.- Returns:
- boolean option value
-
getByteArray
public byte[] getByteArray(java.lang.String optionName, byte[] defaultValue)
Description copied from interface:Options
Get the byte array for the given option name.- Specified by:
getByteArray
in interfaceOptions
- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- byte[] byte array value
-
getInt
public int getInt(java.lang.String optionName, int defaultValue)
Description copied from interface:Options
Get the int value for the given option name.
-
getDouble
public double getDouble(java.lang.String optionName, double defaultValue)
Description copied from interface:Options
Get the double value for the given option name.
-
getFloat
public float getFloat(java.lang.String optionName, float defaultValue)
Description copied from interface:Options
Get the float value for the given option name.
-
getLong
public long getLong(java.lang.String optionName, long defaultValue)
Description copied from interface:Options
Get the long value for the given option name.
-
getCustomOption
public CustomOption getCustomOption(java.lang.String optionName, CustomOption defaultValue)
Description copied from interface:Options
Get the custom option value for the given option name.- Specified by:
getCustomOption
in interfaceOptions
- Parameters:
optionName
- option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- WrappedOption value for the option
-
getColor
public java.awt.Color getColor(java.lang.String optionName, java.awt.Color defaultValue)
Description copied from interface:Options
Get the Color for the given option name.
-
getFile
public java.io.File getFile(java.lang.String optionName, java.io.File defaultValue)
Description copied from interface:Options
Get the File for the given option name.
-
getFont
public java.awt.Font getFont(java.lang.String optionName, java.awt.Font defaultValue)
Description copied from interface:Options
Get the Font for the given option name.
-
getKeyStroke
public javax.swing.KeyStroke getKeyStroke(java.lang.String optionName, javax.swing.KeyStroke defaultValue)
Description copied from interface:Options
Get the KeyStrokg for the given action name.- Specified by:
getKeyStroke
in interfaceOptions
- Parameters:
optionName
- the option namedefaultValue
- value that is stored and returned if there is no option with the given name- Returns:
- KeyStroke option
-
getString
public java.lang.String getString(java.lang.String optionName, java.lang.String defaultValue)
Description copied from interface:Options
Get the string value for the given option name.
-
getEnum
public <T extends java.lang.Enum<T>> T getEnum(java.lang.String optionName, T defaultValue)
Description copied from interface:Options
Get the Enum value for the given option name.
-
setLong
public void setLong(java.lang.String optionName, long value)
Description copied from interface:Options
Sets the long value for the option.
-
setBoolean
public void setBoolean(java.lang.String optionName, boolean value)
Description copied from interface:Options
Sets the boolean value for the option.- Specified by:
setBoolean
in interfaceOptions
- Parameters:
optionName
- name of the optionvalue
- value of the option
-
setInt
public void setInt(java.lang.String optionName, int value)
Description copied from interface:Options
Sets the int value for the option.
-
setDouble
public void setDouble(java.lang.String optionName, double value)
Description copied from interface:Options
Sets the double value for the option.
-
setFloat
public void setFloat(java.lang.String optionName, float value)
Description copied from interface:Options
Sets the float value for the option.
-
setCustomOption
public void setCustomOption(java.lang.String optionName, CustomOption value)
Description copied from interface:Options
Sets the Custom option value for the option.- Specified by:
setCustomOption
in interfaceOptions
- Parameters:
optionName
- name of the option
-
setByteArray
public void setByteArray(java.lang.String optionName, byte[] value)
Description copied from interface:Options
Sets the byte[] value for the given option name.- Specified by:
setByteArray
in interfaceOptions
- Parameters:
optionName
- the name of the option on which to save bytes.
-
setFile
public void setFile(java.lang.String optionName, java.io.File value)
Description copied from interface:Options
Sets the File value for the option.
-
setColor
public void setColor(java.lang.String optionName, java.awt.Color value)
Description copied from interface:Options
Sets the Color value for the option
-
setFont
public void setFont(java.lang.String optionName, java.awt.Font value)
Description copied from interface:Options
Sets the Font value for the option
-
setKeyStroke
public void setKeyStroke(java.lang.String optionName, javax.swing.KeyStroke value)
Description copied from interface:Options
Sets the KeyStroke value for the option- Specified by:
setKeyStroke
in interfaceOptions
- Parameters:
optionName
- name of the optionvalue
- KeyStroke to set
-
setString
public void setString(java.lang.String optionName, java.lang.String value)
Description copied from interface:Options
Set the String value for the option.
-
setEnum
public <T extends java.lang.Enum<T>> void setEnum(java.lang.String optionName, T value)
Description copied from interface:Options
Set the Enum value for the option.
-
removeOption
public void removeOption(java.lang.String optionName)
Description copied from interface:Options
Remove the option name.- Specified by:
removeOption
in interfaceOptions
- Parameters:
optionName
- name of option to remove
-
getOptionNames
public java.util.List<java.lang.String> getOptionNames()
Description copied from interface:Options
Get the list of option names. This method will return the names (paths) of all options contained in this options object or below. For example, if the options has ("aaa", "bbb", "ccc.ddd"), all three will be returned. theOptions.getLeafOptionNames()
method will return only the "aaa" and "bbb" names.- Specified by:
getOptionNames
in interfaceOptions
- Returns:
- the list of all option names(paths) under this options.
-
contains
public boolean contains(java.lang.String optionName)
Description copied from interface:Options
Return true if a option exists with the given name.
-
getDescription
public java.lang.String getDescription(java.lang.String optionName)
Description copied from interface:Options
Get the description for the given option name.- Specified by:
getDescription
in interfaceOptions
- Parameters:
optionName
- name of the option- Returns:
- null if the description or option name does not exist
-
isRegistered
public boolean isRegistered(java.lang.String optionName)
Description copied from interface:Options
Returns true if the specified option has been registered. Only registered names are saved.- Specified by:
isRegistered
in interfaceOptions
-
isDefaultValue
public boolean isDefaultValue(java.lang.String optionName)
Description copied from interface:Options
Returns true if the option with the given name's current value is the default value.- Specified by:
isDefaultValue
in interfaceOptions
- Parameters:
optionName
- the name of the option.- Returns:
- true if the options has its current value equal to its default value.
-
restoreDefaultValues
public void restoreDefaultValues()
Description copied from interface:Options
Restores all options contained herein to their default values.- Specified by:
restoreDefaultValues
in interfaceOptions
- See Also:
Options.restoreDefaultValue(String)
-
restoreDefaultValue
public void restoreDefaultValue(java.lang.String optionName)
Description copied from interface:Options
Restores the option denoted by the given name to its default value.- Specified by:
restoreDefaultValue
in interfaceOptions
- Parameters:
optionName
- The name of the option to restore- See Also:
Options.restoreDefaultValues()
-
getType
public OptionType getType(java.lang.String optionName)
Description copied from interface:Options
Returns the OptionType of the given option.
-
getOptions
public Options getOptions(java.lang.String path)
Description copied from interface:Options
Returns a Options object that is a sub-options of this options.- Specified by:
getOptions
in interfaceOptions
- Parameters:
path
- the path for the sub-options object.- Returns:
- a Options object that is a sub-options of this options.
-
setOptionsHelpLocation
public void setOptionsHelpLocation(HelpLocation helpLocation)
Description copied from interface:Options
Set the location for where help can be found for this entire options object.- Specified by:
setOptionsHelpLocation
in interfaceOptions
- Parameters:
helpLocation
- location for help on the option
-
getOptionsHelpLocation
public HelpLocation getOptionsHelpLocation()
Description copied from interface:Options
Returns the HelpLocation for this entire Options object.- Specified by:
getOptionsHelpLocation
in interfaceOptions
- Returns:
- the HelpLocation for this entire Options object.
-
registerOptionsEditor
public void registerOptionsEditor(OptionsEditor editor)
Description copied from interface:Options
Register the options editor that will handle the editing for all the options or a sub group of options.- Specified by:
registerOptionsEditor
in interfaceOptions
- Parameters:
editor
- the custom editor panel to be used to edit the options or sub group of options.
-
getOptionsEditor
public OptionsEditor getOptionsEditor()
Description copied from interface:Options
Get the editor that will handle editing all the values in this options or sub group of options.- Specified by:
getOptionsEditor
in interfaceOptions
- Returns:
- null if no options editor was registered
-
createAlias
public void createAlias(java.lang.String aliasName, Options otherOptions, java.lang.String optionsName)
Description copied from interface:Options
Create an alias in this options for an existing option in some other options object.- Specified by:
createAlias
in interfaceOptions
- Parameters:
aliasName
- the name within this options object that will acutally refer to some other options object.otherOptions
- the options object that has the actual option.optionsName
- the name within the given options object of the actual option.
-
isAlias
public boolean isAlias(java.lang.String aliasName)
Description copied from interface:Options
Returns
-
getDate
public java.util.Date getDate(java.lang.String optionName, java.util.Date defaultValue)
Description copied from interface:Options
Get the Date for the given option name.
-
setDate
public void setDate(java.lang.String propertyName, java.util.Date value)
Description copied from interface:Options
Sets the Date value for the option.
-
getDefaultValue
public java.lang.Object getDefaultValue(java.lang.String optionName)
Description copied from interface:Options
Returns the default value for the given option.- Specified by:
getDefaultValue
in interfaceOptions
- Parameters:
optionName
- the name of the option for which to retrieve the default value.- Returns:
- the default value for the given option.
-
getValueAsString
public java.lang.String getValueAsString(java.lang.String optionName)
Description copied from interface:Options
Returns the value as a string for the given option.- Specified by:
getValueAsString
in interfaceOptions
- Returns:
- the value as a string for the given option.
-
getDefaultValueAsString
public java.lang.String getDefaultValueAsString(java.lang.String optionName)
Description copied from interface:Options
Returns the default value as a string for the given option.- Specified by:
getDefaultValueAsString
in interfaceOptions
- Returns:
- the default value as a string for the given option.
-
getID
public java.lang.String getID(java.lang.String optionName)
Description copied from interface:Options
Returns a unique id for option in this options with the given name. This will be the full path name to the root options object.
-
getLeafOptionNames
public java.util.List<java.lang.String> getLeafOptionNames()
Description copied from interface:Options
Returns a list of option names that immediately fall under this options. For example, if this options object had the following options named ("a", "b", "c.d"), only "a" and "b" would be returned. The "c.d" leaf option name could be returned by getOptions("c").getLeafOptionNames()- Specified by:
getLeafOptionNames
in interfaceOptions
- Returns:
- the list of the names of the options that are immediate children of this options object.
-
-