|
Eclipse Platform Release 3.2 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The purpose of this interface is to provide support for model level
auto-merging. It is helpful in the cases where a file may contain multiple
model elements or a model element consists of multiple files. It can also be
used for cases where there is a one-to-one mapping between model elements and
files, although IStreamMerger
can also be used in that case.
Clients should group resource mappings by model provider and then attempt to
obtain a merger from the model provider using the adaptable mechanism as
follows:
Object o = mapping.getModelProvider().getAdapter(IResourceMappingMerger.class); if (o instanceof IResourceMappingMerger.class) { IResourceMappingMerger merger = (IResourceMappingMerger)o; ... }
Clients are not expected to implement this interface but should subclass
ResourceMappingMerger
instead.
ResourceMappingMerger
,
IStorageMerger
,
ResourceMapping
,
ModelProvider
,
IMergeContext
Method Summary | |
---|---|
ISchedulingRule |
getMergeRule(IMergeContext context)
Return the scheduling rule that is required to merge all the changes that apply to this merger in the given context. |
IStatus |
merge(IMergeContext mergeContext,
IProgressMonitor monitor)
Attempt to automatically merge the mappings of the merge context( MergeContext#getMappings() ).
|
IStatus |
validateMerge(IMergeContext mergeContext,
IProgressMonitor monitor)
Validate an auto-merge for the given context. |
Method Detail |
public IStatus merge(IMergeContext mergeContext, IProgressMonitor monitor) throws CoreException
MergeContext#getMappings()
).
The merge context provides access to the out-of-sync resources (MergeContext#getSyncInfoTree()
)
associated with the mappings to be merged. The set of provided mappings
may come from multiple model providers. A particular implementation of
this interface should only merge the mappings associated with their model
provider. Also, the set of resources may contain additional resources
that are not part of the mappings being merged. Implementors of this
interface should use the mappings to determine which resources to merge
and what additional semantics can be used to attempt the merge.
The type of merge to be performed depends on what is returned by the
MergeContext#getType()
method. If the type is
MergeContext.TWO_WAY
the merge will replace the local
contents with the remote contents, ignoring any local changes. For
THREE_WAY
, the base is used to attempt to merge remote
changes with local changes.
If merging was not possible for one or more of the mappings to which this
merge applies, these mappings should be returned in an
MergeStatus
whose code is
MergeStatus.CONFLICTS
and which provides access to the
mappings which could not be merged. Note that it is up to the model to
decide whether it wants to break one of the provided resource mappings
into several sub-mappings and attempt auto-merging at that level.
mergeContext
- a context that provides access to the resources
involved in the merge. The context must not be
null
.monitor
- a progress monitor
MergeStatus.CONFLICTS
indicates that some or all
of the resource mappings could not be merged. The mappings that
were not merged are available using
MergeStatus#getConflictingMappings()
CoreException
- if errors occurredpublic ISchedulingRule getMergeRule(IMergeContext context)
merge(IMergeContext, IProgressMonitor)
,
lients must ensure that they either have obtained
a rule that covers the rule returned by this method or
they must not hold any rule.
context
- the context that contains the changes to be merged
public IStatus validateMerge(IMergeContext mergeContext, IProgressMonitor monitor)
merge
method) but instead
to indicate that the nature of one of more incoming changes
is such that performing an auto-merge may be undesirable.
Clients should validate before performing the merge and, if
any of the returned status are not OK, should prompt the
user to make them aware of the potential side effects.
The user may still decide to attempt an auto-merge, in which case
the client may still invoke the merge
method.
mergeContext
- a context that provides access to the resources
involved in the merge. The context must not be
null
.monitor
- a progress monitor
|
Eclipse Platform Release 3.2 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.