public abstract class ContentOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener
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.
Modifier | Constructor and Description |
---|---|
protected |
ContentOutlinePage()
Create a new content outline page.
|
Modifier and Type | Method and Description |
---|---|
void |
addSelectionChangedListener(ISelectionChangedListener listener)
Adds a listener for selection changes in this selection provider.
|
void |
createControl(Composite parent)
The
ContentOutlinePage implementation of this
IContentOutlinePage method creates a tree viewer. |
protected void |
fireSelectionChanged(ISelection selection)
Fires a selection changed event.
|
Control |
getControl()
The
Page implementation of this IPage method returns
null . |
ISelection |
getSelection()
Returns the current selection for this provider.
|
protected int |
getTreeStyle()
A hint for the styles to use while constructing the TreeViewer.
|
protected TreeViewer |
getTreeViewer()
Returns this page's tree viewer.
|
void |
init(IPageSite pageSite)
The
Page implementation of this IPageBookViewPage method
stores a reference to the supplied site (the site which contains this
page). |
void |
removeSelectionChangedListener(ISelectionChangedListener listener)
Removes the given selection change listener from this selection provider.
|
void |
selectionChanged(SelectionChangedEvent event)
Notifies that the selection has changed.
|
void |
setFocus()
Sets focus to a part in the page.
|
void |
setSelection(ISelection selection)
Sets the current selection for this selection provider.
|
dispose, getSite, makeContributions, setActionBars
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
dispose, setActionBars
protected ContentOutlinePage()
public void addSelectionChangedListener(ISelectionChangedListener listener)
ISelectionProvider
addSelectionChangedListener
in interface ISelectionProvider
listener
- a selection changed listenerpublic void createControl(Composite parent)
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.createControl
in interface IPage
createControl
in class Page
parent
- protected int getTreeStyle()
Subclasses may override.
protected void fireSelectionChanged(ISelection selection)
selection
- the new selectionpublic Control getControl()
Page
Page
implementation of this IPage
method returns
null
. Subclasses must reimplement.getControl
in interface IPage
getControl
in class Page
null
if this
page does not have a controlpublic ISelection getSelection()
ISelectionProvider
getSelection
in interface ISelectionProvider
protected TreeViewer getTreeViewer()
null
if
createControl
has not been called yetpublic void init(IPageSite pageSite)
Page
Page
implementation of this IPageBookViewPage
method
stores a reference to the supplied site (the site which contains this
page).
Subclasses may extend.
init
in interface IPageBookViewPage
init
in class Page
pageSite
- the page sitepublic void removeSelectionChangedListener(ISelectionChangedListener listener)
ISelectionProvider
removeSelectionChangedListener
in interface ISelectionProvider
listener
- a selection changed listenerpublic void selectionChanged(SelectionChangedEvent event)
ISelectionChangedListener
selectionChanged
in interface ISelectionChangedListener
event
- event object describing the changepublic void setFocus()
public void setSelection(ISelection selection)
ISelectionProvider
setSelection
in interface ISelectionProvider
selection
- the new selection
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.