Package 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
Modifier and TypeClassDescriptionprotected class
A tree viewer for theCommonOutlinePage
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 Object
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
Notifies that the outline page's editor input has changed.protected abstract org.eclipse.jface.viewers.ITreeContentProvider
Returns the content provider that is to be used by the outline page's tree viewer.final org.eclipse.swt.widgets.Control
final org.eclipse.ui.IEditorPart
Returns the editor which created this outline page.protected abstract org.eclipse.jface.viewers.IBaseLabelProvider
Returns the label provider that is to be used by the outline page's tree viewer.org.eclipse.jface.viewers.ISelection
final org.eclipse.jface.viewers.TreeViewer
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
Hook to register global action handlers.void
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
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.IPage
setActionBars
Methods inherited from interface org.eclipse.ui.part.IPageBookViewPage
getSite
-
Constructor Details
-
CommonOutlinePage
public CommonOutlinePage()
-
-
Method Details
-
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 interfaceICommonOutlinePage
- 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 interfaceICommonOutlinePage
- Parameters:
editor
- the editor which created this outline page (notnull
)
-
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 interfaceICommonOutlinePage
- Returns:
- the editor which created this outline page,
or
null
if it has not been set yet
-
addOutlineContribution
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 interfaceICommonOutlinePage
- Parameters:
contribution
- notnull
-
removeOutlineContribution
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 interfaceICommonOutlinePage
- Parameters:
contribution
- notnull
-
addInputChangeListener
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 interfaceICommonOutlinePage
- Parameters:
listener
- notnull
-
removeInputChangeListener
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 interfaceICommonOutlinePage
- Parameters:
listener
- notnull
-
init
public void init(org.eclipse.ui.part.IPageSite pageSite) - Specified by:
init
in interfaceorg.eclipse.ui.part.IPageBookViewPage
- Overrides:
init
in classorg.eclipse.ui.part.Page
-
getControl
public final org.eclipse.swt.widgets.Control getControl()- Specified by:
getControl
in interfaceorg.eclipse.ui.part.IPage
- Specified by:
getControl
in classorg.eclipse.ui.part.Page
-
createControl
public void createControl(org.eclipse.swt.widgets.Composite parent) - Specified by:
createControl
in interfaceorg.eclipse.ui.part.IPage
- Specified by:
createControl
in classorg.eclipse.ui.part.Page
-
setFocus
public void setFocus()- Specified by:
setFocus
in interfaceorg.eclipse.ui.part.IPage
- Specified by:
setFocus
in classorg.eclipse.ui.part.Page
-
dispose
public void dispose()- Specified by:
dispose
in interfaceorg.eclipse.ui.part.IPage
- Overrides:
dispose
in classorg.eclipse.ui.part.Page
-
getSelection
public org.eclipse.jface.viewers.ISelection getSelection()- Specified by:
getSelection
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
setSelection
public void setSelection(org.eclipse.jface.viewers.ISelection selection) - Specified by:
setSelection
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
addSelectionChangedListener
public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) - Specified by:
addSelectionChangedListener
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
removeSelectionChangedListener
public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) - Specified by:
removeSelectionChangedListener
in interfaceorg.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
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 (nevernull
)- 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'sexpandXXX
methods. If it returnsfalse
, the item is to be collapsed, rather than expanded.Default implementation returns
true
for the root item andfalse
for all other items. Subclasses may override.- Parameters:
item
- the tree item (nevernull
)- 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 nameIContentAdapterProvider.class.getName()
.- Parameters:
context
- the decoration context (nevernull
)
-