Package org.eclipse.ui.ide.dialogs
Class ResourceTreeAndListGroup
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.ui.ide.dialogs.ResourceTreeAndListGroup
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 Summary
ConstructorDescriptionResourceTreeAndListGroup
(Composite parent, Object rootObject, ITreeContentProvider treeContentProvider, ILabelProvider treeLabelProvider, IStructuredContentProvider listContentProvider, ILabelProvider listLabelProvider, int style, boolean useHeightHint) Create an instance of this class. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
This method must be called just before this window becomes visible.void
addCheckStateListener
(ICheckStateListener listener) Add the passed listener to self's collection of clients that listen for changes to element checked statesvoid
Causes the tree viewer to collapse all of its itemsvoid
Causes the tree viewer to expand all its itemsList<?>
Returns a flat list of all of the leaf elements which are checked.void
getAllCheckedListItems
(IElementFilter filter, IProgressMonitor monitor) Returns a flat list of all of the leaf elements which are checked.List<?>
Returns a flat list of all of the leaf elements.List<?>
Returns a list of all of the items that are white checked.int
Returns the number of items that are checked in the tree viewer.void
initialCheckListItem
(Object element) Set the initial checked state of the passed list element to true.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 elementsboolean
Returns whether all items in the list are checked.void
removeCheckStateListener
(ICheckStateListener listener) Remove the passed listener from self's collection of clients that listen for changes to element checked statesvoid
setAllSelections
(boolean selection) Select or de-select all of the elements in the tree depending on the value of the selection boolean.void
setFocus()
Set the focus on to the list widget.void
setListComparator
(ViewerComparator comparator) Set the comparator that is to be applied to self's list viewervoid
setListProviders
(IStructuredContentProvider contentProvider, ILabelProvider labelProvider) Set the list viewer's providers to those passedvoid
Set the root of the widget to be new Root.void
setTreeComparator
(ViewerComparator comparator) Set the comparator that is to be applied to self's tree viewervoid
setTreeProviders
(ITreeContentProvider contentProvider, ILabelProvider labelProvider) Set the tree viewer's providers to those passedvoid
updateSelections
(Map items) Update the selections of the tree elements in items to reflect the new selections provided.Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
Constructor Details
-
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
- the parent compositerootObject
- the root object to represent in the treetreeContentProvider
- content provider for the tree parttreeLabelProvider
- label provider for the tree elementslistContentProvider
- content provider for the list partlistLabelProvider
- label provider for the list elementsstyle
- style for the compositeuseHeightHint
- If true then use the height hint to make this group big enough
-
-
Method Details
-
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
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 datamonitor
- 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
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
Returns a flat list of all of the leaf elements.- Returns:
- all of the leaf elements.
-
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
Set the initial checked state of the passed list element to true.- Parameters:
element
- the element to set
-
initialCheckTreeItem
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
- the element to set
-
removeCheckStateListener
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
- the new selection state
-
setListProviders
public void setListProviders(IStructuredContentProvider contentProvider, ILabelProvider labelProvider) Set the list viewer's providers to those passed- Parameters:
contentProvider
- ITreeContentProviderlabelProvider
- ILabelProvider
-
setListComparator
Set the comparator that is to be applied to self's list viewer- Parameters:
comparator
- the sorter for the list
-
setRoot
Set the root of the widget to be new Root. Regenerate all of the tables and lists from this value.- Parameters:
newRoot
- the new root object
-
setTreeProviders
Set the tree viewer's providers to those passed- Parameters:
contentProvider
- ITreeContentProviderlabelProvider
- ILabelProvider
-
setTreeComparator
Set the comparator that is to be applied to self's tree viewer- Parameters:
comparator
- the comparator for the tree
-
updateSelections
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.
-