|
Eclipse Platform Release 3.2 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.runtime.jobs.JobChangeAdapter
org.eclipse.team.ui.TeamOperation
org.eclipse.team.ui.synchronize.ModelOperation
org.eclipse.team.ui.synchronize.ModelMergeOperation
A model operation that executes a merge according to the merge lifecycle
associated with an IMergeContext
and IResourceMappingMerger
instances obtained from the model providers involved.
Constructor Summary | |
---|---|
protected |
ModelMergeOperation(IWorkbenchPart part,
ISynchronizationScopeManager manager)
Create a model merge operation. |
Method Summary | |
---|---|
protected void |
execute(IProgressMonitor monitor)
Perform a merge. |
protected void |
executeMerge(IProgressMonitor monitor)
Perform a merge. |
protected void |
handleMergeFailure(IStatus status)
Method invoked when the context contains unmergable changes. |
protected void |
handleNoChanges()
Method invoked when the context contains no changes. |
protected void |
handlePreviewRequest()
A preview of the merge has been requested. |
protected void |
handleValidationFailure(IStatus status)
Method invoked when the context contains changes that failed validation by at least one IResourceMappingMerger .
|
protected boolean |
hasChangesOfInterest()
Return whether the context of this operation has changes that are of interest to the operation. |
protected abstract void |
initializeContext(IProgressMonitor monitor)
Initialize the merge context for this merge operation. |
protected IStatus |
performMerge(IProgressMonitor monitor)
Attempt a headless merge of the elements in the context of this operation. |
protected IStatus |
performMerge(ModelProvider provider,
IProgressMonitor monitor)
Attempt to merge all the mappings that come from the given provider. |
static IStatus |
validateMerge(IMergeContext context,
IProgressMonitor monitor)
Validate the merge context with the model providers that have mappings in the scope of the context. |
Methods inherited from class org.eclipse.team.ui.synchronize.ModelOperation |
---|
beginOperation, endOperation, getContext, getPreviewRequestMessage, getScope, getScopeManager, initializeScope, isPreviewRequested, promptForInputChange, promptIfInputChange, run, sortByExtension |
Methods inherited from class org.eclipse.team.ui.TeamOperation |
---|
belongsTo, canRunAsJob, getGotoAction, getJobName, getKeepOperation, getOperationIcon, getPart, getSchedulingRule, getShell, isKeepOneProgressServiceEntry, isPostponeAutobuild, isSameFamilyAs, isUserInitiated, run, shouldRun |
Methods inherited from class org.eclipse.core.runtime.jobs.JobChangeAdapter |
---|
aboutToRun, awake, done, running, scheduled, sleeping |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected ModelMergeOperation(IWorkbenchPart part, ISynchronizationScopeManager manager)
part
- the workbench part from which the operation was requested or null
manager
- the scope managerMethod Detail |
public static IStatus validateMerge(IMergeContext context, IProgressMonitor monitor)
IResourceMappingMerger
for each
model provider will be consulted and any non-OK status will be
accumulated and returned,
context
- the merge context being validatedmonitor
- a progress monitor
protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
initializeContext(IProgressMonitor)
is
called to determine the set of resource changes. Then the
executeMerge(IProgressMonitor)
method is invoked.
execute
in class ModelOperation
monitor
- a progress monitor
InvocationTargetException
InterruptedException
protected void executeMerge(IProgressMonitor monitor) throws CoreException
execute(IProgressMonitor)
after the context has been
initialized. If there are changes in the context, they will be validating
by calling validateMerge(IMergeContext, IProgressMonitor)
. If
there are no validation problems, performMerge(IProgressMonitor)
will then be called to perform the merge. If there are problems encountered
or if a preview was requested, handlePreviewRequest()
is called.
monitor
- a progress monitor
CoreException
protected void handlePreviewRequest()
ModelOperation.getPreviewRequestMessage()
to have the option presented to the user if the scope changes.
protected abstract void initializeContext(IProgressMonitor monitor) throws CoreException
ModelOperation.getContext()
method must return an instance of IMergeContext
that is fully initialized.
monitor
- a progress monitor
CoreException
protected void handleValidationFailure(IStatus status)
IResourceMappingMerger
.
By default, the user is prompted to inform them that unmergeable changes were found
and the handlePreviewRequest()
method is invoked.
Subclasses may override.
status
- the status returned from the mergers that reported the validation failuresprotected void handleMergeFailure(IStatus status)
status
- the status returned from the merger that reported the conflictprotected void handleNoChanges()
protected IStatus performMerge(IProgressMonitor monitor) throws CoreException
IResourceMappingMerger
for the model providers in the context's
scope. The merger of the model providers are invoked in the order
determined by the ModelOperation.sortByExtension(ModelProvider[])
method. The method will stop on the first conflict encountered.
This method will throw a runtime exception
if the operation does not have a merge context.
monitor
- a progress monitor
CoreException
- if an error occurredprotected IStatus performMerge(ModelProvider provider, IProgressMonitor monitor) throws CoreException
IResourceMappingMerger.merge(IMergeContext, IProgressMonitor)
method but does not wait for the context to update (see ISynchronizationContext
.
Callers that are invoking the merge on multiple models should wait until the
context has updated before invoking merge on another merger. The following
line of code will wait for the context to update:
Platform.getJobManager().join(getContext(), monitor);
This method will throw a runtime exception if the operation does not have a merge context.
provider
- the model provider whose mappings are to be mergedmonitor
- a progress monitor
CoreException
- if an error occurredprotected boolean hasChangesOfInterest()
|
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.