Class OutlinePopup
- All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
- Direct Known Subclasses:
FilteringOutlinePopup
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA 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_VERTICALSPACINGFields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidChanges the mode of this outline popup.protected ObjectComputes the element to be selected initially in the outline popup's tree viewer.protected abstract ObjectComputes the input element for the outline popup's tree viewer.protected org.eclipse.swt.widgets.ControlcreateDialogArea(org.eclipse.swt.widgets.Composite parent) protected org.eclipse.jface.viewers.TreeViewercreateTreeViewer(org.eclipse.swt.widgets.Composite parent) Creates a tree viewer for this outline popup.protected abstract org.eclipse.jface.viewers.ITreeContentProviderReturns the content provider that is to be used by the outline popup's tree viewer.protected abstract ObjectgetCorrespondingElement(org.eclipse.jface.viewers.ISelection hostSelection) Returns the outline element corresponding to the given host selection.protected org.eclipse.swt.graphics.PointgetDefaultLocation(org.eclipse.swt.graphics.Point initialSize) protected org.eclipse.jface.dialogs.IDialogSettingsprotected org.eclipse.swt.widgets.Controlprotected final IOutlinePopupHostgetHost()Returns the host of this outline popup.protected final ObjectReturns the initially selected outline element.protected final org.eclipse.swt.events.KeyListenerReturns the invoking key listener.protected final org.eclipse.jface.bindings.keys.KeyStrokeReturns the keystroke for invoking this outline popup.protected abstract org.eclipse.jface.viewers.IBaseLabelProviderReturns the label provider that is to be used by the outline popup's tree viewer.protected final ObjectReturns the currently selected outline element.protected final org.eclipse.jface.viewers.TreeViewerReturns the tree viewer of this outline popup.protected voidAttempts to reveal the currently selected outline element in the outline popup's host.voidinit(IOutlinePopupHost host, org.eclipse.jface.bindings.keys.KeyStroke invokingKeyStroke) Initializes this outline popup with the given host and, optionally, invoking keystroke.protected voidinitDecorationContext(org.eclipse.jface.viewers.DecorationContext context) Hook to initialize decoration context.protected booleanisAutoExpandable(org.eclipse.swt.widgets.TreeItem item) Returns whether the given tree item is auto-expandable.protected abstract booleanrevealInHost(Object outlineElement) Attempts to reveal the given outline element in the outline popup's host.protected voidsetTabOrder(org.eclipse.swt.widgets.Composite composite) protected booleanReturns whether the outline popup's tree viewer should use hash lookup.protected voidUpdates 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, showDialogMenuMethods 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 toopenthe outline popup.This method may be extended by subclasses. Subclasses must call the superclass implementation.
OutlinePopupimplementation 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- andlabelproviders as well as theinput, and sets theinitial selectionin the tree viewer and thetextin the popup's info area.- Parameters:
host- the host of this outline popup (notnull)invokingKeyStroke- the keystroke for invoking this outline popup, ornullif none
-
getHost
Returns the host of this outline popup.- Returns:
- the host of this outline popup,
or
nullif 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
nullif 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
nullif it has not been created yet
-
getInitialSelection
Returns the initially selected outline element.- Returns:
- the initially selected outline element,
or
nullif none
-
getSelectedElement
Returns the currently selected outline element.- Returns:
- the currently selected outline element,
or
nullif none
-
getFocusControl
protected org.eclipse.swt.widgets.Control getFocusControl()- Overrides:
getFocusControlin classorg.eclipse.jface.dialogs.PopupDialog
-
setTabOrder
protected void setTabOrder(org.eclipse.swt.widgets.Composite composite) - Overrides:
setTabOrderin classorg.eclipse.jface.dialogs.PopupDialog
-
getDefaultLocation
protected org.eclipse.swt.graphics.Point getDefaultLocation(org.eclipse.swt.graphics.Point initialSize) - Overrides:
getDefaultLocationin classorg.eclipse.jface.dialogs.PopupDialog
-
getDialogSettings
protected org.eclipse.jface.dialogs.IDialogSettings getDialogSettings()- Overrides:
getDialogSettingsin classorg.eclipse.jface.dialogs.PopupDialog
-
createDialogArea
protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent) - Overrides:
createDialogAreain 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 notnullor empty.- Returns:
- the element to be selected initially in this outline popup,
or
nullif 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
nullif 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:
trueif the element was successfully revealed;falseotherwise
-
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'sexpandXXXmethods. If it returnsfalse, the item is to be collapsed rather than expanded.Default implementation returns
truefor the root item andfalsefor all other items. Subclasses may override.- Parameters:
item- the tree item (nevernull)- Returns:
trueif the given item is auto-expandable;falseotherwise
-
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 keyis pressed, this listenerchangesthe mode of the outline popup andupdatesthe text in the popup's info area.- Returns:
- the invoking key listener (never
null)
-