Class ProblemsLabelDecorator

All Implemented Interfaces:
org.eclipse.jface.viewers.IBaseLabelProvider, org.eclipse.jface.viewers.ILabelDecorator, org.eclipse.jface.viewers.ILightweightLabelDecorator

public class ProblemsLabelDecorator extends Object implements org.eclipse.jface.viewers.ILabelDecorator, org.eclipse.jface.viewers.ILightweightLabelDecorator
LabelDecorator that decorates an element's image with error and warning overlays that represent the severity of markers attached to the element's underlying resource. To see a problem decoration for a marker, the marker needs to be a subtype of IMarker.PROBLEM.

Important: Although this decorator implements ILightweightLabelDecorator, do not contribute this class as a decorator to the org.eclipse.ui.decorators extension. Only use this class in your own views and label providers.

  • Constructor Details

    • ProblemsLabelDecorator

      public ProblemsLabelDecorator()
      Creates a new ProblemsLabelDecorator.
    • ProblemsLabelDecorator

      public ProblemsLabelDecorator(org.eclipse.jdt.internal.ui.viewsupport.ImageDescriptorRegistry registry)
      Note: This constructor is for internal use only. Clients should not call this constructor.
      registry - The registry to use or null to use the Java plugin's image registry
      This constructor is not intended to be referenced by clients.
  • Method Details

    • decorateText

      public String decorateText(String text, Object element)
      Specified by:
      decorateText in interface org.eclipse.jface.viewers.ILabelDecorator
    • decorateImage

      public decorateImage( image, Object obj)
      Specified by:
      decorateImage in interface org.eclipse.jface.viewers.ILabelDecorator
    • computeAdornmentFlags

      protected int computeAdornmentFlags(Object obj)
      Computes the adornment flags for the given element.
      obj - the element to compute the flags for
      the adornment flags
    • isInside

      protected boolean isInside(int pos, ISourceReference sourceElement) throws org.eclipse.core.runtime.CoreException
      Tests if a position is inside the source range of an element.
      pos - Position to be tested.
      sourceElement - Source element (must be a IJavaElement)
      boolean Return true if position is located inside the source element.
      org.eclipse.core.runtime.CoreException - Exception thrown if element range could not be accessed.
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.eclipse.jface.viewers.IBaseLabelProvider
    • isLabelProperty

      public boolean isLabelProperty(Object element, String property)
      Specified by:
      isLabelProperty in interface org.eclipse.jface.viewers.IBaseLabelProvider
    • addListener

      public void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener)
      Specified by:
      addListener in interface org.eclipse.jface.viewers.IBaseLabelProvider
    • removeListener

      public void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener)
      Specified by:
      removeListener in interface org.eclipse.jface.viewers.IBaseLabelProvider
    • decorate

      public void decorate(Object element, org.eclipse.jface.viewers.IDecoration decoration)
      Specified by:
      decorate in interface org.eclipse.jface.viewers.ILightweightLabelDecorator