Package ghidra.app.merge.listing

# 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 Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected long`
  `changeNum`
  `protected ConflictInfoPanel`
  `conflictInfoPanel`
  `protected int`
  `conflictOption`
  `protected Address`
  `currentAddress`
  `protected ConflictPanel`
  `currentConflictPanel`
  `protected TaskMonitor`
  `currentMonitor`
  `protected ProgramDiff`
  `diffLatestMy`
  `protected ProgramDiff`
  `diffOriginalLatest`
  `protected ProgramDiff`
  `diffOriginalMy`
  `protected StringBuffer`
  `errorBuf`
  `protected StringBuffer`
  `infoBuf`
  `protected static final int`
  `LATEST`
  `protected Program`
  `latestPgm`
  `protected ListingMergeManager`
  `listingMergeMgr`
  `protected ListingMergePanel`
  `listingMergePanel`
  `protected int`
  `maxPhaseProgressPercentage`
  `protected static final Color`
  `MERGE_HIGHLIGHT_COLOR`
  `protected ProgramMultiUserMergeManager`
  `mergeManager`
  `protected int`
  `minPhaseProgressPercentage`
  `protected static final int`
  `MY`
  `protected Program`
  `myPgm`
  `protected int`
  `numConflictsResolved`
  `protected static final int`
  `ORIGINAL`
  `protected Program`
  `originalPgm`
  `protected static final int`
  `RESULT`
  `protected AddressFactory`
  `resultAddressFactory`
  `protected Program`
  `resultPgm`
  `protected long`
  `totalChanges`

  ### Fields inherited from interface ghidra.app.merge.listing.ListingMergeConstants

  `ASK_USER, CANCELED, CHECKED_OUT_BUTTON_NAME, CHECKED_OUT_CHECK_BOX_NAME, CHECKED_OUT_LABEL_NAME, CHECKED_OUT_LIST_BUTTON_NAME, INFO_ROW, KEEP_ALL, KEEP_BOTH, KEEP_LATEST, KEEP_MY, KEEP_ORIGINAL, KEEP_RESULT, LATEST_BUTTON_NAME, LATEST_CHECK_BOX_NAME, LATEST_LABEL_NAME, LATEST_LIST_BUTTON_NAME, LATEST_TITLE, MY_TITLE, ORIGINAL_BUTTON_NAME, ORIGINAL_CHECK_BOX_NAME, ORIGINAL_LABEL_NAME, ORIGINAL_TITLE, REMOVE_CHECKED_OUT_BUTTON_NAME, REMOVE_LATEST, REMOVE_LATEST_BUTTON_NAME, REMOVE_MY, RENAME_CHECKED_OUT_BUTTON_NAME, RENAME_LATEST, RENAME_LATEST_BUTTON_NAME, RENAME_MY, RESULT_BUTTON_NAME, RESULT_TITLE, TRUNCATE_LENGTH`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FunctionTagListingMerger(ListingMergeManager listingMergeMgr)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `apply()`
  `void`
  `autoMerge(int progressMin, int progressMax, TaskMonitor monitor)`
  `void`
  `cancel()`
  `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.
  `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.
  `int`
  `getConflictCount(Address addr)`
  `AddressSetView`
  `getConflicts()`
  `String`
  `getConflictType()`
  `int`
  `getNumConflictsResolved()`
  `boolean`
  `hasConflict(Address addr)`
  `protected void`
  `incrementProgress(int increment)`
  Updates the progress bar associated with this phase of the merge.
  `void`
  `init()`
  PUBLIC METHODS
  `protected void`
  `initializeAutoMerge(String progressMessage, int progressMin, int progressMax, TaskMonitor monitor)`
  `void`
  `mergeConflicts(ListingMergePanel listingPanel, Address addr, int chosenConflictOption, TaskMonitor monitor)`
  `void`
  `setConflictResolution(int option)`
  Stores the users' selection for how to handle a conflict.
  `protected void`
  `updateProgress(int myPercentComplete)`
  Updates the progress bar associated with this phase of the merge.
  `protected void`
  `updateProgress(int myPercentComplete, String message)`
  Updates the progress bar and the progress message details associated with this phase of the merge.
  `protected void`
  `updateProgressMessage(String message)`
  Updates the progress message details associated with this phase of the merge.

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

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

- ## Field Details

  - ### RESULT

    protected static final int RESULT
    See Also:
      - Constant Field Values

  - ### LATEST

    protected static final int LATEST
    See Also:
      - Constant Field Values

  - ### MY

    protected static final int MY
    See Also:
      - Constant Field Values

  - ### ORIGINAL

    protected static final int ORIGINAL
    See Also:
      - Constant Field Values

  - ### 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.