public class FilteredTree extends Composite
PatternFilter
Modifier and Type | Field and Description |
---|---|
protected Control |
clearButtonControl
The control representing the clear button for the filter text entry.
|
protected Composite |
filterComposite
The Composite on which the filter controls are created.
|
protected Text |
filterText
The filter text widget to be used by this tree.
|
protected ToolBarManager |
filterToolBar
The control representing the clear button for the filter text entry.
|
protected String |
initialText
The text to initially show in the filter text control.
|
protected Composite |
parent
The parent composite of the filtered tree.
|
protected boolean |
showFilterControls
Whether or not to show the filter controls (text and clear button).
|
protected Composite |
treeComposite |
protected TreeViewer |
treeViewer
The viewer for the filtered tree.
|
Modifier | Constructor and Description |
---|---|
protected |
FilteredTree(Composite parent)
Deprecated.
As of 3.5, replaced by
FilteredTree(Composite, boolean) where using the
look is encouraged |
protected |
FilteredTree(Composite parent,
boolean useNewLook)
Create a new instance of the receiver.
|
|
FilteredTree(Composite parent,
int treeStyle,
PatternFilter filter)
Deprecated.
As of 3.5, replaced by
FilteredTree(Composite, int, PatternFilter, boolean) where using the new
look is encouraged |
|
FilteredTree(Composite parent,
int treeStyle,
PatternFilter filter,
boolean useNewLook)
Create a new instance of the receiver.
|
Modifier and Type | Method and Description |
---|---|
protected void |
clearText()
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 WorkbenchJob |
doCreateRefreshJob()
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.
|
Text |
getFilterControl()
Get the filter text for the receiver, if it was created.
|
protected String |
getFilterString()
Convenience method to return the text of the filter control.
|
protected String |
getInitialText()
Get the initial text for the receiver.
|
PatternFilter |
getPatternFilter()
Returns the pattern filter used by this tree.
|
protected long |
getRefreshJobDelay()
Return the time delay that should be used when scheduling the
filter refresh job.
|
TreeViewer |
getViewer()
Get the tree viewer of the receiver.
|
protected void |
init(int treeStyle,
PatternFilter filter)
Create the filtered tree.
|
protected void |
selectAll()
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 |
setQuickSelectionMode(boolean enabled)
Sets whether this filtered tree is used to make quick selections.
|
protected void |
textChanged()
Update the receiver after the text has changed.
|
protected void |
updateToolbar(boolean visible) |
protected void |
updateTreeSelection(boolean setFocus)
Updates the selection in the tree, based on the filter text.
|
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, 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, 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
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
protected Text filterText
null
if there is no filter widget, or if the controls have
not yet been created.protected ToolBarManager filterToolBar
null
if no such button exists, or if the
controls have not yet been created.
Note: As of 3.5, this is not used if the new look is chosen.
protected Control clearButtonControl
null
if no such button exists, or if the
controls have not yet been created.
Note: This is only used if the new look is chosen.
protected TreeViewer treeViewer
null
after the widget creation methods are complete.protected Composite filterComposite
protected String initialText
protected Composite parent
protected boolean showFilterControls
protected Composite treeComposite
@Deprecated public FilteredTree(Composite parent, int treeStyle, PatternFilter filter)
FilteredTree(Composite, int, PatternFilter, boolean)
where using the new
look is encouragedparent
- the parent Composite
treeStyle
- the style bits for the Tree
filter
- the filter to be usedpublic FilteredTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook)
parent
- the parent Composite
treeStyle
- the style bits for the Tree
filter
- the filter to be useduseNewLook
- true
if the new 3.5 look should be used@Deprecated protected FilteredTree(Composite parent)
FilteredTree(Composite, boolean)
where using the
look is encouragedinit(composite, int, PatternFilter)
method is
called in the overriding constructor.parent
- the parent Composite
init(int, PatternFilter)
protected FilteredTree(Composite parent, boolean useNewLook)
init(composite, int, PatternFilter)
method is
called in the overriding constructor.parent
- the parent Composite
useNewLook
- true
if the new 3.5 look should be usedinit(int, PatternFilter)
protected void init(int treeStyle, PatternFilter filter)
treeStyle
- the style bits for the Tree
filter
- the filter to be usedprotected void createControl(Composite parent, int treeStyle)
parent
- treeStyle
- protected Composite createFilterControls(Composite parent)
parent
- parent Composite
of the filter controlsComposite
that contains the filter controlsprotected Control createTreeControl(Composite parent, int style)
doCreateTreeViewer(Composite, int)
to create the tree viewer.
Subclasses should override doCreateTreeViewer(Composite, int)
instead of overriding this method.parent
- parent Composite
style
- SWT style bits used to create the treeprotected TreeViewer doCreateTreeViewer(Composite parent, int style)
parent
- the parent compositestyle
- SWT style bits used to create the tree viewerprotected WorkbenchJob doCreateRefreshJob()
protected void updateToolbar(boolean visible)
protected void createFilterText(Composite parent)
doCreateFilterText(Composite)
to create the text control.
Subclasses should override doCreateFilterText(Composite)
instead
of overriding this method.parent
- Composite
of the filter textprotected void updateTreeSelection(boolean setFocus)
setFocus
- true
if the focus should be set on the tree,
false
otherwiseprotected Text doCreateFilterText(Composite parent)
parent
- the parent compositeprotected void textChanged()
protected long getRefreshJobDelay()
public void setBackground(Color background)
setBackground
in class Control
background
- background Color
to setprotected void clearText()
protected void setFilterText(String string)
string
- public final PatternFilter getPatternFilter()
null
.public TreeViewer getViewer()
public Text getFilterControl()
null
.protected String getFilterString()
public void setInitialText(String text)
text
- initial text to appear in text fieldpublic void setQuickSelectionMode(boolean enabled)
By default, this is set to false
.
enabled
- true
if this filtered tree is used to make quick
selections, false
otherwiseprotected void selectAll()
protected String getInitialText()
public static Font getBoldFont(Object element, FilteredTree tree, PatternFilter filter)
element
- element for which a match should be determinedtree
- FilteredTree in which the element residesfilter
- PatternFilter which determines a match
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.