org.eclipse.handly.ui.outline

## Class CommonOutlinePage

- java.lang.Object
- - org.eclipse.ui.part.Page
  - - org.eclipse.handly.ui.outline.CommonOutlinePage

- All Implemented Interfaces:
    ICommonOutlinePage, org.eclipse.jface.viewers.ISelectionProvider, org.eclipse.ui.part.IPage, org.eclipse.ui.part.IPageBookViewPage, org.eclipse.ui.views.contentoutline.IContentOutlinePage
  Direct Known Subclasses:
    HandlyOutlinePage

      public abstract class CommonOutlinePage
      extends org.eclipse.ui.part.Page
      implements ICommonOutlinePage

  An abstract base implementation of `ICommonOutlinePage`.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `CommonOutlinePage.OutlineTreeViewer` A tree viewer for the `CommonOutlinePage`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommonOutlinePage()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addInputChangeListener(IOutlineInputChangeListener listener)` Adds the given input change listener.
    `void` | `addOutlineContribution(IOutlineContribution contribution)` Adds the given outline contribution.
    `void` | `addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)`
    `protected abstract java.lang.Object` | `computeInput()` Computes the input element for the outline page's tree viewer.
    `void` | `createControl(org.eclipse.swt.widgets.Composite parent)`
    `protected CommonOutlinePage.OutlineTreeViewer` | `createTreeViewer(org.eclipse.swt.widgets.Composite parent)` Creates a tree viewer for this outline page.
    `void` | `dispose()`
    `protected void` | `editorInputChanged()` Notifies that the outline page's editor input has changed.
    `protected abstract org.eclipse.jface.viewers.ITreeContentProvider` | `getContentProvider()` Returns the content provider that is to be used by the outline page's tree viewer.
    `org.eclipse.swt.widgets.Control` | `getControl()`
    `org.eclipse.ui.IEditorPart` | `getEditor()` Returns the editor which created this outline page.
    `protected abstract org.eclipse.jface.viewers.IBaseLabelProvider` | `getLabelProvider()` Returns the label provider that is to be used by the outline page's tree viewer.
    `org.eclipse.jface.viewers.ISelection` | `getSelection()`
    `org.eclipse.jface.viewers.TreeViewer` | `getTreeViewer()` Returns the tree viewer of this outline page.
    `void` | `init(org.eclipse.ui.IEditorPart editor)` Initializes this outline page with its corresponding editor.
    `void` | `init(org.eclipse.ui.part.IPageSite pageSite)`
    `protected void` | `initDecorationContext(org.eclipse.jface.viewers.DecorationContext context)` Hook to initialize decoration context.
    `protected boolean` | `isAutoExpandable(org.eclipse.swt.widgets.TreeItem item)` Returns whether the given tree item is auto-expandable.
    `void` | `refresh()` Completely refreshes this outline page's tree viewer, preserving expanded tree paths where possible.
    `protected void` | `registerGlobalActions()` Hook to register global action handlers.
    `void` | `removeInputChangeListener(IOutlineInputChangeListener listener)` Removes the given input change listener.
    `void` | `removeOutlineContribution(IOutlineContribution contribution)` Removes the given outline contribution.
    `void` | `removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)`
    `void` | `setFocus()`
    `void` | `setSelection(org.eclipse.jface.viewers.ISelection selection)`
    `protected boolean` | `shouldUseHashlookup()` Returns whether the outline page's tree viewer should use hash lookup.

    - ### Methods inherited from class org.eclipse.ui.part.Page

      `getSite, makeContributions, setActionBars`

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

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

    - ### Methods inherited from interface org.eclipse.handly.ui.outline.ICommonOutlinePage

      `getLexicalSortPreference, getLinkWithEditorPreference`

    - ### Methods inherited from interface org.eclipse.ui.part.IPageBookViewPage

      `getSite`

    - ### Methods inherited from interface org.eclipse.ui.part.IPage

      `setActionBars`

- - ### Constructor Detail

    - #### CommonOutlinePage

          public CommonOutlinePage()

  - ### Method Detail

    - #### getTreeViewer

          public final org.eclipse.jface.viewers.TreeViewer getTreeViewer()

      Description copied from interface: `ICommonOutlinePage`
      Returns the tree viewer of this outline page.
      Specified by:
        `getTreeViewer` in interface `ICommonOutlinePage`
      Returns:
        the tree viewer of this outline page, or `null` if it has not been created yet

    - #### init

          public void init(org.eclipse.ui.IEditorPart editor)

      Description copied from interface: `ICommonOutlinePage`
      Initializes this outline page with its corresponding editor. This method should be called by the editor shortly after page construction. Specifically, it must be called before the page's control is created.
      Specified by:
        `init` in interface `ICommonOutlinePage`
      Parameters:
        `editor` - the editor which created this outline page (not `null`)

    - #### getEditor

          public final org.eclipse.ui.IEditorPart getEditor()

      Description copied from interface: `ICommonOutlinePage`
      Returns the editor which created this outline page.
      Specified by:
        `getEditor` in interface `ICommonOutlinePage`
      Returns:
        the editor which created this outline page, or `null` if it has not been set yet

    - #### addOutlineContribution

          public void addOutlineContribution(IOutlineContribution contribution)

      Description copied from interface: `ICommonOutlinePage`
      Adds the given outline contribution. This method has no effect if the contribution is already registered.
      Specified by:
        `addOutlineContribution` in interface `ICommonOutlinePage`
      Parameters:
        `contribution` - not `null`

    - #### removeOutlineContribution

          public void removeOutlineContribution(IOutlineContribution contribution)

      Description copied from interface: `ICommonOutlinePage`
      Removes the given outline contribution. This method has no effect if the contribution was not already registered.
      Specified by:
        `removeOutlineContribution` in interface `ICommonOutlinePage`
      Parameters:
        `contribution` - not `null`

    - #### addInputChangeListener

          public void addInputChangeListener(IOutlineInputChangeListener listener)

      Description copied from interface: `ICommonOutlinePage`
      Adds the given input change listener. This method has no effect if the listener is already registered.
      Specified by:
        `addInputChangeListener` in interface `ICommonOutlinePage`
      Parameters:
        `listener` - not `null`

    - #### removeInputChangeListener

          public void removeInputChangeListener(IOutlineInputChangeListener listener)

      Description copied from interface: `ICommonOutlinePage`
      Removes the given input change listener. This method has no effect if the listener was not already registered.
      Specified by:
        `removeInputChangeListener` in interface `ICommonOutlinePage`
      Parameters:
        `listener` - not `null`

    - #### init

          public void init(org.eclipse.ui.part.IPageSite pageSite)

      Specified by:
        `init` in interface `org.eclipse.ui.part.IPageBookViewPage`
      Overrides:
        `init` in class `org.eclipse.ui.part.Page`

    - #### getControl

          public final org.eclipse.swt.widgets.Control getControl()

      Specified by:
        `getControl` in interface `org.eclipse.ui.part.IPage`
      Specified by:
        `getControl` in class `org.eclipse.ui.part.Page`

    - #### createControl

          public void createControl(org.eclipse.swt.widgets.Composite parent)

      Specified by:
        `createControl` in interface `org.eclipse.ui.part.IPage`
      Specified by:
        `createControl` in class `org.eclipse.ui.part.Page`

    - #### setFocus

          public void setFocus()

      Specified by:
        `setFocus` in interface `org.eclipse.ui.part.IPage`
      Specified by:
        `setFocus` in class `org.eclipse.ui.part.Page`

    - #### dispose

          public void dispose()

      Specified by:
        `dispose` in interface `org.eclipse.ui.part.IPage`
      Overrides:
        `dispose` in class `org.eclipse.ui.part.Page`

    - #### getSelection

          public org.eclipse.jface.viewers.ISelection getSelection()

      Specified by:
        `getSelection` in interface `org.eclipse.jface.viewers.ISelectionProvider`

    - #### setSelection

          public void setSelection(org.eclipse.jface.viewers.ISelection selection)

      Specified by:
        `setSelection` in interface `org.eclipse.jface.viewers.ISelectionProvider`

    - #### addSelectionChangedListener

          public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)

      Specified by:
        `addSelectionChangedListener` in interface `org.eclipse.jface.viewers.ISelectionProvider`

    - #### removeSelectionChangedListener

          public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)

      Specified by:
        `removeSelectionChangedListener` in interface `org.eclipse.jface.viewers.ISelectionProvider`

    - #### refresh

          public void refresh()

      Completely refreshes this outline page's tree viewer, preserving expanded tree paths where possible.

    - #### shouldUseHashlookup

          protected boolean shouldUseHashlookup()

      Returns whether the outline page's tree viewer should use hash lookup. This method is called once, when the page's control is created.

      Default implementation returns `true`. Subclasses may override.

      See Also:
        `StructuredViewer.setUseHashlookup(boolean)`

    - #### getContentProvider

          protected abstract org.eclipse.jface.viewers.ITreeContentProvider getContentProvider()

      Returns the content provider that is to be used by the outline page's tree viewer. This method is called once, when the page's control is created.
      Returns:
        the content provider (not `null`)

    - #### getLabelProvider

          protected abstract org.eclipse.jface.viewers.IBaseLabelProvider getLabelProvider()

      Returns the label provider that is to be used by the outline page's tree viewer. This method is called once, when the page's control is created.
      Returns:
        the label provider (not `null`)

    - #### computeInput

          protected abstract java.lang.Object computeInput()

      Computes the input element for the outline page's tree viewer.
      Returns:
        the input element (may be `null`)

    - #### createTreeViewer

          protected CommonOutlinePage.OutlineTreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite parent)

      Creates a tree viewer for this outline page. The viewer has no input, no content provider, a default label provider, no sorter, and no filters. This method is called once, when the page's control is created.
      Parameters:
        `parent` - the parent composite (never `null`)
      Returns:
        the created tree viewer (not `null`)

    - #### editorInputChanged

          protected void editorInputChanged()

      Notifies that the outline page's editor input has changed.

      Default implementation `computes` and sets the new input for the outline page's tree viewer. Subclasses may extend.

    - #### isAutoExpandable

          protected boolean isAutoExpandable(org.eclipse.swt.widgets.TreeItem item)

      Returns whether the given tree item is auto-expandable. This method should be consulted by the tree viewer's `expandXXX` methods. If it returns `false`, the item is to be collapsed, rather than expanded.

      Default implementation returns `true` for the root item and `false` for all other items. Subclasses may override.

      Parameters:
        `item` - the tree item (never `null`)
      Returns:
        `true` if the given item is auto-expandable; `false` otherwise

    - #### registerGlobalActions

          protected void registerGlobalActions()

      Hook to register global action handlers. Subclasses may extend or override.

      If the editor which created this outline page is a text editor, default implementation registers global action handlers for the following text editor actions: `UNDO`, `REDO`, `NEXT`, `PREVIOUS`.

    - #### initDecorationContext

          protected void initDecorationContext(org.eclipse.jface.viewers.DecorationContext context)

      Hook to initialize decoration context. Subclasses may extend.

      If this outline page implements `IContentAdapterProvider`, default implementation registers this outline page in the given context under the name `IContentAdapterProvider.class.getName()`.

      Parameters:
        `context` - the decoration context (never `null`)

Copyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0