Package org.eclipse.handly.ui.navigator

# Class LinkHelper

java.lang.Object
org.eclipse.handly.ui.navigator.LinkHelper

All Implemented Interfaces:
  `org.eclipse.ui.navigator.ILinkHelper`

public abstract class LinkHelper extends Object implements org.eclipse.ui.navigator.ILinkHelper
A partial implementation of `ILinkHelper` for Handly-based models.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LinkHelper()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `activateEditor(org.eclipse.ui.IWorkbenchPage page, org.eclipse.jface.viewers.IStructuredSelection selection)`
  `org.eclipse.jface.viewers.IStructuredSelection`
  `findSelection(org.eclipse.ui.IEditorInput editorInput)`
  `protected EditorUtility`
  `getEditorUtility()`
  Returns the editor utility for this link helper.
  `protected abstract IInputElementProvider`
  `getInputElementProvider()`
  Returns the input element provider for this link helper.
  `protected abstract org.eclipse.ui.IViewPart`
  `getNavigatorView()`
  Returns the navigator view this link helper is for.

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

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

- ## Constructor Details

  - ### LinkHelper

    public LinkHelper()

- ## Method Details

  - ### findSelection

    public org.eclipse.jface.viewers.IStructuredSelection findSelection(org.eclipse.ui.IEditorInput editorInput)

    This implementation uses the `input element provider` to convert the given editor input to an `IElement` (the input element). It then attempts to obtain the current selection in the `navigator view` and returns it unchanged if the currently selected element could be adapted to an `IElement` and the adapter element is a descendant of the input element. Otherwise, it returns a structured selection containing a single object, the input element. If no `IElement` could be provided for the editor input, this implementation attempts to adapt the editor input to an `IFile` and returns a structured selection consisting of that file. If all else fails, `null` is returned.

    Specified by:
      `findSelection` in interface `org.eclipse.ui.navigator.ILinkHelper`

  - ### activateEditor

    public void activateEditor(org.eclipse.ui.IWorkbenchPage page, org.eclipse.jface.viewers.IStructuredSelection selection)

    This implementation does nothing if the given selection is `null` or empty or contains two or more elements. Otherwise, it uses the `editor utility` to find the editor for the selected element and to reveal the element in the editor.

    Specified by:
      `activateEditor` in interface `org.eclipse.ui.navigator.ILinkHelper`

  - ### getInputElementProvider

    protected abstract IInputElementProvider getInputElementProvider()
    Returns the input element provider for this link helper.
    Returns:
      the input element provider for this link helper (never `null`)

  - ### getNavigatorView

    protected abstract org.eclipse.ui.IViewPart getNavigatorView()
    Returns the navigator view this link helper is for.
    Returns:
      the navigator view this link helper is for, or `null`

  - ### getEditorUtility

    protected EditorUtility getEditorUtility()
    Returns the editor utility for this link helper.

    Default implementation returns `DefaultEditorUtility.INSTANCE`. Subclasses may override.

    Returns:
      the editor utility for this link helper (never `null`)