Eclipse Platform Release 3.7

## 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`

Fields inherited from class org.eclipse.jface.viewers.Viewer
`WIDGET_DATA_KEY`

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

Method Summary
`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.

Methods inherited from class org.eclipse.jface.viewers.CheckboxTreeViewer
`addCheckStateListener, doUpdateItem, fireCheckStateChanged, getChecked, getGrayed, getGrayedElements, handleDoubleSelect, handleSelect, preservingSelection, removeCheckStateListener, setAllChecked, setCheckStateProvider, setGrayChecked, setGrayed, setGrayedElements, setParentsGrayed, setSubtreeChecked`

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, createChildren, createTreeItem, doFindInputItem, doFindItem, doUpdateItem, expandAll, expandToLevel, expandToLevel, fireTreeCollapsed, fireTreeExpanded, getAutoExpandLevel, getChildren, getExpandedElements, getExpandedState, getExpandedTreePaths, getNextItem, getPreviousItem, getSelection, getSelectionFromWidget, getSortedChildren, 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, setExpandedElements, setExpandedState, setExpandedTreePaths, setSelectionToWidget, setSelectionToWidget, updateChildren`

Methods inherited from class org.eclipse.jface.viewers.ColumnViewer
`applyEditorValue, cancelEditing, checkBusy, getCell, getCellEditors, getCellModifier, getColumnProperties, getColumnViewerEditor, getItem, getLabelProvider, getViewerRow, hookEditingSupport, isBusy, isCellEditorActive, refresh, refresh, setBusy, setCellEditors, setCellModifier, setColumnProperties, setColumnViewerEditor, setLabelProvider, triggerEditorActivationEvent, update`

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

`addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertElementsNotNull, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, firePostSelectionChanged, getColorAndFontCollector, getComparator, getComparer, getFilteredChildren, getFilters, getRoot, getSorter, handleDispose, handleInvalidSelection, handleLabelProviderChanged, handleOpen, handlePostSelect, hasFilters, internalUpdate, needsRefilter, refresh, refresh, refreshItem, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparator, setComparer, setFilters, setInput, setSorter, setUseHashlookup, testFindItem, testFindItems, unmapAllElements, unmapElement, unmapElement, update, updateItem, updateSelection, 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 Detail

### ContainerCheckedTreeViewer

    public ContainerCheckedTreeViewer(Composite parent)

  Constructor for ContainerCheckedTreeViewer.

  See Also:
    `CheckboxTreeViewer.CheckboxTreeViewer(Composite)`

### ContainerCheckedTreeViewer

    public ContainerCheckedTreeViewer(Composite parent,
                                      int style)

  Constructor for ContainerCheckedTreeViewer.

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

### ContainerCheckedTreeViewer

    public ContainerCheckedTreeViewer(Tree tree)

  Constructor for ContainerCheckedTreeViewer.

  See Also:
    `CheckboxTreeViewer.CheckboxTreeViewer(Tree)`

Method Detail

### doCheckStateChanged

    protected void doCheckStateChanged(Object element)

  Update element after a checkstate change.

  Parameters:
    `element` -

### 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()`

### 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[])`

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.