Package ghidra.features.base.values
Class LanguageValue
java.lang.Object
docking.widgets.values.AbstractValue<LanguageCompilerSpecPair>
ghidra.features.base.values.LanguageValue
Value class for LanguageCompilerSpecPair types. The component for this class is a
TextField with a browse button for bringing up a language/compiler chooser. It supports
the concept of no value when the text field is empty. If it is not empty, the the contents
must be one of the known valid language/compiler spec pairs.
This class and other subclasses of AbstractValue
are part of a subsystem for easily
defining a set of values that can be displayed in an input dialog (ValuesMapDialog
).
Typically, these values are created indirectly using a GValuesMap
which is then
given to the constructor of the dialog. However, an alternate approach is to create the
dialog without a ValuesMap and then use its ValuesMapDialog.addValue(AbstractValue)
method directly.
-
Constructor Summary
ConstructorDescriptionLanguageValue
(String name) Construct a new LanguageVlue with no valueLanguageValue
(String name, LanguageCompilerSpecPair defaultValue) Construct a new LanguageVlue with a given optional default value. -
Method Summary
Modifier and TypeMethodDescriptionfromString
(String valueString) Parses the given string into a value of type TReturns a JComponent for entering or editing a value of this type.parseLanguageCompileSpecPair
(String languageString) Parses a LanguageCompilerSpecPair from a string.protected void
Updates the JComponent returned fromAbstractValue.getComponent()
to represent the current value of this object.protected void
Causes the stored value for this object to be updated based on the state of the JComponent returned fromAbstractValue.getComponent()
-
Constructor Details
-
LanguageValue
Construct a new LanguageVlue with no value- Parameters:
name
- the name of the value
-
LanguageValue
Construct a new LanguageVlue with a given optional default value.- Parameters:
name
- the name of the valuedefaultValue
- the optional default value
-
-
Method Details
-
getComponent
Description copied from class:AbstractValue
Returns a JComponent for entering or editing a value of this type.- Specified by:
getComponent
in classAbstractValue<LanguageCompilerSpecPair>
- Returns:
- a JComponent for entering or editing a value of this type.
-
updateValueFromComponent
Description copied from class:AbstractValue
Causes the stored value for this object to be updated based on the state of the JComponent returned fromAbstractValue.getComponent()
- Specified by:
updateValueFromComponent
in classAbstractValue<LanguageCompilerSpecPair>
- Throws:
ValuesMapParseException
- if an error occurs trying update the value from a component. This usually is a result of trying to parse a string value.
-
updateComponentFromValue
protected void updateComponentFromValue()Description copied from class:AbstractValue
Updates the JComponent returned fromAbstractValue.getComponent()
to represent the current value of this object.- Specified by:
updateComponentFromValue
in classAbstractValue<LanguageCompilerSpecPair>
-
fromString
Description copied from class:AbstractValue
Parses the given string into a value of type T- Specified by:
fromString
in classAbstractValue<LanguageCompilerSpecPair>
- Parameters:
valueString
- the string to parse- Returns:
- a value of type T
-
parseLanguageCompileSpecPair
public LanguageCompilerSpecPair parseLanguageCompileSpecPair(String languageString) throws ValuesMapParseException Parses a LanguageCompilerSpecPair from a string.- Parameters:
languageString
- The string to parse.- Returns:
- The LanguageCompilerSpecPair parsed from a string or null if the string does not parse to a known language-compiler pair.
- Throws:
ValuesMapParseException
- if the value can't be parsed into a LanguageComilerSpecPair
-