Class ImprovedCheckboxTreeViewer

    • Constructor Detail

      • ImprovedCheckboxTreeViewer

        public ImprovedCheckboxTreeViewer​(org.eclipse.swt.widgets.Tree tree)
        Constructor.
        Parameters:
        tree - - tree to create viewer for. Cannot be null.
    • Method Detail

      • setSubtreeCheckGrayed

        public boolean setSubtreeCheckGrayed​(Object element,
                                             boolean state)
        Sets the checked state for the given element and its visiblechildren in this viewer. Assumes that the element has been expanded before. To enforce that the item is expanded, call expandToLevelfor the element. Does not fire events to check state listeners.
        Parameters:
        element - - element to set subtree state. Cannot be null.
        state - - state to set.
        Returns:
        true if check grayed state could be set.
      • getUncheckedElements

        public List<Object> getUncheckedElements()
        Returns a list of unchecked elements in this viewer's tree, including currently hidden ones that are marked as unchecked but are under a collapsed ancestor.
        Returns:
        the list of unchecked elements, never null
      • setParentsCheckGrayed

        public boolean setParentsCheckGrayed​(Object element,
                                             boolean state)
        Sets the check grayed state for the given element and its parents in this viewer.
        Parameters:
        element - the element
        state - true if the item should be check grayed, and false if it should be ungrayed
        Returns:
        true if the element is visible and the check gray state could be set, and false otherwise
      • hasCheckedElements

        public boolean hasCheckedElements​(boolean canBeGrayed)
        Returns true if viewer has at least one checked element.
        Parameters:
        canBeGrayed - - true if grayed element count as checked.
        Returns:
        true if viewer has checked elements.
      • setAllElementsChecked

        public void setAllElementsChecked​(boolean state)
        Sets all tree elements checked state.
        Parameters:
        state - true if items should be checked, and false if it should be unchecked.
      • setCheckGrayedChildren

        protected void setCheckGrayedChildren​(org.eclipse.swt.widgets.Item item,
                                              boolean state)
        Sets the check grayed state for the children of the given item.
        Parameters:
        item - the item
        state - true if the item should be checked, and false if it should be unchecked