- All Implemented Interfaces:
runInWorkspaceinstead of the usual
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. This mechanism is used to avoid unnecessary builds and notifications.
Platform may decide to perform notifications during the operation. The reason for this is that it is possible for multiple threads to be modifying the workspace concurrently. When one thread finishes modifying the workspace, a notification is required to prevent responsiveness problems, even if the other operation has not yet completed.
A WorkspaceJob is the asynchronous equivalent of ICoreRunnable
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
IResourceRuleFactory is used to create a scheduling rule
for a particular workspace modification operation.
Fields inherited from class org.eclipse.core.runtime.jobs.Job
ASYNC_FINISH, BUILD, DECORATE, INTERACTIVE, LONG, NONE, RUNNING, SHORT, SLEEPING, WAITING
Fields inherited from class org.eclipse.core.internal.jobs.InternalJob
(String name)Creates a new workspace job with the specified name.
Method SummaryModifier and TypeMethodDescription
(IProgressMonitor monitor)Runs the operation, reporting progress to and accepting cancellation requests from the given progress monitor.
Methods inherited from class org.eclipse.core.internal.resources.InternalWorkspaceJob
Methods inherited from class org.eclipse.core.runtime.jobs.Job
addJobChangeListener, belongsTo, cancel, canceling, create, create, createSystem, createSystem, done, getJobGroup, getJobManager, getName, getPriority, getProperty, getResult, getRule, getState, getThread, isBlocking, isSystem, isUser, join, join, removeJobChangeListener, schedule, schedule, setJobGroup, setName, setPriority, setProgressGroup, setProperty, setRule, setSystem, setThread, setUser, shouldRun, shouldSchedule, sleep, toString, wakeUp, wakeUp, yieldRule
Methods inherited from class org.eclipse.core.internal.jobs.InternalJob
Methods inherited from class org.eclipse.core.runtime.PlatformObject
(String name)Creates a new workspace job with the specified name. The job name is a human-readable value that is displayed to users. The name does not need to be unique, but it must not be
name- the name of the job
runInWorkspacepublic abstract IStatus runInWorkspace
(IProgressMonitor monitor) throws CoreExceptionRuns the operation, reporting progress to and accepting cancellation requests from the given progress monitor.
Implementors of this method should check the progress monitor for cancellation when it is safe and appropriate to do so. The cancellation request should be propagated to the caller by throwing
- Specified by:
monitor- a progress monitor, or
nullif progress reporting and cancellation are not desired
- the result of running the operation
CoreException- if this operation fails.