public abstract class AbstractMergeManager
extends java.lang.Object
implements org.eclipse.jface.operation.IRunnableWithProgress, org.eclipse.team.core.mapping.IStorageMerger, org.eclipse.compare.IStreamMerger
Modifier and Type | Class and Description |
---|---|
static class |
AbstractMergeManager.ConflictSuppressionStrategy
Defines how to process suppressed conflict
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
_isErrorMode
When set to true means there was a problem during doMerge or doCompare.
|
protected MergeSessionInfo |
_sessionInfo
Holds all information about files being compared/merged
|
static java.lang.String |
COMPARE_MERGE_UI_PLUGIN_ID |
protected AbstractMergeManager.ConflictSuppressionStrategy |
conflictSuppressionStrategy |
static java.lang.String |
IGNORE_ANCESTOR_GUID_FOR_MERGE |
Constructor and Description |
---|
AbstractMergeManager()
Constructs a new AbstractMergeManager.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canMergeWithoutAncestor() |
abstract void |
close()
This method is to be called from outside when the Compare/Merge Session
is to be completed.
|
static void |
copyInputToOutput(IInputOutputDescriptor input,
IInputOutputDescriptor output)
Performs simple binary copy from input to output
|
static CompareResult |
doBinaryFileCompare(IInputOutputDescriptor left,
IInputOutputDescriptor right)
Performs a simple binary comparison of two contributors.
|
protected void |
enterErrorMode()
Enters the "Error mode" in case of major error in doMerge()/doCompare().
|
IMergeSessionCompareInput |
getCompareInput(MergeSessionInfo info)
Sub class can use the default compare input or override this method to
return a custom compare input.
|
AbstractMergeManager.ConflictSuppressionStrategy |
getConflictSuppressionStrategy() |
java.lang.String |
getContentTypeID()
Finds the content type id of current merge manager from merge session
info.
|
java.lang.Object |
getController()
Returns controller object if mergeManager was created from controller
|
java.lang.Object |
getMergeDescription()
Retrieves the description of last compare/merge operation.
|
MergeStatusType |
getMergeStatus()
Retrieves operation status of last compare/merge operation.
|
int |
getPriority()
This method is use only when there is more than one conflict merge
manager registered for the same content type.
|
MergeSessionInfo |
getSessionInfo()
Retrieves the related merge session info.
|
void |
init(MergeSessionInfo sessionInfo)
Initializes the Merge Manager.
|
boolean |
isEmptySession()
Determines whether compare/merge session has no differences/conflicts or
not
|
boolean |
isErrorMode()
Determines whether merge manager is in the "Error Mode" or not
|
abstract boolean |
isMergeCompleted()
Determines whether merge operation has been completed.
|
boolean |
isMyFileMustBeMergeByMeInEclipseOnly()
Flags for repository provider (such as ClearCase) to determine whether
the file type that registered for this merge manager can be merged
outside of the current IDE with text compare applications (such as
cleardiffmerge.exe)
|
org.eclipse.core.runtime.IStatus |
merge(java.io.OutputStream output,
java.lang.String outputEncoding,
java.io.InputStream ancestor,
java.lang.String ancestorEncoding,
java.io.InputStream target,
java.lang.String targetEncoding,
java.io.InputStream other,
java.lang.String otherEncoding,
org.eclipse.core.runtime.IProgressMonitor monitor)
Deprecated.
|
org.eclipse.core.runtime.IStatus |
merge(java.io.OutputStream output,
java.lang.String outputEncoding,
org.eclipse.core.resources.IStorage ancestor,
org.eclipse.core.resources.IStorage target,
org.eclipse.core.resources.IStorage other,
org.eclipse.core.runtime.IProgressMonitor monitor)
Performs a merge operation on the given storage instances and writes the merge result to the output stream.
|
static java.io.InputStream |
openInputStream(IInputOutputDescriptor descriptor)
Opens an InputStream that is to be used to access the contributor's data.
|
static java.io.OutputStream |
openOutputStream(IInputOutputDescriptor descriptor)
Will open an OutputStream that can be used to save the result of the
merge operation.
|
abstract void |
run(org.eclipse.core.runtime.IProgressMonitor monitor)
Performs the Compare or Merge operation, depending on the information in
the MergeSessionInfo provided through init() method.
|
void |
saveMergedContributor()
During the merge session will save the result of the merge in a merged
IInputOutputDescriptor.
|
abstract boolean |
saveMergedContributorAs(IInputOutputDescriptor output)
During the merge session will save the result of the merge in the
specified IInputOutputDescriptor.
|
abstract void |
saveMergedContributorCopy(java.lang.String toPath)
During the merge session will save a copy of the result of the merge in a
merged IInputOutputDescriptor.
|
abstract void |
saveMergedContributorCopy(java.lang.String dir,
java.lang.String rootModelName)
During the merge session will save a copy of the result of the merge in a
merged IInputOutputDescriptor.
|
void |
setConflictSuppressionStrategy(AbstractMergeManager.ConflictSuppressionStrategy strategy) |
void |
setContentType(org.eclipse.core.runtime.content.IContentType contentType) |
void |
setController(java.lang.Object controller)
Set controller object for this merge manager
|
protected void |
setStatus(MergeStatusType status,
java.lang.Object mergeDescription)
To be called internally during the compare/merge operation to store the
status for future retrieval by the caller.
|
protected MergeSessionInfo _sessionInfo
protected boolean _isErrorMode
protected AbstractMergeManager.ConflictSuppressionStrategy conflictSuppressionStrategy
public static final java.lang.String IGNORE_ANCESTOR_GUID_FOR_MERGE
public static final java.lang.String COMPARE_MERGE_UI_PLUGIN_ID
public AbstractMergeManager()
public void init(MergeSessionInfo sessionInfo)
sessionInfo
- that contains all necessary information about version to be
merged.public abstract void run(org.eclipse.core.runtime.IProgressMonitor monitor)
run
in interface org.eclipse.jface.operation.IRunnableWithProgress
monitor
- to display the progresspublic MergeSessionInfo getSessionInfo()
public MergeStatusType getMergeStatus()
public java.lang.Object getMergeDescription()
public boolean isErrorMode()
public boolean isEmptySession()
protected void enterErrorMode()
protected void setStatus(MergeStatusType status, java.lang.Object mergeDescription)
public abstract boolean isMergeCompleted()
public void saveMergedContributor() throws java.io.IOException
java.io.IOException
- if i/o error occurredpublic abstract boolean saveMergedContributorAs(IInputOutputDescriptor output) throws java.io.IOException
output
- the save destinationjava.io.IOException
- if i/o error occurredpublic abstract void saveMergedContributorCopy(java.lang.String toPath) throws java.io.IOException
toPath
- the absolute file path where to savejava.io.IOException
- if i/o error occurredpublic abstract void saveMergedContributorCopy(java.lang.String dir, java.lang.String rootModelName) throws java.io.IOException
dir
- the absolute directory path where to save
rootModelName
the name of the root model filejava.io.IOException
- if i/o error occurredpublic abstract void close()
public static CompareResult doBinaryFileCompare(IInputOutputDescriptor left, IInputOutputDescriptor right) throws java.io.IOException
left
- contributorright
- contributorjava.io.IOException
- in case of errorspublic static void copyInputToOutput(IInputOutputDescriptor input, IInputOutputDescriptor output) throws java.io.IOException
input
- to copy fromoutput
- to copy tojava.io.IOException
- in case of errorspublic static java.io.InputStream openInputStream(IInputOutputDescriptor descriptor) throws java.io.IOException
descriptor
- to open stream onjava.io.IOException
public static java.io.OutputStream openOutputStream(IInputOutputDescriptor descriptor) throws java.io.IOException
descriptor
- to open the stream onjava.io.IOException
public IMergeSessionCompareInput getCompareInput(MergeSessionInfo info)
info
- The session info object contains merge information.public java.lang.String getContentTypeID()
public void setContentType(org.eclipse.core.runtime.content.IContentType contentType)
public org.eclipse.core.runtime.IStatus merge(java.io.OutputStream output, java.lang.String outputEncoding, java.io.InputStream ancestor, java.lang.String ancestorEncoding, java.io.InputStream target, java.lang.String targetEncoding, java.io.InputStream other, java.lang.String otherEncoding, org.eclipse.core.runtime.IProgressMonitor monitor)
IStatus.OK
is returned, on error a status IStatus.ERROR
.
If the merge operation cannot deal with conflicts, the code of the error status has the value IStreamMerger.CONFLICT
.
For text oriented mergers the encoding for the input and output streams is honored.
It is the responsibility of callers to close input and output streams.merge
in interface org.eclipse.compare.IStreamMerger
output
- the byte stream to which the merge result is written; the merger will not close the streamoutputEncoding
- the encoding to use when writing to the output streamancestor
- the byte stream from which the common ancestor is readancestorEncoding
- the encoding of the ancestor input byte streamtarget
- the byte stream containing the target of the mergetargetEncoding
- the encoding of the target input byte streamother
- the byte stream containing the target of the mergeotherEncoding
- the encoding of the other input byte streammonitor
- reports progress of the merge operationIStreamMerger.merge(java.io.OutputStream, java.lang.String, java.io.InputStream, java.lang.String, java.io.InputStream, java.lang.String, java.io.InputStream, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
public boolean canMergeWithoutAncestor()
canMergeWithoutAncestor
in interface org.eclipse.team.core.mapping.IStorageMerger
public org.eclipse.core.runtime.IStatus merge(java.io.OutputStream output, java.lang.String outputEncoding, org.eclipse.core.resources.IStorage ancestor, org.eclipse.core.resources.IStorage target, org.eclipse.core.resources.IStorage other, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IStatus.OK
is returned, on error a status IStatus.ERROR
.
If the merge operation cannot deal with conflicts, the code of the error status has the value IStreamMerger.CONFLICT
.
For text oriented mergers the encoding for the input and output is honored if they implement
IEncodedStorage
.
It is the responsibility of callers to close the output stream.
The provided ancestor may be null
if this merger
returns true
from canMergeWithoutAncestor()
.
merge
in interface org.eclipse.team.core.mapping.IStorageMerger
output
- the byte stream to which the merge result is written; the merger will not close the streamoutputEncoding
- the encoding to use when writing to the output streamancestor
- the storage from which the common ancestor is readtarget
- the storage containing the target of the mergeother
- the storage containing the target of the mergemonitor
- reports progress of the merge operationorg.eclipse.core.runtime.CoreException
- if an error occurspublic int getPriority()
public boolean isMyFileMustBeMergeByMeInEclipseOnly()
public java.lang.Object getController()
public void setController(java.lang.Object controller)
controller
- public final void setConflictSuppressionStrategy(AbstractMergeManager.ConflictSuppressionStrategy strategy)
public final AbstractMergeManager.ConflictSuppressionStrategy getConflictSuppressionStrategy()