Class OutlinePopup
- All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
- Direct Known Subclasses:
FilteringOutlinePopup
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
A tree viewer for theOutlinePopup
.Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
-
Field Summary
Fields inherited from class org.eclipse.jface.dialogs.PopupDialog
HOVER_SHELLSTYLE, INFOPOPUP_SHELLSTYLE, INFOPOPUPRESIZE_SHELLSTYLE, POPUP_HORIZONTALSPACING, POPUP_IMG_MENU, POPUP_IMG_MENU_DISABLED, POPUP_MARGINHEIGHT, POPUP_MARGINWIDTH, POPUP_VERTICALSPACING
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Changes the mode of this outline popup.protected Object
Computes the element to be selected initially in the outline popup's tree viewer.protected abstract Object
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
Returns the content provider that is to be used by the outline popup's tree viewer.protected abstract 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
protected org.eclipse.swt.widgets.Control
protected final IOutlinePopupHost
getHost()
Returns the host of this outline popup.protected final Object
Returns the initially selected outline element.protected final org.eclipse.swt.events.KeyListener
Returns the invoking key listener.protected final org.eclipse.jface.bindings.keys.KeyStroke
Returns the keystroke for invoking this outline popup.protected abstract org.eclipse.jface.viewers.IBaseLabelProvider
Returns the label provider that is to be used by the outline popup's tree viewer.protected final Object
Returns the currently selected outline element.protected final org.eclipse.jface.viewers.TreeViewer
Returns the tree viewer of this outline popup.protected void
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
(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
Returns whether the outline popup's tree viewer should use hash lookup.protected void
Updates the text to be shown in the popup's info area.Methods inherited from class org.eclipse.jface.dialogs.PopupDialog
adjustBounds, applyBackgroundColor, applyForegroundColor, close, configureShell, createContents, createInfoTextArea, createTitleControl, createTitleMenuArea, fillDialogMenu, getBackground, getBackgroundColorExclusions, getDefaultSize, getForeground, getForegroundColorExclusions, getInitialLocation, getInitialSize, getPersistLocation, getPersistSize, hasInfoArea, hasTitleArea, open, saveDialogBounds, setInfoText, setTitleText, showDialogMenu
Methods inherited from class org.eclipse.jface.window.Window
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
-
Constructor Details
-
OutlinePopup
public OutlinePopup()Creates a new outline popup.Note: The parent shell will be set when this outline popup is initialized with its host.
- See Also:
-
-
Method Details
-
init
public void init(IOutlinePopupHost host, org.eclipse.jface.bindings.keys.KeyStroke invokingKeyStroke) Initializes this outline popup with the given host and, optionally, invoking keystroke. This method must be called by clients before attempting toopen
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 thetree viewer
, initializes the tree viewer with thecontent
- andlabel
providers as well as theinput
, and sets theinitial selection
in the tree viewer and thetext
in the popup's info area.- Parameters:
host
- the host of this outline popup (notnull
)invokingKeyStroke
- the keystroke for invoking this outline popup, ornull
if none
-
getHost
Returns the host of this outline popup.- Returns:
- the host of this outline popup,
or
null
if it has not been set yet
-
getInvokingKeyStroke
protected final org.eclipse.jface.bindings.keys.KeyStroke getInvokingKeyStroke()Returns the keystroke for invoking this outline popup.- Returns:
- the keystroke for invoking this outline popup,
or
null
if none
-
getTreeViewer
protected final org.eclipse.jface.viewers.TreeViewer getTreeViewer()Returns the tree viewer of this outline popup.- Returns:
- the tree viewer of this outline popup,
or
null
if it has not been created yet
-
getInitialSelection
Returns the initially selected outline element.- Returns:
- the initially selected outline element,
or
null
if none
-
getSelectedElement
Returns the currently selected outline element.- Returns:
- the currently selected outline element,
or
null
if none
-
getFocusControl
protected org.eclipse.swt.widgets.Control getFocusControl()- Overrides:
getFocusControl
in classorg.eclipse.jface.dialogs.PopupDialog
-
setTabOrder
protected void setTabOrder(org.eclipse.swt.widgets.Composite composite) - Overrides:
setTabOrder
in classorg.eclipse.jface.dialogs.PopupDialog
-
getDefaultLocation
protected org.eclipse.swt.graphics.Point getDefaultLocation(org.eclipse.swt.graphics.Point initialSize) - Overrides:
getDefaultLocation
in classorg.eclipse.jface.dialogs.PopupDialog
-
getDialogSettings
protected org.eclipse.jface.dialogs.IDialogSettings getDialogSettings()- Overrides:
getDialogSettings
in classorg.eclipse.jface.dialogs.PopupDialog
-
createDialogArea
protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent) - Overrides:
createDialogArea
in classorg.eclipse.jface.dialogs.PopupDialog
-
createTreeViewer
protected org.eclipse.jface.viewers.TreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite parent) Creates a tree viewer for this outline popup. The viewer has no input, no content provider, a default label provider, no sorter, and no filters. This method is called once, when the popup's control is created.This implementation returns a new instance of
OutlinePopup.OutlineTreeViewer
.- Parameters:
parent
- the parent composite (nevernull
)- Returns:
- the created tree viewer (not
null
)
-
updateInfoText
protected void updateInfoText()Updates the text to be shown in the popup's info area.This implementation sets a default text. Subclasses may override.
-
gotoSelectedElement
protected void gotoSelectedElement()Attempts to reveal the currently selected outline element in the outline popup's host. If successful, closes this outline popup.This implementation uses
revealInHost(Object)
for revealing the currently selected outline element. -
changeOutlineMode
protected void changeOutlineMode()Changes the mode of this outline popup. This method is called when the invoking keystroke is pressed.Default implementation does nothing. Subclasses may override.
-
shouldUseHashlookup
protected boolean shouldUseHashlookup()Returns whether the outline popup's tree viewer should use hash lookup. This method is called once, when the popup'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 popup's tree viewer. This method is called once, when the popup'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 popup's tree viewer. This method is called once, when the popup's control is created.- Returns:
- the label provider (not
null
)
-
computeInput
Computes the input element for the outline popup's tree viewer. This method is called once, when the popup's control is created.- Returns:
- the input element (may be
null
)
-
computeInitialSelection
Computes the element to be selected initially in the outline popup's tree viewer. This method is called once, when the popup's control is created.This implementation obtains the current selection in the outline popup's host and delegates to
getCorrespondingElement(ISelection)
if the selection is notnull
or empty.- Returns:
- the element to be selected initially in this outline popup,
or
null
if none
-
getCorrespondingElement
protected abstract Object getCorrespondingElement(org.eclipse.jface.viewers.ISelection hostSelection) Returns the outline element corresponding to the given host selection.- Parameters:
hostSelection
- the host selection (nevernull
, never empty)- Returns:
- the outline element corresponding to the host selection,
or
null
if there is no such element
-
revealInHost
Attempts to reveal the given outline element in the outline popup's host.- Parameters:
outlineElement
- the outline element (nevernull
)- Returns:
true
if the element was successfully revealed;false
otherwise
-
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
-
initDecorationContext
protected void initDecorationContext(org.eclipse.jface.viewers.DecorationContext context) Hook to initialize decoration context. Subclasses may extend.If this outline popup implements
IContentAdapterProvider
, default implementation registers this outline popup in the given context under the nameIContentAdapterProvider.class.getName()
.- Parameters:
context
- the decoration context (nevernull
)
-
getInvokingKeyListener
protected final org.eclipse.swt.events.KeyListener getInvokingKeyListener()Returns the invoking key listener. When theinvoking key
is pressed, this listenerchanges
the mode of the outline popup andupdates
the text in the popup's info area.- Returns:
- the invoking key listener (never
null
)
-