Class FilteredTree

All Implemented Interfaces:
Drawable

public class FilteredTree extends AbstractFilteredViewerComposite<PatternFilter>
Based on org.eclipse.ui.dialogs.FilteredTree.
Since:
1.2
  • Constructor Details

    • FilteredTree

      public FilteredTree(Composite parent, int treeStyle, PatternFilter filter, long refreshDelayTime)
      Create a new instance of the receiver.
      Parameters:
      parent - the parent Composite
      treeStyle - the style bits for the Tree
      filter - the filter to be used
      refreshDelayTime - refresh delay in ms, the time to expand the tree after debounce
      Since:
      1.5
    • FilteredTree

      public FilteredTree(Composite parent, int treeStyle, PatternFilter filter)
      Calls FilteredTree(Composite, int, PatternFilter, long) with a default refresh time
    • FilteredTree

      protected FilteredTree(Composite parent)
      Create a new instance of the receiver. Subclasses that wish to override the default creation behavior may use this constructor, but must ensure that the init(composite, int, PatternFilter) method is called in the overriding constructor.
      Parameters:
      parent - the parent Composite
      See Also:
  • Method Details

    • init

      protected void init(int treeStyle, PatternFilter filter)
      Description copied from class: AbstractFilteredViewerComposite
      Create the filtered viewer.
      Overrides:
      init in class AbstractFilteredViewerComposite<PatternFilter>
      Parameters:
      treeStyle - the style bits for the viewer's Control
      filter - the filter to be used
    • createControl

      protected void createControl(Composite parent, int treeStyle)
      Description copied from class: AbstractFilteredViewerComposite
      Create the filtered viewer's controls. Subclasses should override.
      Overrides:
      createControl in class AbstractFilteredViewerComposite<PatternFilter>
      Parameters:
      parent - the parent
      treeStyle - SWT style bits used to create the control
    • createTreeControl

      protected Control createTreeControl(Composite parent, int style)
      Creates and set up the tree and tree viewer. This method calls doCreateTreeViewer(Composite, int) to create the tree viewer. Subclasses should override doCreateTreeViewer(Composite, int) instead of overriding this method.
      Parameters:
      parent - parent Composite
      style - SWT style bits used to create the tree
      Returns:
      the tree
    • doCreateTreeViewer

      protected TreeViewer doCreateTreeViewer(Composite parent, int style)
      Creates the tree viewer. Subclasses may override.
      Parameters:
      parent - the parent composite
      style - SWT style bits used to create the tree viewer
      Returns:
      the tree viewer
      Since:
      3.3
    • doCreateRefreshJob

      protected BasicUIJob 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

      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.
      Overrides:
      createFilterText in class AbstractFilteredViewerComposite<PatternFilter>
      Parameters:
      parent - Composite of the filter text
    • setQuickSelectionMode

      public void setQuickSelectionMode(boolean enabled)
      Sets whether this filtered tree is used to make quick selections. In this mode the first match in the tree is automatically selected while filtering and the 'Enter' key is not used to move the focus to the tree.

      By default, this is set to false.

      Parameters:
      enabled - true if this filtered tree is used to make quick selections, false otherwise
      Since:
      1.8
    • doCreateFilterText

      protected Text doCreateFilterText(Composite parent)
      Description copied from class: AbstractFilteredViewerComposite
      Creates the text control for entering the filter text. Subclasses may override.
      Specified by:
      doCreateFilterText in class AbstractFilteredViewerComposite<PatternFilter>
      Parameters:
      parent - the parent composite
      Returns:
      the text widget
    • textChanged

      protected void textChanged()
      Description copied from class: AbstractFilteredViewerComposite
      Update the receiver after the text has changed.
      Specified by:
      textChanged in class AbstractFilteredViewerComposite<PatternFilter>
    • setBackground

      public void setBackground(Color background)
      Set the background for the widgets that support the filter text area.
      Overrides:
      setBackground in class Control
      Parameters:
      background - background Color to set
    • getPatternFilter

      public final PatternFilter getPatternFilter()
      Description copied from class: AbstractFilteredViewerComposite
      Returns the pattern filter used by this tree.
      Overrides:
      getPatternFilter in class AbstractFilteredViewerComposite<PatternFilter>
      Returns:
      The pattern filter; never null.
    • getViewer

      public TreeViewer getViewer()
      Description copied from class: AbstractFilteredViewerComposite
      Get the structured viewer of the receiver.
      Specified by:
      getViewer in class AbstractFilteredViewerComposite<PatternFilter>
      Returns:
      the structured viewer
    • getBoldFont

      public static Font getBoldFont(Object element, FilteredTree tree, PatternFilter filter)
      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 determined
      tree - FilteredTree in which the element resides
      filter - PatternFilter which determines a match
      Returns:
      bold font
    • isShowFilterControls

      public boolean isShowFilterControls()
    • setShowFilterControls

      public void setShowFilterControls(boolean showFilterControls)