Class ContentOutlinePage

  • All Implemented Interfaces:
    ISelectionChangedListener, ISelectionProvider, IPage, IPageBookViewPage, IContentOutlinePage

    public abstract class ContentOutlinePage
    extends Page
    implements IContentOutlinePage, ISelectionChangedListener
    An abstract base class for content outline pages.

    Clients who are defining an editor may elect to provide a corresponding content outline page. This content outline page will be presented to the user via the standard Content Outline View (the user decides whether their workbench window contains this view) whenever that editor is active. This class should be subclassed.

    Internally, each content outline page consists of a standard tree viewer; selections made in the tree viewer are reported as selection change events by the page (which is a selection provider). The tree viewer is not created until createPage is called; consequently, subclasses must extend createControl to configure the tree viewer with a proper content provider, label provider, and input element.

    Subclasses may provide a hint for constructing the tree viewer using getTreeStyle().

    Note that those wanting to use a control other than internally created TreeViewer will need to implement IContentOutlinePage directly rather than subclassing this class.

    • Constructor Detail

      • ContentOutlinePage

        protected ContentOutlinePage()
        Create a new content outline page.
    • Method Detail

      • createControl

        public void createControl​(Composite parent)
        The ContentOutlinePage implementation of this IContentOutlinePage method creates a tree viewer. Subclasses must extend this method configure the tree viewer with a proper content provider, label provider, and input element.
        Specified by:
        createControl in interface IPage
        Specified by:
        createControl in class Page
        Parameters:
        parent -
      • getTreeStyle

        protected int getTreeStyle()
        A hint for the styles to use while constructing the TreeViewer.

        Subclasses may override.

        Returns:
        the tree styles to use. By default, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL
        Since:
        3.6
      • fireSelectionChanged

        protected void fireSelectionChanged​(ISelection selection)
        Fires a selection changed event.
        Parameters:
        selection - the new selection
      • getControl

        public Control getControl()
        Description copied from class: Page
        The Page implementation of this IPage method returns null. Subclasses must reimplement.
        Specified by:
        getControl in interface IPage
        Specified by:
        getControl in class Page
        Returns:
        the SWT control for this page, or null if this page does not have a control
      • getTreeViewer

        protected TreeViewer getTreeViewer()
        Returns this page's tree viewer.
        Returns:
        this page's tree viewer, or null if createControl has not been called yet
      • init

        public void init​(IPageSite pageSite)
        Description copied from class: Page
        The Page implementation of this IPageBookViewPage method stores a reference to the supplied site (the site which contains this page).

        Subclasses may extend.

        Specified by:
        init in interface IPageBookViewPage
        Overrides:
        init in class Page
        Parameters:
        pageSite - the page site
      • setFocus

        public void setFocus()
        Sets focus to a part in the page.
        Specified by:
        setFocus in interface IPage
        Specified by:
        setFocus in class Page