Package org.eclipse.ui.dialogs

# Class ContainerCheckedTreeViewer

java.lang.Object
org.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.jface.viewers.StructuredViewer
org.eclipse.jface.viewers.ColumnViewer
org.eclipse.jface.viewers.AbstractTreeViewer
org.eclipse.jface.viewers.TreeViewer
org.eclipse.jface.viewers.CheckboxTreeViewer
org.eclipse.ui.dialogs.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

## Nested Class Summary

## Nested classes/interfaces inherited from class org.eclipse.jface.viewers.StructuredViewer

`StructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders`

## Field Summary

### Fields inherited from class org.eclipse.jface.viewers.AbstractTreeViewer

`ALL_LEVELS, NO_EXPAND`

### Fields inherited from class org.eclipse.jface.viewers.Viewer

`WIDGET_DATA_KEY`

## Constructor Summary

Constructors
Constructor
Description
`ContainerCheckedTreeViewer(Composite parent)`
Constructor for ContainerCheckedTreeViewer.
`ContainerCheckedTreeViewer(Composite parent, int style)`
Constructor for ContainerCheckedTreeViewer.
`ContainerCheckedTreeViewer(Tree tree)`
Constructor for ContainerCheckedTreeViewer.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doCheckStateChanged(Object element)`
Update element after a checkstate change.
`Object[]`
`getCheckedElements()`
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.
`boolean`
`setChecked(Object element, boolean state)`
Sets the checked state for the given element in this viewer.
`void`
`setCheckedElements(Object[] elements)`
Sets which elements are checked in this viewer's tree.
`protected void`
`setExpanded(Item item, boolean expand)`
Sets the expand state of the given item.
`boolean`
`setSubtreeChecked(Object element, boolean state)`
Sets the checked state for the given element and its visible children in this viewer.

### Methods inherited from class org.eclipse.jface.viewers.CheckboxTreeViewer

`addCheckStateListener, doUpdateItem, fireCheckStateChanged, getChecked, getGrayed, getGrayedElements, handleDoubleSelect, handleSelect, preservingSelection, removeCheckStateListener, setAllChecked, setCheckedChildren, setCheckStateProvider, setGrayChecked, setGrayed, setGrayedElements, setParentsGrayed`

### Methods inherited from class org.eclipse.jface.viewers.TreeViewer

`addTreeListener, assertContentProviderType, createViewerEditor, disassociate, doGetColumnCount, editElement, getChild, getChildren, getColumnViewerOwner, getControl, getExpanded, getItemAt, getItemCount, getItemCount, getItems, getLabelProvider, getParentElement, getParentItem, getRawChildren, getSelection, getTree, getViewerRowFromItem, handleTreeCollapse, handleTreeExpand, hookControl, internalAdd, internalInitializeTree, internalRefreshStruct, isExpandable, mapElement, newItem, remove, removeAll, replace, setChildCount, setContentProvider, setHasChildren, setSelection, setSelection, showItem, updatePlus`

### Methods inherited from class org.eclipse.jface.viewers.AbstractTreeViewer

`add, add, addSelectionListener, addTreeListener, associate, buildLabel, collapseAll, collapseToLevel, contains, createChildren, createTreeItem, doFindInputItem, doFindItem, doUpdateItem, expandAll, expandAll, expandToLevel, expandToLevel, expandToLevel, expandToLevel, fireTreeCollapsed, fireTreeExpanded, getAutoExpandLevel, getAutoExpandOnSingleChildLevels, getChildren, getExpandedElements, getExpandedState, getExpandedTreePaths, getNextItem, getPreviousItem, getSelection, getSelectionFromWidget, getSortedChildren, getStructuredSelection, getTreePathFromItem, getVisibleExpandedElements, indexForElement, inputChanged, insert, internalCollapseToLevel, internalExpand, internalExpandToLevel, internalFindItems, internalGetWidgetToSelect, internalIsInputOrEmptyPath, internalRefresh, internalRefresh, internalRefresh, internalRemove, internalRemove, isSameSelection, labelProviderChanged, remove, remove, remove, removeTreeListener, reveal, scrollDown, scrollUp, setAutoExpandLevel, setAutoExpandOnSingleChildLevels, setExpandedElements, setExpandedState, setExpandedStateWithAutoExpandOnSingleChild, setExpandedTreePaths, setExpandPreCheckFilters, setSelectionToWidget, setSelectionToWidget, updateChildren`

### Methods inherited from class org.eclipse.jface.viewers.ColumnViewer

`applyEditorValue, cancelEditing, checkBusy, firePostSelectionChanged, getCell, getCellEditors, getCellModifier, getColumnProperties, getColumnViewerEditor, getItem, getLabelProvider, getViewerRow, handleDispose, hookEditingSupport, isBusy, isCellEditorActive, isExpandableNode, refresh, refresh, setBusy, setCellEditors, setCellModifier, setColumnProperties, setColumnViewerEditor, setDisplayIncrementally, setLabelProvider, triggerEditorActivationEvent, unmapAllElements, update, updateSelection`

### Methods inherited from class org.eclipse.jface.viewers.StructuredViewer

`addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertElementsNotNull, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, getColorAndFontCollector, getComparator, getComparer, getFilteredChildren, getFilters, getRoot, getSorter, handleInvalidSelection, handleLabelProviderChanged, handleOpen, handlePostSelect, hasFilters, internalUpdate, needsRefilter, refresh, refresh, refreshItem, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparator, setComparer, setFilters, setInput, setSorter, setUseHashlookup, testFindItem, testFindItems, unmapElement, unmapElement, update, updateItem, usingElementMap`

### Methods inherited from class org.eclipse.jface.viewers.ContentViewer

`getContentProvider, getInput`

### Methods inherited from class org.eclipse.jface.viewers.Viewer

`addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, setData, setSelection`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider

`addSelectionChangedListener, removeSelectionChangedListener, setSelection`

## Constructor Details

### ContainerCheckedTreeViewer

public ContainerCheckedTreeViewer(Composite parent)
Constructor for ContainerCheckedTreeViewer.

See Also:
  - `CheckboxTreeViewer(Composite)`

### ContainerCheckedTreeViewer

public ContainerCheckedTreeViewer(Composite parent, int style)
Constructor for ContainerCheckedTreeViewer.

See Also:
  - `CheckboxTreeViewer(Composite,int)`

### ContainerCheckedTreeViewer

public ContainerCheckedTreeViewer(Tree tree)
Constructor for ContainerCheckedTreeViewer.

See Also:
  - `CheckboxTreeViewer(Tree)`

## 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:
  - `CheckboxTreeViewer.getCheckedElements()`

### 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:
  - `CheckboxTreeViewer.setCheckedElements(java.lang.Object[])`