public abstract class WorkspaceModifyOperation extends Object implements IRunnableWithProgress, IThreadListener
If a scheduling rule is provided, the operation will obtain that scheduling
rule for the duration of its execute
method. If no scheduling
rule is provided, the operation will obtain a scheduling rule that locks
the entire workspace for the duration of the operation.
Subclasses must implement execute
to do the work of the
operation.
Modifier | Constructor and Description |
---|---|
protected |
WorkspaceModifyOperation()
Creates a new operation.
|
protected |
WorkspaceModifyOperation(ISchedulingRule rule)
Creates a new operation that will run using the provided
scheduling rule.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
execute(IProgressMonitor monitor)
Performs the steps that are to be treated as a single logical workspace
change.
|
ISchedulingRule |
getRule()
The scheduling rule.
|
void |
run(IProgressMonitor monitor)
The
WorkspaceModifyOperation implementation of this
IRunnableWithProgress method initiates a batch of changes by
invoking the execute method as a workspace runnable
(IWorkspaceRunnable ). |
void |
threadChange(Thread thread)
Notification that a thread change is occurring.
|
protected WorkspaceModifyOperation()
protected WorkspaceModifyOperation(ISchedulingRule rule)
rule
- The ISchedulingRule to use or null
.protected abstract void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException
Subclasses must implement this method.
monitor
- the progress monitor to use to display progress and field
user requests to cancelCoreException
- if the operation fails due to a CoreExceptionInvocationTargetException
- if the operation fails due to an exception other than CoreExceptionInterruptedException
- if the operation detects a request to cancel,
using IProgressMonitor.isCanceled()
, it should exit by throwing
InterruptedException
. It is also possible to throw
OperationCanceledException
, which gets mapped to InterruptedException
by the run
method.public final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
WorkspaceModifyOperation
implementation of this
IRunnableWithProgress
method initiates a batch of changes by
invoking the execute
method as a workspace runnable
(IWorkspaceRunnable
).run
in interface IRunnableWithProgress
monitor
- the progress monitor to use to display progress and receive
requests for cancelationInvocationTargetException
- if the run method must propagate a checked exception,
it should wrap it inside an InvocationTargetException
; runtime exceptions are automatically
wrapped in an InvocationTargetException
by the calling contextInterruptedException
- if the operation detects a request to cancel,
using IProgressMonitor.isCanceled()
, it should exit by throwing
InterruptedException
IRunnableContext.run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
public void threadChange(Thread thread)
IThreadListener
threadChange
in interface IThreadListener
thread
- The new threadpublic ISchedulingRule getRule()
null
.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.