public class ProblemMarkerLabelDecorator extends ProblemLabelDecorator
IMarker.PROBLEM.
Note that this decorator does not listen to problem marker changes. Hence, a viewer using this decorator requires a separate listener for updating elements on problem changes.
ProblemLabelDecorator.Severity| Constructor and Description |
|---|
ProblemMarkerLabelDecorator() |
| Modifier and Type | Method and Description |
|---|---|
protected ProblemLabelDecorator.Severity |
computeProblemSeverity(java.lang.Object element,
org.eclipse.jface.viewers.IDecorationContext context)
Computes problem severity for the given element taking into account
the provided context.
|
protected ProblemLabelDecorator.Severity |
computeProblemSeverityFromMarkers(java.lang.Object element,
org.eclipse.jface.viewers.IDecorationContext context)
Computes problem severity for the given element from markers attached
to the element's corresponding resource.
|
protected static ProblemLabelDecorator.Severity |
findMaxProblemSeverity(org.eclipse.core.resources.IResource resource,
int depth,
TextRange textRange)
Returns the maximum severity across problem markers attached to the
given resource, and, optionally, to its descendants.
|
protected IContentAdapter |
getContentAdapter(org.eclipse.jface.viewers.IDecorationContext context)
Returns the content adapter that defines a mapping between elements
of a Handly-based model and the viewer's content.
|
addListener, decorateImage, decorateImage, decorateText, decorateText, dispose, isLabelProperty, prepareDecoration, removeListenerprotected ProblemLabelDecorator.Severity computeProblemSeverity(java.lang.Object element, org.eclipse.jface.viewers.IDecorationContext context)
This implementation delegates to
computeProblemSeverityFromMarkers(Object, IDecorationContext),
suppressing and logging a CoreException if necessary.
computeProblemSeverity in class ProblemLabelDecoratorelement - never nullcontext - never nullnull if there is no problemprotected ProblemLabelDecorator.Severity computeProblemSeverityFromMarkers(java.lang.Object element, org.eclipse.jface.viewers.IDecorationContext context) throws org.eclipse.core.runtime.CoreException
This implementation returns the maximum severity across problem markers
attached to the element's corresponding resource and its descendants.
If the given element could be adapted to an IElement through
the content adapter and
the adapter element is an ISourceConstruct, only markers that
start strictly within the source construct's text range are considered.
The corresponding resource is determined as follows:
IResource, the corresponding resource
is the element itself.
IElement
through the content adapter, the corresponding resource is obtained via
Elements.getResource(IElement).
IResource via
ResourceUtil.getResource(Object).
element - never nullcontext - never nullnull if there is no problemorg.eclipse.core.runtime.CoreException - if an exception occurs while accessing markersprotected IContentAdapter getContentAdapter(org.eclipse.jface.viewers.IDecorationContext context)
This implementation requests the content adapter from the
IContentAdapterProvider registered in the decoration context
under the name IContentAdapterProvider.class.getName().
If no provider is available, a NullContentAdapter is returned.
context - never nullIContentAdapter (never null)protected static ProblemLabelDecorator.Severity findMaxProblemSeverity(org.eclipse.core.resources.IResource resource, int depth, TextRange textRange) throws org.eclipse.core.runtime.CoreException
start
strictly within the given
text range are considered. Returns null if there are no
matching markers.resource - not nulldepth - how far to recurse (see IResource.DEPTH_*
constants)textRange - the text range to further constrain the marker set,
or null. Makes sense only if the given resource is
a text filenullorg.eclipse.core.runtime.CoreException - if an exception occurs while accessing markersCopyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0