Class ContainerCheckedTreeViewer

All Implemented Interfaces:
ICheckable, IInputProvider, IInputSelectionProvider, IPostSelectionProvider, ISelectionProvider

public class ContainerCheckedTreeViewer extends CheckboxTreeViewer
CheckboxTreeViewer with special behaviour of the checked / gray state on container (non-leaf) nodes: The grayed state is used to visualize the checked state of its children. Containers are checked and non-gray if all contained leafs are checked. The container is grayed if some but not all leafs are checked.
Since:
3.1
  • Constructor Details

  • Method Details

    • doCheckStateChanged

      protected void doCheckStateChanged(Object element)
      Update element after a checkstate change.
      Parameters:
      element - the element to update
    • setChecked

      public boolean setChecked(Object element, boolean state)
      Description copied from interface: ICheckable
      Sets the checked state for the given element in this viewer. Does not fire events to check state listeners.
      Specified by:
      setChecked in interface ICheckable
      Overrides:
      setChecked in class CheckboxTreeViewer
      Parameters:
      element - the element
      state - true if the item should be checked, and false if it should be unchecked
      Returns:
      true if the checked state could be set, and false otherwise
    • setCheckedElements

      public void setCheckedElements(Object[] elements)
      Description copied from class: CheckboxTreeViewer
      Sets which elements are checked in this viewer's tree. The given list contains the elements that are to be checked; all other elements are to be unchecked. Does not fire events to check state listeners.

      This method is typically used when restoring the interesting state of a viewer captured by an earlier call to getCheckedElements.

      Overrides:
      setCheckedElements in class CheckboxTreeViewer
      Parameters:
      elements - the array of checked elements
      See Also:
    • setSubtreeChecked

      public boolean setSubtreeChecked(Object element, boolean state)
      Description copied from class: CheckboxTreeViewer
      Sets the checked state for the given element and its visible children in this viewer. Assumes that the element has been expanded before. To enforce that the item is expanded, call expandToLevel for the element. Does not fire events to check state listeners.
      Overrides:
      setSubtreeChecked in class CheckboxTreeViewer
      Parameters:
      element - the element
      state - true if the item should be checked, and false if it should be unchecked
      Returns:
      true if the checked state could be set, and false otherwise
    • setExpanded

      protected void setExpanded(Item item, boolean expand)
      Description copied from class: AbstractTreeViewer
      Sets the expand state of the given item.
      Overrides:
      setExpanded in class TreeViewer
      Parameters:
      item - the item
      expand - the expand state of the item
    • getCheckedElements

      public Object[] getCheckedElements()
      Description copied from class: CheckboxTreeViewer
      Returns a list of checked elements in this viewer's tree, including currently hidden ones that are marked as checked but are under a collapsed ancestor.

      This method is typically used when preserving the interesting state of a viewer; setCheckedElements is used during the restore.

      Overrides:
      getCheckedElements in class CheckboxTreeViewer
      Returns:
      the array of checked elements
      See Also: