public abstract class FilteringOutlinePopup extends OutlinePopup
Modifier and Type | Class and Description |
---|---|
protected class |
FilteringOutlinePopup.ElementMatcher
A pattern-based element matcher for the outline popup.
|
protected class |
FilteringOutlinePopup.FilteringOutlineTreeViewer
Extends
OutlinePopup.OutlineTreeViewer to allow expanding
any tree item when the pattern-based filter is active. |
protected static class |
FilteringOutlinePopup.StringMatcher
A string pattern matcher that supports '*' and '?' wildcards.
|
OutlinePopup.OutlineTreeViewer
Constructor and Description |
---|
FilteringOutlinePopup() |
Modifier and Type | Method and Description |
---|---|
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.
|
protected java.util.function.Predicate<java.lang.Object> |
createPatternMatcher(java.lang.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 org.eclipse.swt.widgets.Text |
getFilterText()
Returns the filter text control of this outline popup.
|
protected java.lang.Object |
getFocalElement()
Returns the current focal element for this outline popup.
|
protected org.eclipse.swt.widgets.Control |
getFocusControl() |
protected java.util.function.Predicate<java.lang.Object> |
getPatternMatcher()
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 |
patternMatcherUpdated()
Notifies that the pattern matcher has been updated.
|
protected void |
selectFirstMatch()
Selects the first element that matches the current filter pattern.
|
protected void |
setTabOrder(org.eclipse.swt.widgets.Composite composite) |
protected void |
updatePatternMatcher(java.lang.String pattern)
|
changeOutlineMode, computeInitialSelection, computeInput, createDialogArea, getContentProvider, getCorrespondingElement, getDefaultLocation, getDialogSettings, getHost, getInitialSelection, getInvokingKeyListener, getInvokingKeyStroke, getLabelProvider, getSelectedElement, getTreeViewer, gotoSelectedElement, initDecorationContext, isAutoExpandable, revealInHost, shouldUseHashlookup, updateInfoText
adjustBounds, applyBackgroundColor, applyForegroundColor, close, configureShell, createContents, createInfoTextArea, 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 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.
FilteringOutlinePopup
extends this method to add
a pattern matcher
based filter to
the outline popup's tree viewer.
init
in class OutlinePopup
host
- the host of this outline popup (not null
)invokingKeyStroke
- the keystroke for invoking this outline popup,
or null
if noneprotected final org.eclipse.swt.widgets.Text getFilterText()
null
if it has not been created yetprotected final java.util.function.Predicate<java.lang.Object> getPatternMatcher()
null
if noneupdatePatternMatcher(String)
protected org.eclipse.swt.widgets.Control getFocusControl()
getFocusControl
in class OutlinePopup
protected void setTabOrder(org.eclipse.swt.widgets.Composite composite)
setTabOrder
in class OutlinePopup
protected org.eclipse.jface.viewers.TreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite parent)
This implementation returns a new instance of
FilteringOutlinePopup.FilteringOutlineTreeViewer
.
createTreeViewer
in class OutlinePopup
parent
- the parent composite (never null
)null
)protected org.eclipse.swt.widgets.Control createTitleMenuArea(org.eclipse.swt.widgets.Composite parent)
createTitleMenuArea
in class org.eclipse.jface.dialogs.PopupDialog
protected org.eclipse.swt.widgets.Control createTitleControl(org.eclipse.swt.widgets.Composite parent)
This implementation creates the filter text
control. It uses createFilterText(Composite)
to create the control.
createTitleControl
in class org.eclipse.jface.dialogs.PopupDialog
protected org.eclipse.swt.widgets.Text createFilterText(org.eclipse.swt.widgets.Composite parent)
This implementation creates a text control that:
updatePatternMatcher(String)
when the text is modified.OutlinePopup.gotoSelectedElement()
when the ENTER key is pressed.PopupDialog.close()
when the ESC key is pressed.
If an invoking key
is set,
this implementation adds the invoking key listener
to the created control.
parent
- the parent composite (never null
)null
)protected final void updatePatternMatcher(java.lang.String pattern)
created
for the given pattern
and notifies
of the update.pattern
- the pattern string (not null
)getPatternMatcher()
protected java.util.function.Predicate<java.lang.Object> createPatternMatcher(java.lang.String pattern)
null
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 an FilteringOutlinePopup.ElementMatcher
based on a FilteringOutlinePopup.StringMatcher
for the pattern. Case-insensitive
matching is enabled if, and only if, the pattern is all lower-case.
pattern
- the pattern string (not null
)null
if no filtering is requiredprotected void patternMatcherUpdated()
This implementation refreshes the tree viewer, expands all nodes
of the tree, and selects
the first
matching element.
protected void selectFirstMatch()
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.
protected java.lang.Object getFocalElement()
This implementation returns the initially selected
element. Subclasses may override.
null
if noneCopyright (c) 2014, 2018 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0