public class MarkerJob
extends org.eclipse.core.resources.WorkspaceJob
The job is useful to avoid deadlocks related to the global workspace lock which is needed to manipulate resource markers.
The job maintains an internal queue of marker manipulation tasks when the job gets executed this queue will be
processed. To execute the job asynchronously use the schedule method
.
Modifier and Type | Class and Description |
---|---|
protected static class |
MarkerJob.CreateMarkerTask |
protected static class |
MarkerJob.DeleteMarkerTask |
protected static class |
MarkerJob.MarkerTask |
Modifier and Type | Field and Description |
---|---|
static MarkerJob |
INSTANCE
Singleton instance of marker job that can be used to manipulate resource markers asynchronously without risking
to run into deadlocks.
|
protected java.util.Queue<MarkerJob.MarkerTask> |
taskQueue |
Modifier | Constructor and Description |
---|---|
protected |
MarkerJob()
Protected constructor for the singleton pattern that prevents from instantiation by clients.
|
Modifier and Type | Method and Description |
---|---|
void |
addCreateMarkerTask(org.eclipse.core.resources.IResource resource,
MarkerDescriptor markerDescriptor)
Adds a create marker task to the internal queue.
|
void |
addCreateMarkerTask(org.eclipse.core.resources.IResource resource,
java.lang.String type,
int severity,
java.lang.String message)
Adds a create marker task to the internal queue.
|
void |
addCreateMarkerTask(org.eclipse.core.resources.IResource resource,
java.lang.String type,
java.util.Map<java.lang.String,java.lang.Object> attributes)
Adds a create marker task to the internal queue.
|
void |
addDeleteMarkerTask(org.eclipse.core.resources.IResource resource,
java.lang.String type)
Adds a delete marker task to the internal queue which will delete all existing markers of the specified type.
|
org.eclipse.core.runtime.IStatus |
runInWorkspace(org.eclipse.core.runtime.IProgressMonitor monitor)
Processes the internal task queue.
|
addJobChangeListener, belongsTo, cancel, canceling, create, 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
public static final MarkerJob INSTANCE
Job.schedule()
protected java.util.Queue<MarkerJob.MarkerTask> taskQueue
protected MarkerJob()
public org.eclipse.core.runtime.IStatus runInWorkspace(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
runInWorkspace
in class org.eclipse.core.resources.WorkspaceJob
org.eclipse.core.runtime.CoreException
public void addCreateMarkerTask(org.eclipse.core.resources.IResource resource, java.lang.String type, int severity, java.lang.String message)
resource
- the resource for which the marker will be createdtype
- the marker typeseverity
- the marker severityseverity
- the marker messageIResource.createMarker(String)
public void addCreateMarkerTask(org.eclipse.core.resources.IResource resource, java.lang.String type, java.util.Map<java.lang.String,java.lang.Object> attributes)
resource
- the resource for which the marker will be createdtype
- the marker typeattributes
- marker attributes that will be passed to the newly created marker using
IMarker.setAttributes(Map)
.IResource.createMarker(String)
public void addCreateMarkerTask(org.eclipse.core.resources.IResource resource, MarkerDescriptor markerDescriptor)
resource
- the resource for which the marker will be createdmarkerDescriptor
- the marker descriptor which holds the marker type and the marker attributes that will be passed to the
newly created marker using IMarker.setAttributes(Map)
.IResource.createMarker(String)
public void addDeleteMarkerTask(org.eclipse.core.resources.IResource resource, java.lang.String type)
resource
- the resource for which markers will be deletedtype
- the marker type to deleteIResource.deleteMarkers(String, boolean, int)