Package org.eclipse.team.ui.mapping
Class SynchronizationOperation
- java.lang.Object
-
- org.eclipse.core.runtime.jobs.JobChangeAdapter
-
- org.eclipse.team.ui.TeamOperation
-
- org.eclipse.team.ui.mapping.SynchronizationOperation
-
- All Implemented Interfaces:
IJobChangeListener
,IRunnableWithProgress
public abstract class SynchronizationOperation extends TeamOperation
This operation class can be used by model providers when performing merge operations triggered from a synchronize participant page associated with a synchronization or merge context.This class may be subclasses by clients.
- Since:
- 3.2
- See Also:
ISynchronizationContext
,IMergeContext
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SynchronizationOperation(ISynchronizePageConfiguration configuration, Object[] elements)
Create a synchronize operation that operations on the given elements
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
execute(IProgressMonitor monitor)
Execute the operation.ISynchronizePageConfiguration
getConfiguration()
Return the configuration for the page from which this operation was launched.protected ISynchronizationContext
getContext()
Return the synchronization context associated with this action.Object[]
getElements()
Return the model elements that are the target of this operation.SaveableComparison
getSaveable()
Return the saveable that this operation will write its results to ornull
if the operation does not buffer its results.void
run(IProgressMonitor monitor)
Runs this operation.boolean
shouldRun()
MakeshouldRun
public so the result can be used to provide handler enablement-
Methods inherited from class org.eclipse.team.ui.TeamOperation
belongsTo, canRunAsJob, getGotoAction, getJobName, getKeepOperation, getOperationIcon, getPart, getSchedulingRule, getShell, isKeepOneProgressServiceEntry, isPostponeAutobuild, isSameFamilyAs, isUserInitiated, run
-
Methods inherited from class org.eclipse.core.runtime.jobs.JobChangeAdapter
aboutToRun, awake, done, running, scheduled, sleeping
-
-
-
-
Constructor Detail
-
SynchronizationOperation
protected SynchronizationOperation(ISynchronizePageConfiguration configuration, Object[] elements)
Create a synchronize operation that operations on the given elements- Parameters:
configuration
- the configuration for the page the operation is associated withelements
- the elements to be operated on
-
-
Method Detail
-
getConfiguration
public ISynchronizePageConfiguration getConfiguration()
Return the configuration for the page from which this operation was launched.- Returns:
- the configuration for the page from which this operation was launched
-
getContext
protected ISynchronizationContext getContext()
Return the synchronization context associated with this action.- Returns:
- the synchronization context associated with this action
-
getElements
public Object[] getElements()
Return the model elements that are the target of this operation.- Returns:
- the model elements that are the target of this operation
-
shouldRun
public boolean shouldRun()
MakeshouldRun
public so the result can be used to provide handler enablement- Overrides:
shouldRun
in classTeamOperation
- Returns:
- whether the operation should be run.
-
getSaveable
public SaveableComparison getSaveable()
Return the saveable that this operation will write its results to ornull
if the operation does not buffer its results. By default,null
is returned but subclasses may override.- Returns:
- the saveable that this operation will write its results
to or
null
-
run
public final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
Description copied from interface:IRunnableWithProgress
Runs this operation. Progress should be reported to the given progress monitor. This method is usually invoked by anIRunnableContext
'srun
method, which supplies the progress monitor. A request to cancel the operation should be honored and acknowledged by throwingInterruptedException
.- Parameters:
monitor
- the progress monitor to use to display progress and receive requests for cancelation- Throws:
InvocationTargetException
- if the run method must propagate a checked exception, it should wrap it inside anInvocationTargetException
; runtime exceptions are automatically wrapped in anInvocationTargetException
by the calling contextInterruptedException
- if the operation detects a request to cancel, usingIProgressMonitor.isCanceled()
, it should exit by throwingInterruptedException
- See Also:
IRunnableContext.run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
-
execute
protected abstract void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
Execute the operation. Subclasses should implement the operations behavior in the execute method. Clients should call eitherTeamOperation.run()
orrun(IProgressMonitor)
to invoke the operation.- Parameters:
monitor
- a progress monitor- Throws:
InvocationTargetException
- if an error occursInterruptedException
- if operation is interrupted
-
-