Package org.eclipse.handly.ui.viewer

# Class ViewerFocusTracker

java.lang.Object
org.eclipse.handly.ui.viewer.ViewerFocusTracker

public class ViewerFocusTracker extends Object
Tracks focus of the given viewers.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ViewerFocusTracker(org.eclipse.jface.viewers.Viewer[] viewers, org.eclipse.jface.viewers.Viewer viewerInFocus)`
  Constructs a focus tracker for the given viewers.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `dispose()`
  Disposes of this focus tracker.
  `protected void`
  `focusChanged()`
  A callback method which is called when a viewer gets focus.
  `final org.eclipse.jface.viewers.Viewer`
  `getViewerInFocus()`
  Returns the last viewer that gained focus.

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

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

- ## Constructor Details

  - ### ViewerFocusTracker

    public ViewerFocusTracker(org.eclipse.jface.viewers.Viewer[] viewers, org.eclipse.jface.viewers.Viewer viewerInFocus)
    Constructs a focus tracker for the given viewers. Adds a `FocusListener` to each of the viewers.
    Parameters:
      `viewers` - the viewers to be tracked for focus changes (not `null`)
      `viewerInFocus` - the initial value for the viewer in focus (may be `null`)
    See Also:
      - `getViewerInFocus()`

- ## Method Details

  - ### dispose

    public void dispose()
    Disposes of this focus tracker.

    The `ViewerFocusTracker` implementation of this method removes the registered `FocusListener` from each viewer. Subclasses may extend this method.

  - ### getViewerInFocus

    public final org.eclipse.jface.viewers.Viewer getViewerInFocus()
    Returns the last viewer that gained focus.
    Returns:
      the last viewer in focus, or `null` if none

  - ### focusChanged

    protected void focusChanged()
    A callback method which is called when a viewer gets focus.