Class FilteringOutlinePopup
- All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
- Direct Known Subclasses:
HandlyOutlinePopup
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA pattern-based element matcher for the outline popup.protected classExtendsOutlinePopup.OutlineTreeViewerto allow expanding any tree item when the pattern-based filter is active.protected static classA string pattern matcher that supports '*' and '?' wildcards.Nested classes/interfaces inherited from class org.eclipse.handly.ui.quickoutline.OutlinePopup
OutlinePopup.OutlineTreeViewerNested 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 org.eclipse.swt.widgets.TextcreateFilterText(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.ControlcreateTitleControl(org.eclipse.swt.widgets.Composite parent) protected org.eclipse.swt.widgets.ControlcreateTitleMenuArea(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 final org.eclipse.swt.widgets.TextReturns the filter text control of this outline popup.protected ObjectReturns the current focal element for this outline popup.protected org.eclipse.swt.widgets.ControlReturns the current pattern matcher for this outline popup.voidinit(IOutlinePopupHost host, org.eclipse.jface.bindings.keys.KeyStroke invokingKeyStroke) Initializes this outline popup with the given host and, optionally, invoking keystroke.protected voidNotifies that the pattern matcher has been updated.protected voidSelects the first element that matches the current filter pattern.protected voidsetTabOrder(org.eclipse.swt.widgets.Composite composite) protected final voidupdatePatternMatcher(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, updateInfoTextMethods 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, 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
-
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 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.FilteringOutlinePopupextends this method to add apattern matcherbased filter to the outline popup's tree viewer.- Overrides:
initin classOutlinePopup- Parameters:
host- the host of this outline popup (notnull)invokingKeyStroke- the keystroke for invoking this outline popup, ornullif 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
nullif 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
nullif none - See Also:
-
getFocusControl
protected org.eclipse.swt.widgets.Control getFocusControl()- Overrides:
getFocusControlin classOutlinePopup
-
setTabOrder
protected void setTabOrder(org.eclipse.swt.widgets.Composite composite) - Overrides:
setTabOrderin 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:
createTreeViewerin 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:
createTitleMenuAreain classorg.eclipse.jface.dialogs.PopupDialog
-
createTitleControl
protected org.eclipse.swt.widgets.Control createTitleControl(org.eclipse.swt.widgets.Composite parent) This implementation creates the
filter textcontrol. It usescreateFilterText(Composite)to create the control.- Overrides:
createTitleControlin 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 keyis set, this implementation adds theinvoking key listenerto 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 instancecreatedfor the given pattern andnotifiesof the update.- Parameters:
pattern- the pattern string (notnull)- See Also:
-
createPatternMatcher
Returns a new pattern matcher based on the given pattern. May returnnullif no filtering is required.This implementation returns
nullif the pattern is an empty string. Otherwise, it appends '*' to the pattern if the pattern does not already end with '*', and returns anFilteringOutlinePopup.ElementMatcherbased on aFilteringOutlinePopup.StringMatcherfor 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
nullif 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
selectsthe 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 selectedelement. Subclasses may override.- Returns:
- the current focal element for this outline popup,
or
nullif none
-