Package ghidra.app.merge
Class MergeManager
- java.lang.Object
-
- ghidra.app.merge.MergeManager
-
- All Implemented Interfaces:
MergeProgressModifier
,DomainObjectMergeManager
- Direct Known Subclasses:
DataTypeArchiveMergeManager
,ProgramMultiUserMergeManager
public abstract class MergeManager extends java.lang.Object implements DomainObjectMergeManager
Top level object that manages each step of the merge/resolve conflicts process.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
currentIndex
protected boolean
inputReceived
protected DomainObjectChangeSet
latestChangeSet
protected UndoableDomainObject
latestDomainObject
protected boolean
mergeCompleted
protected TaskMonitor
mergeMonitor
protected MergeManagerPlugin
mergePlugin
protected MergeProgressPanel
mergeProgressPanel
protected MergeResolver[]
mergeResolvers
protected boolean
mergeStatus
protected ModalPluginTool
mergeTool
protected boolean
mergeToolIsVisible
protected DomainObjectChangeSet
myChangeSet
protected UndoableDomainObject
myDomainObject
protected UndoableDomainObject
originalDomainObject
protected boolean
prompting
protected java.util.Hashtable<java.lang.String,java.lang.Object>
resolveMap
protected UndoableDomainObject
resultDomainObject
protected RunManager
runManager
-
Constructor Summary
Constructors Constructor Description MergeManager(UndoableDomainObject resultDomainObject, UndoableDomainObject myDomainObject, UndoableDomainObject originalDomainObject, UndoableDomainObject latestDomainObject, DomainObjectChangeSet latestChangeSet, DomainObjectChangeSet myChangeSet)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
cleanupMerge()
void
clearStatusText()
Clear the status text on the merge dialog.protected abstract MergeManagerPlugin
createMergeManagerPlugin(ModalPluginTool mergePluginTool, MergeManager multiUserMergeManager, UndoableDomainObject modifiableDomainObject)
protected abstract void
createMergeResolvers()
UndoableDomainObject
getDomainObject(int version)
Returns one of the four programs involved in the merge as indicated by the version.MergeProgressPanel
getMergeProgressPanel()
gets the default merge progress panel that indicates all the phases and their current status.MergeResolver
getMergeResolverByName(java.lang.String name)
Returns the named merge resolver from the ones used directly by the MergeManager.PluginTool
getMergeTool()
For Junit testsjavax.swing.JComponent
getMonitorComponent()
Gets the TaskMonitor component that is displayed at the bottom of the merge tool.protected java.awt.Dimension
getPreferredMergeToolSize()
java.lang.Object
getResolveInformation(java.lang.String infoType)
Gets the resolve information object for the indicated standardized name.protected abstract void
initializeMerge()
boolean
isMergeToolVisible()
Determines if the modal merge tool is currently displayed on the screen.boolean
isPromptingUser()
Determines whether or not the user is being prompted to resolve a conflict.boolean
merge()
Convenience method for Junit tests.boolean
merge(TaskMonitor taskMonitor)
Merge domain objects and resolve any conflicts.boolean
processingCompleted()
Return whether the merge process has completed.void
removeComponent(javax.swing.JComponent comp)
Removes the component that is used to resolve conflicts.void
setApplyEnabled(boolean enabled)
Enable the apply button according to the "enabled" parameter.void
setCompleted(java.lang.String[] mergePhase)
The manager (MergeResolver) for a particular merge phase should call this when its phase or sub-phase completes.void
setInProgress(java.lang.String[] mergePhase)
The manager (MergeResolver) for a particular merge phase should call this when its phase or sub-phase begins.void
setResolveInformation(java.lang.String infoType, java.lang.Object infoObject)
Sets the resolve information object for the indicated standardized name.void
setStatusText(java.lang.String msg)
Set the status text on the merge dialog.void
showComponent(javax.swing.JComponent comp, java.lang.String componentID, HelpLocation helpLoc)
Show the component that is used to resolve conflicts.void
showDefaultMergePanel(java.lang.String description)
Show the default merge panel.protected void
showMergeTool()
void
showMonitorComponent(boolean show)
Shows/hides the monitor component at the bottom of the merge tool.void
showProgressIcon(boolean show)
Shows/hides the progress icon (spinning globe) at the bottom of the merge tool.void
updateProgress(int currentProgressPercentage)
Updates the current phase progress area in the default merge panel.void
updateProgress(int currentProgressPercentage, java.lang.String progressMessage)
Updates the current phase progress area in the default merge panel.void
updateProgress(java.lang.String description)
Updates the current phase progress area in the default merge panel.protected void
waitForInput()
Block until the user completes the current merge operation, or cancels the merge process.
-
-
-
Field Detail
-
mergeResolvers
protected MergeResolver[] mergeResolvers
-
resultDomainObject
protected UndoableDomainObject resultDomainObject
-
myDomainObject
protected UndoableDomainObject myDomainObject
-
originalDomainObject
protected UndoableDomainObject originalDomainObject
-
latestDomainObject
protected UndoableDomainObject latestDomainObject
-
latestChangeSet
protected DomainObjectChangeSet latestChangeSet
-
myChangeSet
protected DomainObjectChangeSet myChangeSet
-
mergePlugin
protected MergeManagerPlugin mergePlugin
-
runManager
protected RunManager runManager
-
mergeMonitor
protected TaskMonitor mergeMonitor
-
currentIndex
protected int currentIndex
-
inputReceived
protected volatile boolean inputReceived
-
mergeStatus
protected boolean mergeStatus
-
prompting
protected volatile boolean prompting
-
mergeCompleted
protected volatile boolean mergeCompleted
-
mergeToolIsVisible
protected volatile boolean mergeToolIsVisible
-
mergeTool
protected volatile ModalPluginTool mergeTool
-
resolveMap
protected java.util.Hashtable<java.lang.String,java.lang.Object> resolveMap
-
mergeProgressPanel
protected MergeProgressPanel mergeProgressPanel
-
-
Constructor Detail
-
MergeManager
public MergeManager(UndoableDomainObject resultDomainObject, UndoableDomainObject myDomainObject, UndoableDomainObject originalDomainObject, UndoableDomainObject latestDomainObject, DomainObjectChangeSet latestChangeSet, DomainObjectChangeSet myChangeSet)
-
-
Method Detail
-
createMergeResolvers
protected abstract void createMergeResolvers()
-
getDomainObject
public UndoableDomainObject getDomainObject(int version)
Returns one of the four programs involved in the merge as indicated by the version.- Parameters:
version
- the program version to return. (LATEST, MY, ORIGINAL, or RESULT).- Returns:
- the indicated program version or null if a valid version isn't specified.
- See Also:
MergeConstants
-
merge
public boolean merge(TaskMonitor taskMonitor) throws CancelledException
Description copied from interface:DomainObjectMergeManager
Merge domain objects and resolve any conflicts.- Specified by:
merge
in interfaceDomainObjectMergeManager
- Returns:
- true if the merge process completed successfully
- Throws:
CancelledException
- if the user canceled the merge process
-
createMergeManagerPlugin
protected abstract MergeManagerPlugin createMergeManagerPlugin(ModalPluginTool mergePluginTool, MergeManager multiUserMergeManager, UndoableDomainObject modifiableDomainObject)
-
initializeMerge
protected abstract void initializeMerge()
-
cleanupMerge
protected abstract void cleanupMerge()
-
getPreferredMergeToolSize
protected java.awt.Dimension getPreferredMergeToolSize()
-
merge
public boolean merge() throws CancelledException
Convenience method for Junit tests.- Throws:
CancelledException
-
setApplyEnabled
public void setApplyEnabled(boolean enabled)
Enable the apply button according to the "enabled" parameter.- Specified by:
setApplyEnabled
in interfaceDomainObjectMergeManager
-
clearStatusText
public void clearStatusText()
Clear the status text on the merge dialog.- Specified by:
clearStatusText
in interfaceDomainObjectMergeManager
-
setStatusText
public void setStatusText(java.lang.String msg)
Set the status text on the merge dialog.- Specified by:
setStatusText
in interfaceDomainObjectMergeManager
-
showDefaultMergePanel
public void showDefaultMergePanel(java.lang.String description)
Show the default merge panel. The default merge panel now shows the status of each phase of the merge and also the progress in the current phase.- Parameters:
description
- description of current merge process near the top of the merge tool.
-
showComponent
public void showComponent(javax.swing.JComponent comp, java.lang.String componentID, HelpLocation helpLoc)
Show the component that is used to resolve conflicts. This method is called by the MergeResolvers when user input is required. If the component is not null, this method blocks until the user either cancels the merge process or resolves a conflict. If comp is null, then the default component is displayed, and the method does not wait for user input.- Specified by:
showComponent
in interfaceDomainObjectMergeManager
- Parameters:
comp
- component to show; if component is null, show the default component and do not blockcomponentID
- id or name for the component
-
removeComponent
public void removeComponent(javax.swing.JComponent comp)
Removes the component that is used to resolve conflicts. This method is called by the MergeResolvers when user input is no longer required using the specified component.- Parameters:
comp
- component to show; if component is null, show the default component and do not block
-
showMergeTool
protected void showMergeTool()
-
showMonitorComponent
public void showMonitorComponent(boolean show)
Shows/hides the monitor component at the bottom of the merge tool.- Parameters:
show
- true means to show the task monitor at the bottom of the merge tool.
-
showProgressIcon
public void showProgressIcon(boolean show)
Shows/hides the progress icon (spinning globe) at the bottom of the merge tool.- Parameters:
show
- true means to show the icon.
-
isPromptingUser
public boolean isPromptingUser()
Determines whether or not the user is being prompted to resolve a conflict.- Returns:
- true if the user is being prompted for input.
-
processingCompleted
public boolean processingCompleted()
Return whether the merge process has completed. (Needed for Junit testing only.)
-
waitForInput
protected void waitForInput()
Block until the user completes the current merge operation, or cancels the merge process.
-
getResolveInformation
public java.lang.Object getResolveInformation(java.lang.String infoType)
Gets the resolve information object for the indicated standardized name. This is how information is passed between merge managers.
For example:
the data type merger knows what data type in the result is equivalent to a given data type from my checked out program. The code unit and function mergers need to be able to get this information so they don't unknowingly re-introduce a data type that was already eliminated by a data type conflict.- Parameters:
infoType
- the string indicating the type of resolve information- Returns:
- the object for the named string or null
-
setResolveInformation
public void setResolveInformation(java.lang.String infoType, java.lang.Object infoObject)
Sets the resolve information object for the indicated standardized name. This is how information is passed between merge managers.- Specified by:
setResolveInformation
in interfaceDomainObjectMergeManager
- Parameters:
infoType
- the string indicating the type of resolve informationinfoObject
- the object for the named string. This information is determined by the merge manager that creates it.- See Also:
getResolveInformation(java.lang.String)
-
getMergeResolverByName
public MergeResolver getMergeResolverByName(java.lang.String name)
Returns the named merge resolver from the ones used directly by the MergeManager.- Parameters:
name
- the name of the desired merge resolver- Returns:
- the merge resolver or null.
-
getMergeTool
public PluginTool getMergeTool()
For Junit tests- Returns:
- the merge tool
-
isMergeToolVisible
public boolean isMergeToolVisible()
Determines if the modal merge tool is currently displayed on the screen.- Returns:
- true if the merge tool is displayed.
-
getMergeProgressPanel
public MergeProgressPanel getMergeProgressPanel()
gets the default merge progress panel that indicates all the phases and their current status.- Returns:
- the merge panel that indicates progress.
-
getMonitorComponent
public javax.swing.JComponent getMonitorComponent()
Gets the TaskMonitor component that is displayed at the bottom of the merge tool.- Returns:
- the task monitor component.
-
updateProgress
public void updateProgress(java.lang.String description)
Updates the current phase progress area in the default merge panel.- Specified by:
updateProgress
in interfaceMergeProgressModifier
- Parameters:
currentProgressPercentage
- the progress percentage completed for the current phase. 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.
-
updateProgress
public void updateProgress(int currentProgressPercentage)
Updates the current phase progress area in the default merge panel.- Specified by:
updateProgress
in interfaceMergeProgressModifier
- Parameters:
currentProgressPercentage
- the progress percentage completed for the current phase. This should be a value from 0 to 100.
-
updateProgress
public void updateProgress(int currentProgressPercentage, java.lang.String progressMessage)
Updates the current phase progress area in the default merge panel.- Specified by:
updateProgress
in interfaceMergeProgressModifier
- Parameters:
currentProgressPercentage
- the progress percentage completed for the current phase. This should be a value from 0 to 100.progressMessage
- a message indicating what is currently occurring in this phase.
-
setInProgress
public void setInProgress(java.lang.String[] mergePhase)
The manager (MergeResolver) for a particular merge phase should call this when its phase or sub-phase begins. The string array should match one that the returned by MergeResolver.getPhases().- Specified by:
setInProgress
in interfaceMergeProgressModifier
- Parameters:
mergePhase
- identifier for the merge phase to change to in progress status.- See Also:
MergeResolver
-
setCompleted
public void setCompleted(java.lang.String[] mergePhase)
The manager (MergeResolver) for a particular merge phase should call this when its phase or sub-phase completes. The string array should match one that the returned by MergeResolver.getPhases().- Specified by:
setCompleted
in interfaceMergeProgressModifier
- Parameters:
mergePhase
- identifier for the merge phase to change to completed status.- See Also:
MergeResolver
-
-