Class ContentOutline

All Implemented Interfaces:
IAdaptable, IExecutableExtension, ISelectionChangedListener, ISelectionProvider, IPartListener, IPersistable, IViewPart, IWorkbenchPart, IWorkbenchPart2, IWorkbenchPart3, IWorkbenchPartOrientation

public class ContentOutline extends PageBookView implements ISelectionProvider, ISelectionChangedListener
Main class for the Content Outline View.

This standard view has id "org.eclipse.ui.views.ContentOutline".

When a content outline view notices an editor being activated, it asks the editor whether it has a content outline page to include in the outline view. This is done using getAdapter:
 IEditorPart editor = ...;
 IContentOutlinePage outlinePage = (IContentOutlinePage) editor.getAdapter(IContentOutlinePage.class);
 if (outlinePage != null) {
    // editor wishes to contribute outlinePage to content outline view
 }
 

If the editor supports a content outline page, the editor instantiates and configures the page, and returns it. This page is then added to the content outline view (a pagebook which presents one page at a time) and immediately made the current page (the content outline view need not be visible). If the editor does not support a content outline page, the content outline view shows a special default page which makes it clear to the user that the content outline view is disengaged. A content outline page is free to report selection events; the content outline view forwards these events along to interested parties. When the content outline view notices a different editor being activated, it flips to the editor's corresponding content outline page. When the content outline view notices an editor being closed, it destroys the editor's corresponding content outline page.

The workbench will automatically instantiate this class when a Content Outline view is needed for a workbench window. This class was not intended to be instantiated or subclassed by clients.

Restriction:
This class is not intended to be subclassed by clients.
Restriction:
This class is not intended to be instantiated by clients.
  • Field Details

    • PREFIX

      public static final String PREFIX
      The plugin prefix.
      See Also:
    • CONTENT_OUTLINE_VIEW_HELP_CONTEXT_ID

      public static final String CONTENT_OUTLINE_VIEW_HELP_CONTEXT_ID
      Help context id used for the content outline view (value "org.eclipse.ui.content_outline_context").
      See Also:
  • Constructor Details

    • ContentOutline

      public ContentOutline()
      Creates a content outline view with no content outline pages.
  • Method Details

    • addSelectionChangedListener

      public void addSelectionChangedListener(ISelectionChangedListener listener)
      Description copied from interface: ISelectionProvider
      Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.
      Specified by:
      addSelectionChangedListener in interface ISelectionProvider
      Parameters:
      listener - a selection changed listener
    • createDefaultPage

      protected IPage createDefaultPage(PageBook book)
      Description copied from class: PageBookView
      Creates and returns the default page for this view.

      Subclasses must implement this method.

      Subclasses must call initPage with the new page (if it is an IPageBookViewPage) before calling createControl on the page.

      Specified by:
      createDefaultPage in class PageBookView
      Parameters:
      book - the pagebook control
      Returns:
      the default page
    • createPartControl

      public void createPartControl(Composite parent)
      The PageBookView implementation of this IWorkbenchPart method creates a PageBook control with its default page showing.
      Specified by:
      createPartControl in interface IWorkbenchPart
      Overrides:
      createPartControl in class PageBookView
      Parameters:
      parent - the parent control
    • doCreatePage

      protected PageBookView.PageRec doCreatePage(IWorkbenchPart part)
      Description copied from class: PageBookView
      Creates a new page in the pagebook for a particular part. This page will be made visible whenever the part is active, and will be destroyed with a call to doDestroyPage.

      Subclasses must implement this method.

      Subclasses must call initPage with the new page (if it is an IPageBookViewPage) before calling createControl on the page.

      Specified by:
      doCreatePage in class PageBookView
      Parameters:
      part - the input part
      Returns:
      the record describing a new page for this view
      See Also:
    • doDestroyPage

      protected void doDestroyPage(IWorkbenchPart part, PageBookView.PageRec rec)
      Description copied from class: PageBookView
      Destroys a page in the pagebook for a particular part. This page was returned as a result from doCreatePage.

      Subclasses must implement this method.

      Specified by:
      doDestroyPage in class PageBookView
      Parameters:
      part - the input part
      rec - a page record for the part
      See Also:
    • getAdapter

      public <T> T getAdapter(Class<T> key)
      Description copied from class: PageBookView
      The PageBookView implementation of this IAdaptable method delegates to the current page, if it implements IAdaptable.
      Specified by:
      getAdapter in interface IAdaptable
      Overrides:
      getAdapter in class PageBookView
      Type Parameters:
      T - the class type
      Parameters:
      key - the adapter class to look up
      Returns:
      a object of the given class, or null if this object does not have an adapter for the given class
    • getBootstrapPart

      protected IWorkbenchPart getBootstrapPart()
      Description copied from class: PageBookView
      Returns the active, important workbench part for this view.

      When the page book view is created it has no idea which part within the workbook should be used to generate the first page. Therefore, it delegates the choice to subclasses of PageBookView.

      Implementors of this method should return an active, important part in the workbench or null if none found.

      Subclasses must implement this method.

      Specified by:
      getBootstrapPart in class PageBookView
      Returns:
      the active important part, or null if none
    • getSelection

      public ISelection getSelection()
      Description copied from interface: ISelectionProvider
      Returns the current selection for this provider.
      Specified by:
      getSelection in interface ISelectionProvider
      Returns:
      the current selection
    • isImportant

      protected boolean isImportant(IWorkbenchPart part)
      Description copied from class: PageBookView
      Returns whether the given part should be added to this view.

      Subclasses must implement this method.

      Specified by:
      isImportant in class PageBookView
      Parameters:
      part - the input part
      Returns:
      true if the part is relevant, and false otherwise
    • partBroughtToTop

      public void partBroughtToTop(IWorkbenchPart part)
      Description copied from class: PageBookView
      The PageBookView implementation of this IPartListener method does nothing. Subclasses may extend.
      Specified by:
      partBroughtToTop in interface IPartListener
      Overrides:
      partBroughtToTop in class PageBookView
      Parameters:
      part - the part that was surfaced
      See Also:
    • removeSelectionChangedListener

      public void removeSelectionChangedListener(ISelectionChangedListener listener)
      Description copied from interface: ISelectionProvider
      Removes the given selection change listener from this selection provider. Has no effect if an identical listener is not registered.
      Specified by:
      removeSelectionChangedListener in interface ISelectionProvider
      Parameters:
      listener - a selection changed listener
    • selectionChanged

      public void selectionChanged(SelectionChangedEvent event)
      Description copied from interface: ISelectionChangedListener
      Notifies that the selection has changed.
      Specified by:
      selectionChanged in interface ISelectionChangedListener
      Parameters:
      event - event object describing the change
    • setSelection

      public void setSelection(ISelection selection)
      Description copied from interface: ISelectionProvider
      Sets the current selection for this selection provider.
      Specified by:
      setSelection in interface ISelectionProvider
      Parameters:
      selection - the new selection
    • showPageRec

      protected void showPageRec(PageBookView.PageRec pageRec)
      The ContentOutline implementation of this PageBookView method extends the behavior of its parent to use the current page as a selection provider.
      Overrides:
      showPageRec in class PageBookView
      Parameters:
      pageRec - the page record containing the page to show