public abstract class WorkspaceJob
extends org.eclipse.core.internal.resources.InternalWorkspaceJob
runInWorkspace
instead
of the usual Job.run
method.
After running a method that modifies resources in the workspace, registered listeners receive after-the-fact notification of what just transpired, in the form of a resource change event. This method allows clients to call a number of methods that modify resources and only have resource change event notifications reported at the end of the entire batch.
A WorkspaceJob is the asynchronous equivalent of IWorkspaceRunnable
Note that the workspace is not locked against other threads during the execution of a workspace job. Other threads can be modifying the workspace concurrently with a workspace job. To obtain exclusive access to a portion of the workspace, set the scheduling rule on the job to be a resource scheduling rule. The interface IResourceRuleFactory is used to create a scheduling rule for a particular workspace modification operation.
Constructor and Description |
---|
WorkspaceJob(String name)
Creates a new workspace job.
|
Modifier and Type | Method and Description |
---|---|
abstract IStatus |
runInWorkspace(IProgressMonitor monitor)
Runs the operation, reporting progress to and accepting
cancelation requests from the given progress monitor.
|
addJobChangeListener, belongsTo, cancel, done, getJobManager, getName, getPriority, getProperty, getResult, getRule, getState, getThread, isBlocking, isSystem, isUser, join, removeJobChangeListener, schedule, schedule, setName, setPriority, setProgressGroup, setProperty, setRule, setSystem, setThread, setUser, shouldRun, shouldSchedule, sleep, wakeUp, wakeUp
getAdapter
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAdapter
public WorkspaceJob(String name)
name
- the name of the jobpublic abstract IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException
Implementors of this method should check the progress monitor
for cancelation when it is safe and appropriate to do so. The cancelation
request should be propagated to the caller by throwing
OperationCanceledException
.
runInWorkspace
in class org.eclipse.core.internal.resources.InternalWorkspaceJob
monitor
- a progress monitor, or null
if progress
reporting and cancelation are not desiredCoreException
- if this operation fails.Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.