Package ghidra.features.base.values

# Class ProjectFileValue

java.lang.Object
docking.widgets.values.AbstractValue<DomainFile>
ghidra.features.base.values.ProjectFileValue

Direct Known Subclasses:
  `ProgramFileValue`

public class ProjectFileValue extends AbstractValue<DomainFile>
Value class for project files (`DomainFile`). The editor component consists of a `JTextField` and a browse button for bringing up a `DataTreeDialog` for picking project files from the current project.

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
  `ProjectFileValue(String name)`
  Constructor for creating a new ProjectFileValue with the given name.
  `ProjectFileValue(String name, Project project, String startingPath, Class<? extends DomainObject> projectFileClass)`
  Constructor for ProgramValue when wanting to pick from a different project than the active project, such as a read-only project.
  `ProjectFileValue(String name, Class<? extends DomainObject> projectFileClass)`
  Constructor for creating a new ProgramFileValue with the given name and `DomainObject` class to filter on (All other types will be filtered out in the chooser).
  `ProjectFileValue(String name, String startingPath)`
  Constructor for creating a new ProjectFileValue with the given name and a starting folder when using the project file chooser.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected DomainFile`
  `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.
  `protected String`
  `toString(DomainFile v)`
  `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`

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

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

- ## Constructor Details

  - ### ProjectFileValue

    public ProjectFileValue(String name)
    Constructor for creating a new ProjectFileValue with the given name.
    Parameters:
      `name` - the name of the value

  - ### ProjectFileValue

    public ProjectFileValue(String name, Class<? extends DomainObject> projectFileClass)
    Constructor for creating a new ProgramFileValue with the given name and `DomainObject` class to filter on (All other types will be filtered out in the chooser).
    Parameters:
      `name` - the name of the value
      `projectFileClass` - the DomainObject class to filter

  - ### ProjectFileValue

    public ProjectFileValue(String name, String startingPath)
    Constructor for creating a new ProjectFileValue with the given name and a starting folder when using the project file chooser.
    Parameters:
      `name` - the name of the value
      `startingPath` - the path to a starting folder

  - ### ProjectFileValue

    public ProjectFileValue(String name, Project project, String startingPath, Class<? extends DomainObject> projectFileClass)
    Constructor for ProgramValue when wanting to pick from a different project than the active project, such as a read-only project.
    Parameters:
      `name` - the name of the value
      `project` - The project from which to pick a project.
      `startingPath` - the path to a starting folder (Can also be a path to program)
      `projectFileClass` - a `DomainFile` class to filter on. (Only those types will appear in the chooser)

- ## 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<DomainFile>`
    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<DomainFile>`
    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<DomainFile>`

  - ### fromString

    protected DomainFile fromString(String valueString)
    Description copied from class: `AbstractValue`
    Parses the given string into a value of type T
    Specified by:
      `fromString` in class `AbstractValue<DomainFile>`
    Parameters:
      `valueString` - the string to parse
    Returns:
      a value of type T

  - ### toString

    protected String toString(DomainFile v)
    Overrides:
      `toString` in class `AbstractValue<DomainFile>`