Package ghidra.app.merge.listing
Class FunctionTagListingMerger
java.lang.Object
ghidra.app.merge.listing.FunctionTagListingMerger
- All Implemented Interfaces:
ListingMergeConstants
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
Modifier and TypeFieldDescriptionprotected long
protected ConflictInfoPanel
protected int
protected Address
protected ConflictPanel
protected TaskMonitor
protected ProgramDiff
protected ProgramDiff
protected ProgramDiff
protected StringBuffer
protected StringBuffer
protected static final int
protected Program
protected ListingMergeManager
protected ListingMergePanel
protected int
protected static final Color
protected ProgramMultiUserMergeManager
protected int
protected static final int
protected Program
protected int
protected static final int
protected Program
protected static final int
protected AddressFactory
protected Program
protected long
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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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) int
boolean
hasConflict
(Address addr) protected void
incrementProgress
(int increment) Updates the progress bar associated with this phase of the merge.void
init()
PUBLIC METHODSprotected 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.
-
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
-
mergeManager
-
listingMergeMgr
-
listingMergePanel
-
conflictInfoPanel
-
conflictOption
protected int conflictOption -
currentAddress
-
currentMonitor
-
resultPgm
-
originalPgm
-
latestPgm
-
myPgm
-
resultAddressFactory
-
diffOriginalLatest
-
diffOriginalMy
-
diffLatestMy
-
errorBuf
-
infoBuf
-
totalChanges
protected long totalChanges -
changeNum
protected long changeNum -
minPhaseProgressPercentage
protected int minPhaseProgressPercentage -
maxPhaseProgressPercentage
protected int maxPhaseProgressPercentage -
currentConflictPanel
-
numConflictsResolved
protected int numConflictsResolved
-
-
Constructor Details
-
FunctionTagListingMerger
Constructor.- Parameters:
listingMergeMgr
- the listing merge manager that owns this merger.
-
-
Method Details
-
init
public void init()PUBLIC METHODS -
getConflictType
-
getConflictCount
-
apply
public boolean apply() -
setConflictResolution
public void setConflictResolution(int option) Stores the users' selection for how to handle a conflict.- Parameters:
option
- user option, fromListingMergeConstants
-
autoMerge
public void autoMerge(int progressMin, int progressMax, TaskMonitor monitor) throws ProgramConflictException, MemoryAccessException, CancelledException -
getConflicts
-
hasConflict
-
mergeConflicts
public void mergeConflicts(ListingMergePanel listingPanel, Address addr, int chosenConflictOption, TaskMonitor monitor) throws CancelledException, MemoryAccessException -
initializeAutoMerge
protected void initializeAutoMerge(String progressMessage, int progressMin, int progressMax, TaskMonitor monitor) -
getCodeUnitAddressSet
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
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 thetotalChanges
andchangeNum
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
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
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.
-