Class FormatManager

java.lang.Object
ghidra.app.util.viewer.format.FormatManager
All Implemented Interfaces:
OptionsChangeListener

public class FormatManager extends Object implements OptionsChangeListener
Class to manage the set of format models.
  • Field Details

  • Constructor Details

    • FormatManager

      public FormatManager(ToolOptions displayOptions, ToolOptions fieldOptions)
      Constructs a new FormatManager.
      Parameters:
      displayOptions - the Options containing display options (color, fonts, etc)
      fieldOptions - the Options contains specific field options.
  • Method Details

    • createClone

      public FormatManager createClone()
    • dispose

      public void dispose()
    • setServiceProvider

      public void setServiceProvider(ServiceProvider provider)
      Sets the service provider used by the field factory objects.
      Parameters:
      provider - the service provider
    • addFormatModelListener

      public void addFormatModelListener(FormatModelListener listener)
      Adds a listener to be notified when a format changes.
      Parameters:
      listener - the listener to be added
    • removeFormatModleListener

      public void removeFormatModleListener(FormatModelListener listener)
      Removes the given listener from the list of listeners to be notified of a format change.
      Parameters:
      listener - the listener to be removed.
    • getNumModels

      public int getNumModels()
      Returns the total number of model in the format manager.
      Returns:
      the total number of model in the format manager
    • getModel

      public FieldFormatModel getModel(int index)
      Returns the format model for the given index.
      Parameters:
      index - the index of the format model to return.
      Returns:
      the format model for the given index
    • getDividerModel

      public FieldFormatModel getDividerModel()
      Returns the format model for the address break (divider).
      Returns:
      the format model for the address break (divider)
    • getPlateFormat

      public FieldFormatModel getPlateFormat()
      Returns the format model for the plate field.
      Returns:
      the format model for the plate field
    • getFunctionFormat

      public FieldFormatModel getFunctionFormat()
      Returns the format model for the function signature.
      Returns:
      the format model for the function signature
    • getFunctionVarFormat

      public FieldFormatModel getFunctionVarFormat()
      Returns the format model for the function variables.
      Returns:
      the format model for the function variables
    • getCodeUnitFormat

      public FieldFormatModel getCodeUnitFormat()
      Returns the format model for a code unit.
      Returns:
      the format model for a code unit
    • getOpenDataFormat

      public FieldFormatModel getOpenDataFormat(Data data)
      Returns the format model to use for the internals of open structures.
      Parameters:
      data - the data code unit to get the format model for.
    • update

      public void update()
      update all listeners that a model has changed.
    • getDisplayOptions

      public ToolOptions getDisplayOptions()
      Returns the Options used for display properties.
      Returns:
      the Options used for display properties.
    • getFieldOptions

      public ToolOptions getFieldOptions()
      Returns the Options used for field specific properties.
      Returns:
      the Options used for field specific properties
    • getTemplateSimplifier

      public TemplateSimplifier getTemplateSimplifier()
      Returns the template simplifier.
      Returns:
      the template simplifier.
    • modelChanged

      public void modelChanged(FieldFormatModel model)
      Notifies listeners that the given model has changed.
      Parameters:
      model - the format model that changed.
    • getMaxWidth

      public int getMaxWidth()
      Returns the width of the widest model in this manager.
    • getMaxRowCount

      public int getMaxRowCount()
    • getMaxNumRows

      public int getMaxNumRows()
      Returns the maximum number of possible rows in a layout. This would only occur if some address had every possible type of information to be displayed.
    • setDefaultFormat

      public void setDefaultFormat(int modelID)
      Resets the model with the given id to its default format.
      Parameters:
      modelID - the id of the model to reset.
    • setDefaultFormats

      public void setDefaultFormats()
      Resets all format models to their default format.
    • addHighlightProvider

      public void addHighlightProvider(ListingHighlightProvider provider)
      Adds a HighlightProvider
      Parameters:
      provider - the provider to use.
      See Also:
    • removeHighlightProvider

      public void removeHighlightProvider(ListingHighlightProvider provider)
      Removes the provider
      Parameters:
      provider - the provider to remove.
      See Also:
    • getHighlightProviders

      public List<ListingHighlightProvider> getHighlightProviders()
      Gets all ListingHighlightProviders installed on this FormatManager via the addHighlightProvider(ListingHighlightProvider).
      Returns:
      all ListingHighlightProviders installed on this FormatManager.
    • getFormatHighlightProvider

      public ListingHighlightProvider getFormatHighlightProvider()
      Returns the ListingHighlightProvider that should be used when creating FieldFactory objects.
    • optionsChanged

      public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue)
      Description copied from interface: OptionsChangeListener
      Notification that an option changed.

      Note: to reject an options change, you can throw a OptionsVetoException.

      Specified by:
      optionsChanged in interface OptionsChangeListener
      Parameters:
      options - options object containing the property that changed
      name - name of option that changed
      oldValue - old value of the option
      newValue - new value of the option
    • saveState

      public void saveState(SaveState saveState)
      Saves the state of this LayoutManager to the SaveState object.
      Parameters:
      saveState - the SaveState object to write to.
    • readState

      public void readState(SaveState saveState)
      Restores the state of this LayoutController from the given SaveState object.
      Parameters:
      saveState - the SaveState to read from.
    • getServiceProvider

      public ServiceProvider getServiceProvider()