Package ghidra.app.merge.listing
Class FunctionTagListingMerger
- java.lang.Object
-
- ghidra.app.merge.listing.FunctionTagListingMerger
-
- All Implemented Interfaces:
ListingMergeConstants
public class FunctionTagListingMerger extends java.lang.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 theFunctionTagMerger
, 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 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
All Methods Instance Methods Concrete Methods 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, & 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, & ORIGINAL programs.int
getConflictCount(Address addr)
AddressSetView
getConflicts()
java.lang.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 METHODSprotected void
initializeAutoMerge(java.lang.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, java.lang.String message)
Updates the progress bar and the progress message details associated with this phase of the merge.protected void
updateProgressMessage(java.lang.String message)
Updates the progress message details associated with this phase of the merge.
-
-
-
Field Detail
-
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 java.awt.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 java.lang.StringBuffer errorBuf
-
infoBuf
protected java.lang.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 Detail
-
FunctionTagListingMerger
public FunctionTagListingMerger(ListingMergeManager listingMergeMgr)
Constructor.- Parameters:
listingMergeMgr
- the listing merge manager that owns this merger.
-
-
Method Detail
-
init
public void init()
PUBLIC METHODS
-
getConflictType
public java.lang.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, fromListingMergeConstants
-
autoMerge
public void autoMerge(int progressMin, int progressMax, TaskMonitor monitor) 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
-
initializeAutoMerge
protected void initializeAutoMerge(java.lang.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, & 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, & ORIGINAL programs.- Parameters:
addr
- 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<\code> 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(java.lang.String message)
Updates the progress message details associated with this phase of the merge.- Parameters:
progressMessage
- 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, java.lang.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.progressMessage
- a message indicating what is currently occurring in this phase. Null indicates to use the default message.
-
-