Package ghidra.app.merge.listing

# Class ExternalProgramMerger

java.lang.Object
ghidra.app.merge.listing.ExternalProgramMerger

All Implemented Interfaces:
  `ListingMergeConstants`, `MergeResolver`

public class ExternalProgramMerger extends Object implements MergeResolver, ListingMergeConstants
Manages external program name changes and conflicts between the latest versioned program and the modified program being checked into version control.

- ## Field Summary

  ### 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
  `ExternalProgramMerger(ProgramMultiUserMergeManager mergeManager, Program resultPgm, Program originalPgm, Program latestPgm, Program myPgm, ProgramChangeSet latestChanges, ProgramChangeSet myChanges)`
  Manages code unit changes and conflicts between the latest versioned program and the modified program being checked into version control.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `apply()`
  Notification that the apply button was hit.
  `void`
  `autoMerge(TaskMonitor monitor)`
  `void`
  `cancel()`
  Notification that the merge process was canceled.
  `int`
  `getConflictCount()`
  `String`
  `getConflictInfo(ghidra.app.merge.listing.ExternalProgramMerger.IDGroup idGroup, int conflictIndex, int totalConflicts)`
  Gets the information to display at the top of the conflict window indicating which conflict this is of the total external program name conflicts.
  `ghidra.app.merge.listing.ExternalProgramMerger.IDGroup[]`
  `getConflicts()`
  Returns an array of symbol ID groups for all the external programs that are in conflict.
  `String`
  `getDescription()`
  Get the description of what this MergeResolver does.
  `String`
  `getName()`
  Get the name of this MergeResolver.
  `String[][]`
  `getPhases()`
  Gets identifiers for the merge phases handled by this MergeResolver.
  `boolean`
  `hasConflict()`
  `void`
  `init()`
  `void`
  `merge(TaskMonitor monitor)`
  Perform the merge process.
  `void`
  `mergeConflicts(int chosenConflictOption, TaskMonitor monitor)`
  Performs a manual merge of external program conflicts.
  `void`
  `mergeExternalProgramName(Program program1, Program program2, ghidra.app.merge.listing.ExternalProgramMerger.IDGroup idGroup, TaskMonitor monitor)`
  Actually merges (sets or removes) the indicated external program name in program1 based on the same external program name in program2

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

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

- ## Constructor Details

  - ### ExternalProgramMerger

    public ExternalProgramMerger(ProgramMultiUserMergeManager mergeManager, Program resultPgm, Program originalPgm, Program latestPgm, Program myPgm, ProgramChangeSet latestChanges, ProgramChangeSet myChanges)
    Manages code unit changes and conflicts between the latest versioned program and the modified program being checked into version control.
    Parameters:
      `mergeManager` - the top level merge manager for merging a program version.
      `resultPgm` - the program to be updated with the result of the merge. This is the program that will actually get checked in.
      `originalPgm` - the program that was checked out.
      `latestPgm` - the latest checked-in version of the program.
      `myPgm` - the program requesting to be checked in.
      `latestChanges` - the address set of changes between original and latest versioned program.
      `myChanges` - the address set of changes between original and my modified program.

- ## Method Details

  - ### init

    public void init()

  - ### autoMerge

    public void autoMerge(TaskMonitor monitor) throws CancelledException
    Throws:
      `CancelledException`

  - ### mergeConflicts

    public void mergeConflicts(int chosenConflictOption, TaskMonitor monitor) throws CancelledException
    Performs a manual merge of external program conflicts.
    Parameters:
      `chosenConflictOption` - ASK_USER means interactively resolve conflicts. JUnit testing also allows setting this to LATEST, MY, or ORIGINAL to force selection of a particular version change.
      `monitor` - task monitor for informing the user of progress.
    Throws:
      `CancelledException` - if the user cancels the merge.

  - ### getConflictInfo

    public String getConflictInfo(ghidra.app.merge.listing.ExternalProgramMerger.IDGroup idGroup, int conflictIndex, int totalConflicts)
    Gets the information to display at the top of the conflict window indicating which conflict this is of the total external program name conflicts.
    Parameters:
      `idGroup` - the symbol ID group for the external program (Library) in conflict.
      `conflictIndex` - the index of the current conflict.
      `totalConflicts` - the total number of conflicts.

  - ### hasConflict

    public boolean hasConflict()

  - ### getConflictCount

    public int getConflictCount()

  - ### getConflicts

    public ghidra.app.merge.listing.ExternalProgramMerger.IDGroup[] getConflicts()
    Returns an array of symbol ID groups for all the external programs that are in conflict.

  - ### getName

    public String getName()
    Description copied from interface: `MergeResolver`
    Get the name of this MergeResolver.
    Specified by:
      `getName` in interface `MergeResolver`

  - ### getDescription

    public String getDescription()
    Description copied from interface: `MergeResolver`
    Get the description of what this MergeResolver does.
    Specified by:
      `getDescription` in interface `MergeResolver`

  - ### apply

    public void apply()
    Description copied from interface: `MergeResolver`
    Notification that the apply button was hit.
    Specified by:
      `apply` in interface `MergeResolver`

  - ### cancel

    public void cancel()
    Description copied from interface: `MergeResolver`
    Notification that the merge process was canceled.
    Specified by:
      `cancel` in interface `MergeResolver`

  - ### merge

    public void merge(TaskMonitor monitor)
    Description copied from interface: `MergeResolver`
    Perform the merge process.
    Specified by:
      `merge` in interface `MergeResolver`
    Parameters:
      `monitor` - monitor that allows the user to cancel the merge operation

  - ### mergeExternalProgramName

    public void mergeExternalProgramName(Program program1, Program program2, ghidra.app.merge.listing.ExternalProgramMerger.IDGroup idGroup, TaskMonitor monitor)
    Actually merges (sets or removes) the indicated external program name in program1 based on the same external program name in program2
    Parameters:
      `program1` - the program to merge into.
      `program2` - the program to get the merge information from.
      `idGroup` - the symbol ID group for the external program (Library) to merge.
      `monitor` - task monitor for feedback or canceling the merge.s

  - ### getPhases

    public String[][] getPhases()
    Description copied from interface: `MergeResolver`
    Gets identifiers for the merge phases handled by this MergeResolver. If the merge has no sub-phases then return an array with a single string array. Each inner String array indicates a path for a single merge phase. Each outer array element represents a phase whose progress we wish to indicate.
    Examples:
    So for a simple phase which has no sub-phases return `new String[][] {new String[] {"Phase A"}}`
    So for a phase with 2 sub-phases return `new String[][] { new String[] {"Phase A"}, new String[] {"Phase A", "Sub-Phase 1}, new String[] {"Phase A", "Sub-Phase 2} }` .
    Specified by:
      `getPhases` in interface `MergeResolver`
    Returns:
      an array of phases.