Class FunctionTagListingMerger

java.lang.Object
ghidra.app.merge.listing.FunctionTagListingMerger
All Implemented Interfaces:
ListingMergeConstants

public class FunctionTagListingMerger extends Object
Handles merging of function tags when they are added/removed from functions. Most merging can be done automatically; the exception being when a tag has been added to a function by one user, but deleted from the program by another. Note that there are other tag related conflict cases, but they are handled by the FunctionTagMerger, which handles all aspects of creation/deletion/editing of tags independent of functions. THIS CLASS ONLY DEALS WITH FUNCTION-RELATED ADDS/REMOVES. The specific cases handled by the class are described below: - X and Y are tags - ** indicates a conflict User A | Add X Add Y Delete X Delete Y | User B | ------------------------------------------------------- Add X | X X,Y ** X | Add Y | X,Y Y Y ** | Delete X | ** Y - - | Delete Y | X ** - -
  • Field Details

    • RESULT

      protected static final int RESULT
      See Also:
    • LATEST

      protected static final int LATEST
      See Also:
    • MY

      protected static final int MY
      See Also:
    • ORIGINAL

      protected static final int ORIGINAL
      See Also:
    • MERGE_HIGHLIGHT_COLOR

      protected static final Color MERGE_HIGHLIGHT_COLOR
    • mergeManager

      protected ProgramMultiUserMergeManager mergeManager
    • listingMergeMgr

      protected ListingMergeManager listingMergeMgr
    • listingMergePanel

      protected ListingMergePanel listingMergePanel
    • conflictInfoPanel

      protected ConflictInfoPanel conflictInfoPanel
    • conflictOption

      protected int conflictOption
    • currentAddress

      protected Address currentAddress
    • currentMonitor

      protected TaskMonitor currentMonitor
    • resultPgm

      protected Program resultPgm
    • originalPgm

      protected Program originalPgm
    • latestPgm

      protected Program latestPgm
    • myPgm

      protected Program myPgm
    • resultAddressFactory

      protected AddressFactory resultAddressFactory
    • diffOriginalLatest

      protected ProgramDiff diffOriginalLatest
    • diffOriginalMy

      protected ProgramDiff diffOriginalMy
    • diffLatestMy

      protected ProgramDiff diffLatestMy
    • errorBuf

      protected StringBuffer errorBuf
    • infoBuf

      protected StringBuffer infoBuf
    • totalChanges

      protected long totalChanges
    • changeNum

      protected long changeNum
    • minPhaseProgressPercentage

      protected int minPhaseProgressPercentage
    • maxPhaseProgressPercentage

      protected int maxPhaseProgressPercentage
    • currentConflictPanel

      protected ConflictPanel currentConflictPanel
    • numConflictsResolved

      protected int numConflictsResolved
  • Constructor Details

    • FunctionTagListingMerger

      public FunctionTagListingMerger(ListingMergeManager listingMergeMgr)
      Constructor.
      Parameters:
      listingMergeMgr - the listing merge manager that owns this merger.
  • Method Details

    • init

      public void init()
      PUBLIC METHODS
    • getConflictType

      public String getConflictType()
    • getConflictCount

      public int getConflictCount(Address addr)
    • apply

      public boolean apply()
    • setConflictResolution

      public void setConflictResolution(int option)
      Stores the users' selection for how to handle a conflict.
      Parameters:
      option - user option, from ListingMergeConstants
    • autoMerge

      public void autoMerge(int progressMin, int progressMax, TaskMonitor monitor) throws ProgramConflictException, MemoryAccessException, CancelledException
      Throws:
      ProgramConflictException
      MemoryAccessException
      CancelledException
    • getConflicts

      public AddressSetView getConflicts()
    • hasConflict

      public boolean hasConflict(Address addr)
    • mergeConflicts

      public void mergeConflicts(ListingMergePanel listingPanel, Address addr, int chosenConflictOption, TaskMonitor monitor) throws CancelledException, MemoryAccessException
      Throws:
      CancelledException
      MemoryAccessException
    • initializeAutoMerge

      protected void initializeAutoMerge(String progressMessage, int progressMin, int progressMax, TaskMonitor monitor)
    • getCodeUnitAddressSet

      protected AddressSetView getCodeUnitAddressSet(Address addr)
      Return an address set that contains all addresses that make up the code units containing the indicated address in the LATEST, MY, and ORIGINAL programs.
      Parameters:
      addr - the address
      Returns:
      the code unit address set
    • getCodeUnitAddressSet

      protected AddressSetView getCodeUnitAddressSet(AddressSet addrs)
      Return an address set that contains all addresses that make up the code units containing the indicated addresses in the LATEST, MY, and ORIGINAL programs.
      Parameters:
      addrs - the addresses
      Returns:
      the code unit address set
    • cancel

      public void cancel()
    • getNumConflictsResolved

      public int getNumConflictsResolved()
    • incrementProgress

      protected void incrementProgress(int increment)
      Updates the progress bar associated with this phase of the merge. Before beginning to auto-merge the totalChanges and changeNum must be set. This method should then be called as changes are made to update the change bar. This assumes that each change is equivalent in terms of shown progress.
      Parameters:
      increment - the number of changes completed relative to the total number of changes for this auto-merger.
    • updateProgressMessage

      protected void updateProgressMessage(String message)
      Updates the progress message details associated with this phase of the merge.
      Parameters:
      message - a message indicating what is currently occurring in this phase. Null indicates to use the default message.
    • updateProgress

      protected void updateProgress(int myPercentComplete)
      Updates the progress bar associated with this phase of the merge.
      Parameters:
      myPercentComplete - the progress percentage completed for this merger. This should be a value from 0 to 100.
    • updateProgress

      protected void updateProgress(int myPercentComplete, String message)
      Updates the progress bar and the progress message details associated with this phase of the merge.
      Parameters:
      myPercentComplete - the progress percentage completed for this merger. This should be a value from 0 to 100.
      message - a message indicating what is currently occurring in this phase. Null indicates to use the default message.