public abstract class OutlinePopup
extends org.eclipse.jface.dialogs.PopupDialog
Modifier and Type | Class and Description |
---|---|
protected class |
OutlinePopup.OutlineTreeViewer
A tree viewer for the
OutlinePopup . |
Constructor and Description |
---|
OutlinePopup()
Creates a new outline popup.
|
Modifier and Type | Method and Description |
---|---|
protected void |
changeOutlineMode()
Changes the mode of this outline popup.
|
protected java.lang.Object |
computeInitialSelection()
Computes the element to be selected initially in the outline popup's
tree viewer.
|
protected abstract java.lang.Object |
computeInput()
Computes the input element for the outline popup's tree viewer.
|
protected org.eclipse.swt.widgets.Control |
createDialogArea(org.eclipse.swt.widgets.Composite parent) |
protected org.eclipse.jface.viewers.TreeViewer |
createTreeViewer(org.eclipse.swt.widgets.Composite parent)
Creates a tree viewer for this outline popup.
|
protected abstract org.eclipse.jface.viewers.ITreeContentProvider |
getContentProvider()
Returns the content provider that is to be used by the outline popup's
tree viewer.
|
protected abstract java.lang.Object |
getCorrespondingElement(org.eclipse.jface.viewers.ISelection hostSelection)
Returns the outline element corresponding to the given host selection.
|
protected org.eclipse.swt.graphics.Point |
getDefaultLocation(org.eclipse.swt.graphics.Point initialSize) |
protected org.eclipse.jface.dialogs.IDialogSettings |
getDialogSettings() |
protected org.eclipse.swt.widgets.Control |
getFocusControl() |
protected IOutlinePopupHost |
getHost()
Returns the host of this outline popup.
|
protected java.lang.Object |
getInitialSelection()
Returns the initially selected outline element.
|
protected org.eclipse.swt.events.KeyListener |
getInvokingKeyListener()
Returns the invoking key listener.
|
protected org.eclipse.jface.bindings.keys.KeyStroke |
getInvokingKeyStroke()
Returns the keystroke for invoking this outline popup.
|
protected abstract org.eclipse.jface.viewers.IBaseLabelProvider |
getLabelProvider()
Returns the label provider that is to be used by the outline popup's
tree viewer.
|
protected java.lang.Object |
getSelectedElement()
Returns the currently selected outline element.
|
protected org.eclipse.jface.viewers.TreeViewer |
getTreeViewer()
Returns the tree viewer of this outline popup.
|
protected void |
gotoSelectedElement()
Attempts to reveal the currently selected outline element in the
outline popup's host.
|
void |
init(IOutlinePopupHost host,
org.eclipse.jface.bindings.keys.KeyStroke invokingKeyStroke)
Initializes this outline popup with the given host and, optionally,
invoking keystroke.
|
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.
|
protected abstract boolean |
revealInHost(java.lang.Object outlineElement)
Attempts to reveal the given outline element in the outline popup's host.
|
protected void |
setTabOrder(org.eclipse.swt.widgets.Composite composite) |
protected boolean |
shouldUseHashlookup()
Returns whether the outline popup's tree viewer should use hash lookup.
|
protected void |
updateInfoText()
Updates the text to be shown in the popup's info area.
|
adjustBounds, applyBackgroundColor, applyForegroundColor, close, configureShell, createContents, createInfoTextArea, createTitleControl, createTitleMenuArea, fillDialogMenu, getBackground, getBackgroundColorExclusions, getDefaultSize, getForeground, getForegroundColorExclusions, getInitialLocation, getInitialSize, getPersistBounds, getPersistLocation, getPersistSize, hasInfoArea, hasTitleArea, open, saveDialogBounds, setInfoText, setTitleText, showDialogMenu
canHandleShellCloseEvent, constrainShellSize, create, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, initializeBounds, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
public OutlinePopup()
Note: The parent shell will be set when this outline popup is initialized with its host.
init(IOutlinePopupHost, KeyStroke)
public void init(IOutlinePopupHost host, org.eclipse.jface.bindings.keys.KeyStroke invokingKeyStroke)
open
the outline popup.
This method may be extended by subclasses. Subclasses must call the superclass implementation.
OutlinePopup
implementation of this method sets
the parent shell to the shell of the SWT control of the given host,
creates all controls of the outline popup, including the tree viewer
, initializes the tree viewer
with the content
- and label
providers as well as the input
, and sets the initial selection
in the tree viewer and the text
in the popup's
info area.
host
- the host of this outline popup (not null
)invokingKeyStroke
- the keystroke for invoking this outline popup,
or null
if noneprotected final IOutlinePopupHost getHost()
null
if it has not been set yetprotected final org.eclipse.jface.bindings.keys.KeyStroke getInvokingKeyStroke()
null
if noneprotected final org.eclipse.jface.viewers.TreeViewer getTreeViewer()
null
if it has not been created yetprotected final java.lang.Object getInitialSelection()
null
if noneprotected final java.lang.Object getSelectedElement()
null
if noneprotected org.eclipse.swt.widgets.Control getFocusControl()
getFocusControl
in class org.eclipse.jface.dialogs.PopupDialog
protected void setTabOrder(org.eclipse.swt.widgets.Composite composite)
setTabOrder
in class org.eclipse.jface.dialogs.PopupDialog
protected org.eclipse.swt.graphics.Point getDefaultLocation(org.eclipse.swt.graphics.Point initialSize)
getDefaultLocation
in class org.eclipse.jface.dialogs.PopupDialog
protected org.eclipse.jface.dialogs.IDialogSettings getDialogSettings()
getDialogSettings
in class org.eclipse.jface.dialogs.PopupDialog
protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
createDialogArea
in class org.eclipse.jface.dialogs.PopupDialog
protected org.eclipse.jface.viewers.TreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite parent)
This implementation returns a new instance of OutlinePopup.OutlineTreeViewer
.
parent
- the parent composite (never null
)null
)protected void updateInfoText()
This implementation sets a default text. Subclasses may override.
protected void gotoSelectedElement()
This implementation uses revealInHost(Object)
for revealing
the currently selected outline element.
protected void changeOutlineMode()
Default implementation does nothing. Subclasses may override.
protected boolean shouldUseHashlookup()
Default implementation returns true
.
Subclasses may override.
StructuredViewer.setUseHashlookup(boolean)
protected abstract org.eclipse.jface.viewers.ITreeContentProvider getContentProvider()
null
)protected abstract org.eclipse.jface.viewers.IBaseLabelProvider getLabelProvider()
null
)protected abstract java.lang.Object computeInput()
null
)protected java.lang.Object computeInitialSelection()
This implementation obtains the current selection in the outline popup's
host and delegates to getCorrespondingElement(ISelection)
if the
selection is not null
or empty.
null
if noneprotected abstract java.lang.Object getCorrespondingElement(org.eclipse.jface.viewers.ISelection hostSelection)
hostSelection
- the host selection (never null
, never empty)null
if there is no such elementprotected abstract boolean revealInHost(java.lang.Object outlineElement)
outlineElement
- the outline element (never null
)true
if the element was successfully revealed;
false
otherwiseprotected boolean isAutoExpandable(org.eclipse.swt.widgets.TreeItem item)
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.
item
- the tree item (never null
)true
if the given item is auto-expandable;
false
otherwiseprotected void initDecorationContext(org.eclipse.jface.viewers.DecorationContext context)
If this outline popup implements IContentAdapterProvider
,
default implementation registers this outline popup in the given context
under the name IContentAdapterProvider.class.getName()
.
context
- the decoration context (never null
)protected final org.eclipse.swt.events.KeyListener getInvokingKeyListener()
invoking key
is pressed, this listener changes
the mode of the outline popup and updates
the
text in the popup's info area.null
)Copyright (c) 2014, 2018 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0