Class MarkupItemImpl

java.lang.Object
ghidra.feature.vt.api.impl.MarkupItemImpl
All Implemented Interfaces:
VTMarkupItem

public class MarkupItemImpl extends Object implements VTMarkupItem
  • Constructor Details

    • MarkupItemImpl

      public MarkupItemImpl(VTAssociation association, VTMarkupType markupType, ghidra.program.model.address.Address sourceAddress)
    • MarkupItemImpl

      public MarkupItemImpl(MarkupItemStorage markupItem)
  • Method Details

    • setDefaultDestinationAddress

      public void setDefaultDestinationAddress(ghidra.program.model.address.Address address, String addressSource)
      Description copied from interface: VTMarkupItem
      Sets the default destination address for this item. This address will not be saved, as it is considered a temporary address value. Further, this value is intended to be a "best guess" as to what the destination address should be.

      Users should not call this method, but should instead call VTMarkupItem.setDestinationAddress(Address).

      Specified by:
      setDefaultDestinationAddress in interface VTMarkupItem
      Parameters:
      address - the address to set.
      addressSource - the source of the address. This will be the name of a VTProgramCorrelator when a correlator is used to populate default address values.
      See Also:
    • setDestinationAddress

      public void setDestinationAddress(ghidra.program.model.address.Address destinationAddress)
      Description copied from interface: VTMarkupItem
      Sets the actual destination address for the markup item. This method differs from VTMarkupItem.setDefaultDestinationAddress(Address, String) in that the address passed to this method will be saved.

      The VTMarkupItem.getDestinationAddressSource() will return VTMarkupItem.USER_DEFINED_ADDRESS_SOURCE when a valid destination address is set via this method.

      To clear the destination address you may pass null to this method.

      Specified by:
      setDestinationAddress in interface VTMarkupItem
      Parameters:
      destinationAddress - the new destination address for the item.
      See Also:
    • getMarkupType

      public VTMarkupType getMarkupType()
      Description copied from interface: VTMarkupItem
      Returns the VTMarkupType for this markup Item. VTMarkup types include comments, labels, function names, etc.
      Specified by:
      getMarkupType in interface VTMarkupItem
      Returns:
      the VTMarkupType for this markup Item.
    • getStatus

      public VTMarkupItemStatus getStatus()
      Description copied from interface: VTMarkupItem
      Returns the status of this markup item.
      Specified by:
      getStatus in interface VTMarkupItem
      Returns:
      the status of this markup item.
    • setConsidered

      public void setConsidered(VTMarkupItemConsideredStatus consideredStatus)
      Description copied from interface: VTMarkupItem
      Sets a considered status on this item without applying this item. This is useful to indicate that you considered this item and have decided not to apply it, with some indication as to why.

      To clear the considered status pass VTMarkupItemConsideredStatus.UNCONSIDERED.

      If the status was an "applied" status, then an exception will be thrown. To determine if an item is applied you can use VTMarkupItem.canUnapply().

      Specified by:
      setConsidered in interface VTMarkupItem
      Parameters:
      consideredStatus - The considered status to set
    • apply

      public void apply(VTMarkupItemApplyActionType applyType, ghidra.framework.options.ToolOptions options) throws VersionTrackingApplyException
      Description copied from interface: VTMarkupItem
      Applies this markup item using the given action at the give address. The destination address and the address source must be set prior to calling this method.
      Specified by:
      apply in interface VTMarkupItem
      Parameters:
      applyType - the type of apply action to take when applying the given markup item
      options - the options
      Throws:
      VersionTrackingApplyException - if an error occurred while attempting to apply the markup item.
    • supportsApplyAction

      public boolean supportsApplyAction(VTMarkupItemApplyActionType actionType)
      Description copied from interface: VTMarkupItem
      Returns true if this markupItem supports an apply for the given apply action type.
      Specified by:
      supportsApplyAction in interface VTMarkupItem
      Parameters:
      actionType - the VTMarkupITemApplyActionType to test.
      Returns:
      true if this markup item can be applied using the given action type.
    • getAssociation

      public VTAssociation getAssociation()
      Description copied from interface: VTMarkupItem
      Returns the VTAssocation that generated this markup item.
      Specified by:
      getAssociation in interface VTMarkupItem
      Returns:
      the VTAssocation that generated this markup item.
    • getSourceLocation

      public ghidra.program.util.ProgramLocation getSourceLocation()
      Description copied from interface: VTMarkupItem
      Returns the field specific program location in the source program for this association.
      Specified by:
      getSourceLocation in interface VTMarkupItem
      Returns:
      the field specific program location in the source program for this association.
    • getDestinationLocation

      public ghidra.program.util.ProgramLocation getDestinationLocation()
      Description copied from interface: VTMarkupItem
      Returns the field specific program location in the destination program for this association.
      Specified by:
      getDestinationLocation in interface VTMarkupItem
      Returns:
      the field specific program location in the destination program for this association.
    • getDisplayName

      public String getDisplayName()
    • getStatusDescription

      public String getStatusDescription()
      Description copied from interface: VTMarkupItem
      Returns an optional description of the current markup item status. For example, if there status is VTMarkupItemStatus.FAILED_APPLY, then this method should return a description of the failure.
      Specified by:
      getStatusDescription in interface VTMarkupItem
      Returns:
      the description.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDestinationAddressEditStatus

      public VTMarkupItemDestinationAddressEditStatus getDestinationAddressEditStatus()
      Description copied from interface: VTMarkupItem
      Returns the editable status of this markup item's destination address.
      Specified by:
      getDestinationAddressEditStatus in interface VTMarkupItem
      Returns:
      the editable status of this markup item's destination address.
      See Also:
    • canApply

      public boolean canApply()
      Description copied from interface: VTMarkupItem
      Returns true if this markup item can be applied.
      Specified by:
      canApply in interface VTMarkupItem
      Returns:
      true if this markup item can be applied.
    • canUnapply

      public boolean canUnapply()
      Description copied from interface: VTMarkupItem
      Returns true if this markup item can be unapplied.
      Specified by:
      canUnapply in interface VTMarkupItem
      Returns:
      true if this markup item can be unapplied.
    • unapply

      public void unapply() throws VersionTrackingApplyException
      Description copied from interface: VTMarkupItem
      Returns the value in the destination program back to its original value.
      Specified by:
      unapply in interface VTMarkupItem
      Throws:
      VersionTrackingApplyException - if an error occurred while attempting to unapply the markup item.
    • getDestinationAddressSource

      public String getDestinationAddressSource()
      Description copied from interface: VTMarkupItem
      Returns a string that indicates the origin of the destination address. Typically, it is determined either by an algorithm or the user.
      Specified by:
      getDestinationAddressSource in interface VTMarkupItem
      Returns:
      a string that indicates the origin of the destination address.
    • isStoredInDB

      public boolean isStoredInDB()
    • getCurrentDestinationValue

      public Stringable getCurrentDestinationValue()
      Description copied from interface: VTMarkupItem
      Returns a Stringable that represents the current value of the markup item in the destination program.
      Specified by:
      getCurrentDestinationValue in interface VTMarkupItem
      Returns:
      a Stringable that represents the current value of the markup item in the destination program.
    • getOriginalDestinationValue

      public Stringable getOriginalDestinationValue()
      Description copied from interface: VTMarkupItem
      Returns a Stringable that represents the original value of the markup item in the destination program.
      Specified by:
      getOriginalDestinationValue in interface VTMarkupItem
      Returns:
      a Stringable that represents the original value of the markup item in the destination program.
    • getSourceValue

      public Stringable getSourceValue()
      Description copied from interface: VTMarkupItem
      Returns a Stringable that represents the value of the markup item in the source program.
      Specified by:
      getSourceValue in interface VTMarkupItem
      Returns:
      a Stringable that represents the value of the markup item in the source program.
    • getDestinationAddress

      public ghidra.program.model.address.Address getDestinationAddress()
      Description copied from interface: VTMarkupItem
      Returns the address in the destination program for this association.
      Specified by:
      getDestinationAddress in interface VTMarkupItem
      Returns:
      the address in the destination program for this association.
    • getSourceAddress

      public ghidra.program.model.address.Address getSourceAddress()
      Description copied from interface: VTMarkupItem
      Returns the address in the source program for this association.
      Specified by:
      getSourceAddress in interface VTMarkupItem
      Returns:
      the address in the source program for this association.
    • getStorage

      public MarkupItemStorage getStorage()