Class FilteredTree
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.e4.ui.dialogs.filteredtree.FilteredTree
- All Implemented Interfaces:
Drawable
Based on org.eclipse.ui.dialogs.FilteredTree.
- Since:
- 1.2
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
FilteredTree
(Composite parent) Create a new instance of the receiver.FilteredTree
(Composite parent, int treeStyle, PatternFilter filter) CallsFilteredTree(Composite, int, PatternFilter, long)
with a default refresh timeFilteredTree
(Composite parent, int treeStyle, PatternFilter filter, long refreshDelayTime) 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 treeStyle) Create the filtered tree's controls.protected Composite
createFilterControls
(Composite parent) Create the filter controls.protected void
createFilterText
(Composite parent) Creates the filter text and adds listeners.protected Control
createTreeControl
(Composite parent, int style) Creates and set up the tree and tree viewer.protected Text
doCreateFilterText
(Composite parent) Creates the text control for entering the filter text.protected BasicUIJob
Creates a workbench job that will refresh the tree based on the current filter text.protected TreeViewer
doCreateTreeViewer
(Composite parent, int style) Creates the tree viewer.static Font
getBoldFont
(Object element, FilteredTree tree, PatternFilter filter) Return a bold font if the given element matches the given pattern.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.final PatternFilter
Returns the pattern filter used by this tree.protected long
Return the time delay that should be used when scheduling the filter refresh job.Get the tree viewer of the receiver.protected void
init
(int treeStyle, PatternFilter filter) Create the filtered tree.boolean
protected void
Select all text in the filter text field.void
setBackground
(Color background) Set the background for the widgets that support the filter text area.protected void
setFilterText
(String string) Set the text in the filter control.void
setInitialText
(String text) Set the text that will be shown until the first focus.void
setShowFilterControls
(boolean showFilterControls) protected void
Update the receiver after the text has changed.protected void
updateToolbar
(boolean visible) 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, 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, 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
-
Constructor Details
-
FilteredTree
Create a new instance of the receiver.- Parameters:
parent
- the parentComposite
treeStyle
- the style bits for theTree
filter
- the filter to be usedrefreshDelayTime
- refresh delay in ms, the time to expand the tree after debounce- Since:
- 1.5
-
FilteredTree
CallsFilteredTree(Composite, int, PatternFilter, long)
with a default refresh time -
FilteredTree
Create a new instance of the receiver. Subclasses that wish to override the default creation behavior may use this constructor, but must ensure that theinit(composite, int, PatternFilter)
method is called in the overriding constructor.- Parameters:
parent
- the parentComposite
- See Also:
-
-
Method Details
-
init
Create the filtered tree.- Parameters:
treeStyle
- the style bits for theTree
filter
- the filter to be used- Since:
- 3.3
-
createControl
Create the filtered tree's controls. Subclasses should override. -
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
-
createTreeControl
Creates and set up the tree and tree viewer. This method callsdoCreateTreeViewer(Composite, int)
to create the tree viewer. Subclasses should overridedoCreateTreeViewer(Composite, int)
instead of overriding this method.- Parameters:
parent
- parentComposite
style
- SWT style bits used to create the tree- Returns:
- the tree
-
doCreateTreeViewer
Creates the tree viewer. Subclasses may override.- Parameters:
parent
- the parent compositestyle
- SWT style bits used to create the tree viewer- Returns:
- the tree viewer
- Since:
- 3.3
-
doCreateRefreshJob
Creates a workbench job that will refresh the tree based on the current filter text. Subclasses may override.- Returns:
- a workbench job that can be scheduled to refresh the tree
- Since:
- 3.4
-
updateToolbar
protected void updateToolbar(boolean visible) -
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
- Since:
- 3.3
-
textChanged
protected 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
- Since:
- 3.5
-
setBackground
Set the background for the widgets that support the filter text area.- Overrides:
setBackground
in classControl
- Parameters:
background
- backgroundColor
to set
-
clearText
protected void clearText()Clears the text in the filter text widget. -
setFilterText
Set the text in the filter control. -
getPatternFilter
Returns the pattern filter used by this tree.- Returns:
- The pattern filter; never
null
.
-
getViewer
Get the tree viewer of the receiver.- Returns:
- the tree 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
-
getBoldFont
Return a bold font if the given element matches the given pattern. Clients can opt to call this method from a Viewer's label provider to get a bold font for which to highlight the given element in the tree.- Parameters:
element
- element for which a match should be determinedtree
- FilteredTree in which the element residesfilter
- PatternFilter which determines a match- Returns:
- bold font
-
isShowFilterControls
public boolean isShowFilterControls() -
setShowFilterControls
public void setShowFilterControls(boolean showFilterControls)
-