Class ListingModelConverter

java.lang.Object
ghidra.app.util.viewer.multilisting.ListingModelConverter
All Implemented Interfaces:
ListingModel

public class ListingModelConverter extends Object implements ListingModel
  • Constructor Details

    • ListingModelConverter

      public ListingModelConverter(ListingModel primaryModel, ListingModel model)
      Converts addresses from the primary model into addresses for this converters model.
      Parameters:
      primaryModel - the primary model
      model - this converter's model
  • Method Details

    • addListener

      public void addListener(ListingModelListener listener)
      Description copied from interface: ListingModel
      Adds a listener for changes to this model.
      Specified by:
      addListener in interface ListingModel
      Parameters:
      listener - the listener to be notified
    • dispose

      public void dispose()
      Description copied from interface: ListingModel
      Disposes this model
      Specified by:
      dispose in interface ListingModel
    • getAddressAfter

      public Address getAddressAfter(Address primaryModelAddress)
      Description copied from interface: ListingModel
      Returns the next address that has displayable information after the given address. This allows the listing to efficiently skip over large sections of undisplayable addresses such as those consumed by large data or addresses part of a closed function.
      Specified by:
      getAddressAfter in interface ListingModel
      Parameters:
      primaryModelAddress - the address from which to find the next address with displayable information
      Returns:
      the next address with displayable information
    • getAddressBefore

      public Address getAddressBefore(Address primaryModelAddress)
      Description copied from interface: ListingModel
      Returns the previous address that has displayable information before the given address. This allows the listing to efficiently skip over large sections of undisplayable addresses such as those consumed by large data or addresses part of a closed function.
      Specified by:
      getAddressBefore in interface ListingModel
      Parameters:
      primaryModelAddress - the address from which to find the previous address with displayable information
      Returns:
      the previous address with displayable information
    • getAddressSet

      public AddressSetView getAddressSet()
      Description copied from interface: ListingModel
      Returns the address set of all addresses in the model.
      Specified by:
      getAddressSet in interface ListingModel
      Returns:
      the address set of all addresses in the model
    • getLayout

      public Layout getLayout(Address primaryAddress, boolean isGapAddress)
      Description copied from interface: ListingModel
      Returns a layout with displayable information for the given address.
      Specified by:
      getLayout in interface ListingModel
      Parameters:
      primaryAddress - the address to get displayable information
      isGapAddress - true implies there is a gap of missing addresses before this address. Note that this is different from addresses that are hidden due to collapsed functions or closed data. These gaps are not even in consideration to display information such as undefined memory or a fragmented program view.
      Returns:
      a Layout with information to be displayed for the given address.
    • getMaxWidth

      public int getMaxWidth()
      Description copied from interface: ListingModel
      Returns the width of the longest layout this model can produce..
      Specified by:
      getMaxWidth in interface ListingModel
      Returns:
      the width of the longest layout this model can produce.
    • getProgram

      public Program getProgram()
      Description copied from interface: ListingModel
      Returns the program being displayed by this model..
      Specified by:
      getProgram in interface ListingModel
      Returns:
      the program being displayed by this model.
    • isClosed

      public boolean isClosed()
      Description copied from interface: ListingModel
      Returns true if the program being displayed by this listing has been closed (and therefor the model is invalid.).
      Specified by:
      isClosed in interface ListingModel
      Returns:
      true if the program being displayed by this listing has been closed (and therefor the model is invalid.)
    • isOpen

      public boolean isOpen(Data data)
      Description copied from interface: ListingModel
      Returns true if the data is open
      Specified by:
      isOpen in interface ListingModel
      Parameters:
      data - the data to check
      Returns:
      true if the data is open
    • openData

      public boolean openData(Data data)
      Description copied from interface: ListingModel
      Opens the given data, but not any sub-components.
      Specified by:
      openData in interface ListingModel
      Parameters:
      data - the data to open
      Returns:
      true if the data was opened (will return false if the data is already open or has no children)
    • openAllData

      public void openAllData(Data data, TaskMonitor monitor)
      Description copied from interface: ListingModel
      Recursively open the given data and its sub-components.
      Specified by:
      openAllData in interface ListingModel
      Parameters:
      data - the data to open
      monitor - the task monitor
    • openAllData

      public void openAllData(AddressSetView addresses, TaskMonitor monitor)
      Description copied from interface: ListingModel
      Opens all data found within the given addresses. Each data is fully opened.
      Specified by:
      openAllData in interface ListingModel
      Parameters:
      addresses - the range of addresses to search for data
      monitor - the task monitor
    • closeData

      public void closeData(Data data)
      Description copied from interface: ListingModel
      Closes the given data, but not any sub-components.
      Specified by:
      closeData in interface ListingModel
      Parameters:
      data - the data to close
    • closeAllData

      public void closeAllData(Data data, TaskMonitor monitor)
      Description copied from interface: ListingModel
      Recursively close the given data and its sub-components.
      Specified by:
      closeAllData in interface ListingModel
      Parameters:
      data - the data to close
      monitor - the task monitor
    • closeAllData

      public void closeAllData(AddressSetView addresses, TaskMonitor monitor)
      Description copied from interface: ListingModel
      Closes all data found within the given addresses. Each data is fully closed.
      Specified by:
      closeAllData in interface ListingModel
      Parameters:
      addresses - the range of addresses to search for data
      monitor - the task monitor
    • removeListener

      public void removeListener(ListingModelListener listener)
      Description copied from interface: ListingModel
      Removes a listener from those being notified of model changes.
      Specified by:
      removeListener in interface ListingModel
      Parameters:
      listener - the listener to be removed
    • setFormatManager

      public void setFormatManager(FormatManager formatManager)
      Description copied from interface: ListingModel
      Sets the FormatManager for this model which determines the layout of the fields.
      Specified by:
      setFormatManager in interface ListingModel
      Parameters:
      formatManager - the new FormatManager to use
    • toggleOpen

      public void toggleOpen(Data data)
      Description copied from interface: ListingModel
      Changes the open state of the given data (open -> closes; closed-> open).
      Specified by:
      toggleOpen in interface ListingModel
      Parameters:
      data - the data to open
    • setFunctionVariablesOpen

      public void setFunctionVariablesOpen(Address functionAddress, boolean open)
      Description copied from interface: ListingModel
      Sets whether or not to display function variables for the function at the given address.
      Specified by:
      setFunctionVariablesOpen in interface ListingModel
      Parameters:
      functionAddress - the address of the function
      open - if true, the variables are displayed, otherwise they are hidden
    • setAllFunctionVariablesOpen

      public void setAllFunctionVariablesOpen(boolean open)
      Description copied from interface: ListingModel
      Sets the display of variables for all functions. This basically sets the default state, but the state can be overridden for individual functions. Changing this value erases all individually set values.
      Specified by:
      setAllFunctionVariablesOpen in interface ListingModel
      Parameters:
      open - if true, show function variables
    • areFunctionVariablesOpen

      public boolean areFunctionVariablesOpen(Address FunctionAddress)
      Description copied from interface: ListingModel
      Checks if the function variables are being displayed at the given address
      Specified by:
      areFunctionVariablesOpen in interface ListingModel
      Parameters:
      FunctionAddress - the address of the function
      Returns:
      true if the variables are being displayed for the function at the given address
    • adjustAddressSetToCodeUnitBoundaries

      public AddressSet adjustAddressSetToCodeUnitBoundaries(AddressSet addressSet)
      Description copied from interface: ListingModel
      Adjusts each range in the given address set to be on code unit boundaries.
      Specified by:
      adjustAddressSetToCodeUnitBoundaries in interface ListingModel
      Parameters:
      addressSet - the address set to be adjusted
      Returns:
      a new AddressSet where each range is on a code unit boundary
    • setAddressTranslator

      public void setAddressTranslator(AddressTranslator translator)
      Sets an address translator for this converter. If provided the translator converts addresses from the primary program to those in the program for this converter's model.
      Parameters:
      translator - translates addresses between the primary model and this converter's model
    • copy

      public ListingModel copy()
      Description copied from interface: ListingModel
      Makes a copy of this model.
      Specified by:
      copy in interface ListingModel
      Returns:
      a copy of this model.
    • isFunctionOpen

      public boolean isFunctionOpen(Address functionAddress)
      Description copied from interface: ListingModel
      Checks if the function at the given entry point is open or not.
      Specified by:
      isFunctionOpen in interface ListingModel
      Parameters:
      functionAddress - the entry point of the function to check for open
      Returns:
      true if the function is open; false otherwise
    • setFunctionOpen

      public void setFunctionOpen(Address functionAddress, boolean b)
      Description copied from interface: ListingModel
      Sets the function at the given address to be open or not
      Specified by:
      setFunctionOpen in interface ListingModel
      Parameters:
      functionAddress - the entry point of the function to set open or closed
      b - true to open the function, false to close it
    • setAllFunctionsOpen

      public void setAllFunctionsOpen(boolean selected)
      Description copied from interface: ListingModel
      Sets all functions to open or closed.
      Specified by:
      setAllFunctionsOpen in interface ListingModel
      Parameters:
      selected - if true, opens all function; otherwise closes all functions