Class FilterControl
- 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.launchbar.ui.controls.internal.FilterControl
-
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class FilterControl extends org.eclipse.swt.widgets.CompositeA simple control that provides a text widget and controls a list viewer
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.swt.widgets.TextfilterTextThe filter text widget to be used by this tree.protected java.lang.StringinitialTextThe text to initially show in the filter text control.protected LaunchBarListViewerlistViewerThe viewer for the filtered tree.protected org.eclipse.swt.widgets.CompositeparentThe parent composite this control.protected org.eclipse.jface.viewers.ViewerFilterpatternFilterprotected java.lang.StringpatternTextprivate org.eclipse.core.runtime.jobs.JobrefreshJobThe job used to refresh the tree.
-
Constructor Summary
Constructors Constructor Description FilterControl(org.eclipse.swt.widgets.Composite parent)Creates a filter control, to be fully function attachListViewer must be called shortly after
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.swt.widgets.ControlattachListViewer(LaunchBarListViewer listViewer)protected voidclearText()Clears the text in the filter text widget.protected voidcreateControl(org.eclipse.swt.widgets.Composite parent, int treeStyle)Create the filtered tree's controls.protected org.eclipse.swt.widgets.CompositecreateFilterControls(org.eclipse.swt.widgets.Composite parent)Create the filter controls.protected voidcreateFilterText(org.eclipse.swt.widgets.Composite parent)Creates the filter text and adds listeners.private voidcreateRefreshJob()Create the refresh job for the receiver.protected org.eclipse.swt.widgets.TextdoCreateFilterText(org.eclipse.swt.widgets.Composite parent)protected org.eclipse.ui.progress.WorkbenchJobdoCreateRefreshJob()Creates a workbench job that will refresh the tree based on the current filter text.org.eclipse.swt.widgets.TextgetFilterControl()Get the filter text for the receiver, if it was created.protected java.lang.StringgetFilterString()Convenience method to return the text of the filter control.org.eclipse.swt.widgets.TextgetFilterText()protected java.lang.StringgetInitialText()Get the initial text for the receiver.protected longgetRefreshJobDelay()Return the time delay that should be used when scheduling the filter refresh job.LaunchBarListViewergetViewer()Get the tree viewer of the receiver.protected voidinit()Create the filtered list.protected voidselectAll()Select all text in the filter text field.voidsetBackground(org.eclipse.swt.graphics.Color background)Set the background for the widgets that support the filter text area.protected voidsetFilterText(java.lang.String string)Set the text in the filter control.voidsetInitialText(java.lang.String text)Set the text that will be shown until the first focus.voidsetVisible(boolean visible)protected voidtextChanged()Update the receiver after the text has changed.protected voidupdateListSelection(boolean enter)private voidupdatePatternText()-
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
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
-
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, isAutoScalable, 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, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
-
-
-
Field Detail
-
filterText
protected org.eclipse.swt.widgets.Text filterText
The filter text widget to be used by this tree. This value may benullif there is no filter widget, or if the controls have not yet been created.
-
listViewer
protected LaunchBarListViewer listViewer
The viewer for the filtered tree. This value should never benullafter the widget creation methods are complete.
-
patternFilter
protected org.eclipse.jface.viewers.ViewerFilter patternFilter
-
initialText
protected java.lang.String initialText
The text to initially show in the filter text control.
-
patternText
protected java.lang.String patternText
-
refreshJob
private org.eclipse.core.runtime.jobs.Job refreshJob
The job used to refresh the tree.
-
parent
protected org.eclipse.swt.widgets.Composite parent
The parent composite this control.
-
-
Method Detail
-
init
protected void init()
Create the filtered list.
-
createControl
protected void createControl(org.eclipse.swt.widgets.Composite parent, int treeStyle)Create the filtered tree's controls. Subclasses should override.- Parameters:
parent-treeStyle-
-
createFilterControls
protected org.eclipse.swt.widgets.Composite createFilterControls(org.eclipse.swt.widgets.Composite parent)
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- parentCompositeof the filter controls- Returns:
- the
Compositethat contains the filter controls
-
attachListViewer
public org.eclipse.swt.widgets.Control attachListViewer(LaunchBarListViewer listViewer)
-
createRefreshJob
private void createRefreshJob()
Create the refresh job for the receiver.
-
setVisible
public void setVisible(boolean visible)
- Overrides:
setVisiblein classorg.eclipse.swt.widgets.Control
-
doCreateRefreshJob
protected org.eclipse.ui.progress.WorkbenchJob 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
-
createFilterText
protected void createFilterText(org.eclipse.swt.widgets.Composite parent)
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-Compositeof the filter text
-
updateListSelection
protected void updateListSelection(boolean enter)
-
doCreateFilterText
protected org.eclipse.swt.widgets.Text doCreateFilterText(org.eclipse.swt.widgets.Composite parent)
-
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
-
setBackground
public void setBackground(org.eclipse.swt.graphics.Color background)
Set the background for the widgets that support the filter text area.- Overrides:
setBackgroundin classorg.eclipse.swt.widgets.Control- Parameters:
background- backgroundColorto set
-
clearText
protected void clearText()
Clears the text in the filter text widget.
-
setFilterText
protected void setFilterText(java.lang.String string)
Set the text in the filter control.- Parameters:
string-
-
getFilterText
public org.eclipse.swt.widgets.Text getFilterText()
-
getViewer
public LaunchBarListViewer getViewer()
Get the tree viewer of the receiver.- Returns:
- the tree viewer
-
getFilterControl
public org.eclipse.swt.widgets.Text 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
protected java.lang.String 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
public void setInitialText(java.lang.String text)
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
protected java.lang.String getInitialText()
Get the initial text for the receiver.- Returns:
- String
-
updatePatternText
private void updatePatternText()
-
-