Package org.eclipse.handly.ui.outline

# Class ProblemMarkerListenerContribution

java.lang.Object
org.eclipse.handly.ui.outline.OutlineContribution
org.eclipse.handly.ui.outline.ResourceChangeListenerContribution
org.eclipse.handly.ui.outline.ProblemMarkerListenerContribution

All Implemented Interfaces:
  `IOutlineContribution`

public class ProblemMarkerListenerContribution extends ResourceChangeListenerContribution
Refreshes the outline when problem markers attached to the underlying resource change.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ProblemMarkerListenerContribution()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `affects(org.eclipse.core.resources.IResourceChangeEvent event, Object inputElement)`
  Returns whether the given resource change event affects the outline's input element.
  `protected IContentAdapter`
  `getContentAdapter()`
  Returns the installed content adapter, or a `NullContentAdapter` if none.
  `protected boolean`
  `hasProblemMarkerChanges(org.eclipse.core.resources.IResourceDelta delta)`
  Returns whether the given resource delta describes problem marker changes.
  `protected void`
  `resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)`
  Notifies that the outline page is affected in some way by the given resource change event.

  ### Methods inherited from class org.eclipse.handly.ui.outline.ResourceChangeListenerContribution

  `dispose, init`

  ### Methods inherited from class org.eclipse.handly.ui.outline.OutlineContribution

  `getOutlinePage`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ProblemMarkerListenerContribution

    public ProblemMarkerListenerContribution()

- ## Method Details

  - ### resourceChanged

    protected void resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)
    Notifies that the outline page is affected in some way by the given resource change event.

    Note: This method may be called in any thread. The event object (and the delta within it) is valid only for the duration of the invocation of this method.

    This implementation schedules a full refresh of the outline page's tree viewer in the UI thread.

    Specified by:
      `resourceChanged` in class `ResourceChangeListenerContribution`
    Parameters:
      `event` - never `null`

  - ### affects

    protected boolean affects(org.eclipse.core.resources.IResourceChangeEvent event, Object inputElement)
    Returns whether the given resource change event affects the outline's input element.

    This implementation checks whether the given resource change event affects problem markers attached to the corresponding resource of the input element. It uses `hasProblemMarkerChanges(IResourceDelta)` to check the corresponding resource delta. The corresponding resource is determined as follows:

    - If the input element is an `IResource`, the corresponding resource is the element itself.
    - Otherwise, if the input element could be adapted to an `IElement` through the `content adapter`, the corresponding resource is obtained via `Elements.getResource(IElement)`.
    - Otherwise, the input element is adapted to an `IResource` via `ResourceUtil.getResource(Object)`.
    Specified by:
      `affects` in class `ResourceChangeListenerContribution`
    Parameters:
      `event` - never `null`
      `inputElement` - never `null`
    Returns:
      `true` if the given resource change event affects the outline's input element, and `false` otherwise

  - ### hasProblemMarkerChanges

    protected boolean hasProblemMarkerChanges(org.eclipse.core.resources.IResourceDelta delta)
    Returns whether the given resource delta describes problem marker changes.
    Parameters:
      `delta` - the resource delta (never `null`)
    Returns:
      `true` if the given resource delta describes problem marker changes, and `false` otherwise

  - ### getContentAdapter

    protected IContentAdapter getContentAdapter()
    Returns the installed content adapter, or a `NullContentAdapter` if none.

    This implementation returns the content adapter provided by the outline page, if the outline page is an `IContentAdapterProvider`.

    Returns:
      an `IContentAdapter` (never `null`)