Class ResourceTreeAndListGroup


  • public class ResourceTreeAndListGroup
    extends EventManager
    Workbench-level composite that combines a CheckboxTreeViewer and CheckboxListViewer. All viewer selection-driven interactions are handled within this object
    Since:
    3.10
    Restriction:
    This class is not intended to be subclassed by clients.
    • Constructor Detail

      • ResourceTreeAndListGroup

        public ResourceTreeAndListGroup​(Composite parent,
                                        Object rootObject,
                                        ITreeContentProvider treeContentProvider,
                                        ILabelProvider treeLabelProvider,
                                        IStructuredContentProvider listContentProvider,
                                        ILabelProvider listLabelProvider,
                                        int style,
                                        boolean useHeightHint)
        Create an instance of this class. Use this constructor if you wish to specify the width and/or height of the combined widget (to only hard-code one of the sizing dimensions, specify the other dimension's value as -1)
        Parameters:
        parent -
        rootObject -
        treeContentProvider -
        treeLabelProvider -
        listContentProvider -
        listLabelProvider -
        style -
        useHeightHint - If true then use the height hint to make this group big enough
    • Method Detail

      • aboutToOpen

        protected void aboutToOpen()
        This method must be called just before this window becomes visible.
        Restriction:
        This method is not intended to be referenced by clients.
      • addCheckStateListener

        public void addCheckStateListener​(ICheckStateListener listener)
        Add the passed listener to self's collection of clients that listen for changes to element checked states
        Parameters:
        listener - ICheckStateListener
      • expandAll

        public void expandAll()
        Causes the tree viewer to expand all its items
      • collapseAll

        public void collapseAll()
        Causes the tree viewer to collapse all of its items
      • getAllCheckedListItems

        public void getAllCheckedListItems​(IElementFilter filter,
                                           IProgressMonitor monitor)
                                    throws InterruptedException
        Returns a flat list of all of the leaf elements which are checked. Filter then based on the supplied ElementFilter. If monitor is cancelled then return null
        Parameters:
        filter - - the filter for the data
        monitor - IProgressMonitor or null
        Throws:
        InterruptedException - If the find is interrupted.
      • isEveryItemChecked

        public boolean isEveryItemChecked()
        Returns whether all items in the list are checked. This method is required, because this widget will keep items grey checked even though all children are selected (see grayUpdateHierarchy()).
        Returns:
        true if all items in the list are checked - false if not
      • getAllCheckedListItems

        public List getAllCheckedListItems()
        Returns a flat list of all of the leaf elements which are checked.
        Returns:
        all of the leaf elements which are checked. This API does not return null in order to keep backwards compatibility.
      • getAllListItems

        public List getAllListItems()
        Returns a flat list of all of the leaf elements.
        Returns:
        all of the leaf elements.
      • getAllWhiteCheckedItems

        public List getAllWhiteCheckedItems()
        Returns a list of all of the items that are white checked. Any folders that are white checked are added and then any files from white checked folders are added.
        Returns:
        the list of all of the items that are white checked
      • getCheckedElementCount

        public int getCheckedElementCount()
        Returns the number of items that are checked in the tree viewer.
        Returns:
        The number of items that are checked
      • initialCheckListItem

        public void initialCheckListItem​(Object element)
        Set the initial checked state of the passed list element to true.
        Parameters:
        element -
      • initialCheckTreeItem

        public void initialCheckTreeItem​(Object element)
        Set the initial checked state of the passed element to true, as well as to all of its children and associated list elements
        Parameters:
        element -
      • removeCheckStateListener

        public void removeCheckStateListener​(ICheckStateListener listener)
        Remove the passed listener from self's collection of clients that listen for changes to element checked states
        Parameters:
        listener - ICheckStateListener
      • setAllSelections

        public void setAllSelections​(boolean selection)
        Select or de-select all of the elements in the tree depending on the value of the selection boolean. Be sure to update the displayed files as well.
        Parameters:
        selection -
      • setListProviders

        public void setListProviders​(IStructuredContentProvider contentProvider,
                                     ILabelProvider labelProvider)
        Set the list viewer's providers to those passed
        Parameters:
        contentProvider - ITreeContentProvider
        labelProvider - ILabelProvider
      • setListComparator

        public void setListComparator​(ViewerComparator comparator)
        Set the comparator that is to be applied to self's list viewer
        Parameters:
        comparator - the sorter for the list
      • setRoot

        public void setRoot​(Object newRoot)
        Set the root of the widget to be new Root. Regenerate all of the tables and lists from this value.
        Parameters:
        newRoot -
      • setTreeProviders

        public void setTreeProviders​(ITreeContentProvider contentProvider,
                                     ILabelProvider labelProvider)
        Set the tree viewer's providers to those passed
        Parameters:
        contentProvider - ITreeContentProvider
        labelProvider - ILabelProvider
      • setTreeComparator

        public void setTreeComparator​(ViewerComparator comparator)
        Set the comparator that is to be applied to self's tree viewer
        Parameters:
        comparator - the comparator for the tree
      • updateSelections

        public void updateSelections​(Map items)
        Update the selections of the tree elements in items to reflect the new selections provided.
        Parameters:
        items - Map with keys of Object (the tree element) and values of List (the selected list elements). NOTE: This method does not special case keys with no values (i.e., a tree element with an empty list). If a tree element does not have any selected items, do not include the element in the Map.
      • setFocus

        public void setFocus()
        Set the focus on to the list widget.