Package ghidra.features.base.values

# Class LanguageValue

java.lang.Object
docking.widgets.values.AbstractValue<LanguageCompilerSpecPair>
ghidra.features.base.values.LanguageValue

public class LanguageValue extends AbstractValue<LanguageCompilerSpecPair>
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

  Constructors
  Constructor
  Description
  `LanguageValue(String name)`
  Construct a new LanguageVlue with no value
  `LanguageValue(String name, LanguageCompilerSpecPair defaultValue)`
  Construct a new LanguageVlue with a given optional default value.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `LanguageCompilerSpecPair`
  `fromString(String valueString)`
  Parses the given string into a value of type T
  `JComponent`
  `getComponent()`
  Returns a JComponent for entering or editing a value of this type.
  `LanguageCompilerSpecPair`
  `parseLanguageCompileSpecPair(String languageString)`
  Parses a LanguageCompilerSpecPair from a string.
  `protected void`
  `updateComponentFromValue()`
  Updates the JComponent returned from `AbstractValue.getComponent()` to represent the current value of this object.
  `protected void`
  `updateValueFromComponent()`
  Causes the stored value for this object to be updated based on the state of the JComponent returned from `AbstractValue.getComponent()`

  ### Methods inherited from class docking.widgets.values.AbstractValue

  `copyValue, getAsText, getName, getValue, hasValue, reset, setAsText, setValue, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LanguageValue

    public LanguageValue(String name)
    Construct a new LanguageVlue with no value
    Parameters:
      `name` - the name of the value

  - ### LanguageValue

    public LanguageValue(String name, LanguageCompilerSpecPair defaultValue)
    Construct a new LanguageVlue with a given optional default value.
    Parameters:
      `name` - the name of the value
      `defaultValue` - the optional default value

- ## Method Details

  - ### getComponent

    public JComponent getComponent()
    Description copied from class: `AbstractValue`
    Returns a JComponent for entering or editing a value of this type.
    Specified by:
      `getComponent` in class `AbstractValue<LanguageCompilerSpecPair>`
    Returns:
      a JComponent for entering or editing a value of this type.

  - ### updateValueFromComponent

    protected void updateValueFromComponent() throws ValuesMapParseException
    Description copied from class: `AbstractValue`
    Causes the stored value for this object to be updated based on the state of the JComponent returned from `AbstractValue.getComponent()`
    Specified by:
      `updateValueFromComponent` in class `AbstractValue<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 from `AbstractValue.getComponent()` to represent the current value of this object.
    Specified by:
      `updateComponentFromValue` in class `AbstractValue<LanguageCompilerSpecPair>`

  - ### fromString

    public LanguageCompilerSpecPair fromString(String valueString)
    Description copied from class: `AbstractValue`
    Parses the given string into a value of type T
    Specified by:
      `fromString` in class `AbstractValue<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