Class FilteringOutlinePopup
- All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
- Direct Known Subclasses:
HandlyOutlinePopup
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
A pattern-based element matcher for the outline popup.protected class
ExtendsOutlinePopup.OutlineTreeViewer
to allow expanding any tree item when the pattern-based filter is active.protected static class
A string pattern matcher that supports '*' and '?' wildcards.Nested classes/interfaces inherited from class org.eclipse.handly.ui.quickoutline.OutlinePopup
OutlinePopup.OutlineTreeViewer
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.swt.widgets.Text
createFilterText
(org.eclipse.swt.widgets.Composite parent) Creates the text control to be used for entering the filter pattern.createPatternMatcher
(String pattern) Returns a new pattern matcher based on the given pattern.protected org.eclipse.swt.widgets.Control
createTitleControl
(org.eclipse.swt.widgets.Composite parent) protected org.eclipse.swt.widgets.Control
createTitleMenuArea
(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 final org.eclipse.swt.widgets.Text
Returns the filter text control of this outline popup.protected Object
Returns the current focal element for this outline popup.protected org.eclipse.swt.widgets.Control
Returns the current pattern matcher for this outline popup.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
Notifies that the pattern matcher has been updated.protected void
Selects the first element that matches the current filter pattern.protected void
setTabOrder
(org.eclipse.swt.widgets.Composite composite) protected final void
updatePatternMatcher
(String pattern) Methods inherited from class org.eclipse.handly.ui.quickoutline.OutlinePopup
changeOutlineMode, computeInitialSelection, computeInput, createDialogArea, getContentProvider, getCorrespondingElement, getDefaultLocation, getDialogSettings, getHost, getInitialSelection, getInvokingKeyListener, getInvokingKeyStroke, getLabelProvider, getSelectedElement, getTreeViewer, gotoSelectedElement, initDecorationContext, isAutoExpandable, revealInHost, shouldUseHashlookup, updateInfoText
Methods inherited from class org.eclipse.jface.dialogs.PopupDialog
adjustBounds, applyBackgroundColor, applyForegroundColor, close, configureShell, createContents, createInfoTextArea, 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
-
FilteringOutlinePopup
public FilteringOutlinePopup()
-
-
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.FilteringOutlinePopup
extends this method to add apattern matcher
based filter to the outline popup's tree viewer.- Overrides:
init
in classOutlinePopup
- Parameters:
host
- the host of this outline popup (notnull
)invokingKeyStroke
- the keystroke for invoking this outline popup, ornull
if none
-
getFilterText
protected final org.eclipse.swt.widgets.Text getFilterText()Returns the filter text control of this outline popup.- Returns:
- the filter text control of this outline popup,
or
null
if it has not been created yet
-
getPatternMatcher
Returns the current pattern matcher for this outline popup.- Returns:
- the current pattern matcher for this outline popup,
or
null
if none - See Also:
-
getFocusControl
protected org.eclipse.swt.widgets.Control getFocusControl()- Overrides:
getFocusControl
in classOutlinePopup
-
setTabOrder
protected void setTabOrder(org.eclipse.swt.widgets.Composite composite) - Overrides:
setTabOrder
in classOutlinePopup
-
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
FilteringOutlinePopup.FilteringOutlineTreeViewer
.- Overrides:
createTreeViewer
in classOutlinePopup
- Parameters:
parent
- the parent composite (nevernull
)- Returns:
- the created tree viewer (not
null
)
-
createTitleMenuArea
protected org.eclipse.swt.widgets.Control createTitleMenuArea(org.eclipse.swt.widgets.Composite parent) - Overrides:
createTitleMenuArea
in classorg.eclipse.jface.dialogs.PopupDialog
-
createTitleControl
protected org.eclipse.swt.widgets.Control createTitleControl(org.eclipse.swt.widgets.Composite parent) This implementation creates the
filter text
control. It usescreateFilterText(Composite)
to create the control.- Overrides:
createTitleControl
in classorg.eclipse.jface.dialogs.PopupDialog
-
createFilterText
protected org.eclipse.swt.widgets.Text createFilterText(org.eclipse.swt.widgets.Composite parent) Creates the text control to be used for entering the filter pattern.This implementation creates a text control that:
- Invokes
updatePatternMatcher(String)
when the text is modified. - Invokes
OutlinePopup.gotoSelectedElement()
when the ENTER key is pressed. - Sets the keyboard focus to the tree viewer when the DOWN ARROW or UP ARROW key is pressed.
- Invokes
PopupDialog.close()
when the ESC key is pressed.
If an
invoking key
is set, this implementation adds theinvoking key listener
to the created control.- Parameters:
parent
- the parent composite (nevernull
)- Returns:
- the created filter text control (not
null
)
- Invokes
-
updatePatternMatcher
Updates the current pattern matcher to an instancecreated
for the given pattern andnotifies
of the update.- Parameters:
pattern
- the pattern string (notnull
)- See Also:
-
createPatternMatcher
Returns a new pattern matcher based on the given pattern. May returnnull
if no filtering is required.This implementation returns
null
if the pattern is an empty string. Otherwise, it appends '*' to the pattern if the pattern does not already end with '*', and returns anFilteringOutlinePopup.ElementMatcher
based on aFilteringOutlinePopup.StringMatcher
for the pattern. Case-insensitive matching is enabled if, and only if, the pattern is all lower-case.- Parameters:
pattern
- the pattern string (notnull
)- Returns:
- the created pattern matcher, or
null
if no filtering is required
-
patternMatcherUpdated
protected void patternMatcherUpdated()Notifies that the pattern matcher has been updated.This implementation refreshes the tree viewer, expands all nodes of the tree, and
selects
the first matching element. -
selectFirstMatch
protected void selectFirstMatch()Selects the first element that matches the current filter pattern.This implementation starts the search from the
focal element
. If there is no focal element, the search is started from the root of the tree. -
getFocalElement
Returns the current focal element for this outline popup.This implementation returns the
initially selected
element. Subclasses may override.- Returns:
- the current focal element for this outline popup,
or
null
if none
-