Package org.eclipse.jface.viewers
Class AbstractFilteredViewerComposite<T extends ViewerFilter>
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.jface.viewers.AbstractFilteredViewerComposite<T>
- All Implemented Interfaces:
Drawable
- Direct Known Subclasses:
FilteredTable
,FilteredTree
,FilteredTree
- Since:
- 3.36
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Composite
The Composite on which the filter controls are created.protected Text
The filter text widget to be used by this tree.protected String
The text to initially show in the filter text control.protected Composite
The parent composite of the filtered viewer.protected boolean
Whether or not to show the filter controls (text and clear button).Fields inherited from class org.eclipse.swt.widgets.Widget
nativeZoom
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractFilteredViewerComposite
(Composite parent, int style, long refreshJobDelayInMillis) Create a new instance of the receiver. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Clears the text in the filter text widget.protected void
createControl
(Composite parent, int style) Create the filtered viewer's controls.protected Composite
createFilterControls
(Composite parent) Create the filter controls.protected void
createFilterText
(Composite parent) Creates the filter text and adds listeners.protected abstract Text
doCreateFilterText
(Composite parent) Creates the text control for entering the filter text.Get the filter text for the receiver, if it was created.protected String
Convenience method to return the text of the filter control.protected String
Get the initial text for the receiver.Returns the pattern filter used by this tree.protected long
Return the time delay that should be used when scheduling the filter refresh job.abstract StructuredViewer
Get the structured viewer of the receiver.protected void
Create the filtered viewer.protected void
Select all text in the filter text field.protected void
setFilterText
(String filterText) Set the text in the filter control.void
setInitialText
(String text) Set the text that will be shown until the first focus.protected abstract void
Update the receiver after the text has changed.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsMode
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Field Details
-
filterText
The filter text widget to be used by this tree. This value may benull
if there is no filter widget, or if the controls have not yet been created. -
filterComposite
The Composite on which the filter controls are created. This is used to set the background color of the filter controls to match the surrounding controls. -
showFilterControls
protected boolean showFilterControlsWhether or not to show the filter controls (text and clear button). The default is to show these controls. This can be overridden by providing a setting in the product configuration file. For example, the setting to add to not show these controls in an 3x based application is: org.eclipse.ui/SHOW_FILTERED_TEXTS=false -
initialText
The text to initially show in the filter text control. -
parent
The parent composite of the filtered viewer.
-
-
Constructor Details
-
AbstractFilteredViewerComposite
Create a new instance of the receiver.- Parameters:
parent
- a widget which will be the parent this compositestyle
- the style used to construct this widgetrefreshJobDelayInMillis
- refresh delay in ms, the time to expand the tree after debounce
-
-
Method Details
-
init
Create the filtered viewer.- Parameters:
style
- the style bits for the viewer'sControl
filter
- the filter to be used
-
createControl
Create the filtered viewer's controls. Subclasses should override.- Parameters:
parent
- the parentstyle
- SWT style bits used to create the control
-
createFilterControls
Create the filter controls. By default, a text and corresponding tool bar button that clears the contents of the text is created. Subclasses may override.- Parameters:
parent
- parentComposite
of the filter controls- Returns:
- the
Composite
that contains the filter controls
-
createFilterText
Creates the filter text and adds listeners. This method callsdoCreateFilterText(Composite)
to create the text control. Subclasses should overridedoCreateFilterText(Composite)
instead of overriding this method.- Parameters:
parent
-Composite
of the filter text
-
doCreateFilterText
Creates the text control for entering the filter text. Subclasses may override.- Parameters:
parent
- the parent composite- Returns:
- the text widget
-
textChanged
protected abstract void textChanged()Update the receiver after the text has changed. -
getRefreshJobDelay
protected long getRefreshJobDelay()Return the time delay that should be used when scheduling the filter refresh job. Subclasses may override.- Returns:
- a time delay in milliseconds before the job should run
-
clearText
protected void clearText()Clears the text in the filter text widget. -
setFilterText
Set the text in the filter control.- Parameters:
filterText
- the text to set.
-
getPatternFilter
Returns the pattern filter used by this tree.- Returns:
- The pattern filter; never
null
.
-
getViewer
Get the structured viewer of the receiver.- Returns:
- the structured viewer
-
getFilterControl
Get the filter text for the receiver, if it was created. Otherwise returnnull
.- Returns:
- the filter Text, or null if it was not created
-
getFilterString
Convenience method to return the text of the filter control. If the text widget is not created, then null is returned.- Returns:
- String in the text, or null if the text does not exist
-
setInitialText
Set the text that will be shown until the first focus. A default value is provided, so this method only need be called if overriding the default initial text is desired.- Parameters:
text
- initial text to appear in text field
-
selectAll
protected void selectAll()Select all text in the filter text field. -
getInitialText
Get the initial text for the receiver.- Returns:
- String
-