Class AbstractFilteredViewerComposite<T extends ViewerFilter>

All Implemented Interfaces:
Drawable
Direct Known Subclasses:
FilteredTable, FilteredTree, FilteredTree

public abstract class AbstractFilteredViewerComposite<T extends ViewerFilter> extends Composite
Since:
3.36
  • Field Details

    • filterText

      protected Text filterText
      The filter text widget to be used by this tree. This value may be null if there is no filter widget, or if the controls have not yet been created.
    • filterComposite

      protected Composite 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 showFilterControls
      Whether 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

      protected String initialText
      The text to initially show in the filter text control.
    • parent

      protected Composite parent
      The parent composite of the filtered viewer.
  • Constructor Details

    • AbstractFilteredViewerComposite

      public AbstractFilteredViewerComposite(Composite parent, int style, long refreshJobDelayInMillis)
      Create a new instance of the receiver.
      Parameters:
      parent - a widget which will be the parent this composite
      style - the style used to construct this widget
      refreshJobDelayInMillis - refresh delay in ms, the time to expand the tree after debounce
  • Method Details

    • init

      protected void init(int style, T filter)
      Create the filtered viewer.
      Parameters:
      style - the style bits for the viewer's Control
      filter - the filter to be used
    • createControl

      protected void createControl(Composite parent, int style)
      Create the filtered viewer's controls. Subclasses should override.
      Parameters:
      parent - the parent
      style - SWT style bits used to create the control
    • createFilterControls

      protected Composite createFilterControls(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 - parent Composite of the filter controls
      Returns:
      the Composite that contains the filter controls
    • createFilterText

      protected void createFilterText(Composite parent)
      Creates the filter text and adds listeners. This method calls doCreateFilterText(Composite) to create the text control. Subclasses should override doCreateFilterText(Composite) instead of overriding this method.
      Parameters:
      parent - Composite of the filter text
    • doCreateFilterText

      protected abstract Text doCreateFilterText(Composite parent)
      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

      protected void setFilterText(String filterText)
      Set the text in the filter control.
      Parameters:
      filterText - the text to set.
    • getPatternFilter

      public ViewerFilter getPatternFilter()
      Returns the pattern filter used by this tree.
      Returns:
      The pattern filter; never null.
    • getViewer

      public abstract StructuredViewer getViewer()
      Get the structured viewer of the receiver.
      Returns:
      the structured viewer
    • getFilterControl

      public Text getFilterControl()
      Get the filter text for the receiver, if it was created. Otherwise return null.
      Returns:
      the filter Text, or null if it was not created
    • getFilterString

      protected 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(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 String getInitialText()
      Get the initial text for the receiver.
      Returns:
      String