Package org.eclipse.ui.dialogs
Class ContainerCheckedTreeViewer
- All Implemented Interfaces:
ICheckable
,IInputProvider
,IInputSelectionProvider
,IPostSelectionProvider
,ISelectionProvider
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
ConstructorDescriptionContainerCheckedTreeViewer
(Composite parent) Constructor for ContainerCheckedTreeViewer.ContainerCheckedTreeViewer
(Composite parent, int style) Constructor for ContainerCheckedTreeViewer.Constructor for ContainerCheckedTreeViewer. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doCheckStateChanged
(Object element) Update element after a checkstate change.Object[]
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
Constructor for ContainerCheckedTreeViewer.- See Also:
-
ContainerCheckedTreeViewer
Constructor for ContainerCheckedTreeViewer.- See Also:
-
ContainerCheckedTreeViewer
Constructor for ContainerCheckedTreeViewer.- See Also:
-
-
Method Details
-
doCheckStateChanged
Update element after a checkstate change.- Parameters:
element
- the element to update
-
setChecked
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 interfaceICheckable
- Overrides:
setChecked
in classCheckboxTreeViewer
- Parameters:
element
- the elementstate
-true
if the item should be checked, andfalse
if it should be unchecked- Returns:
true
if the checked state could be set, andfalse
otherwise
-
setCheckedElements
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 classCheckboxTreeViewer
- Parameters:
elements
- the array of checked elements- See Also:
-
setSubtreeChecked
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, callexpandToLevel
for the element. Does not fire events to check state listeners.- Overrides:
setSubtreeChecked
in classCheckboxTreeViewer
- Parameters:
element
- the elementstate
-true
if the item should be checked, andfalse
if it should be unchecked- Returns:
true
if the checked state could be set, andfalse
otherwise
-
setExpanded
Description copied from class:AbstractTreeViewer
Sets the expand state of the given item.- Overrides:
setExpanded
in classTreeViewer
- Parameters:
item
- the itemexpand
- the expand state of the item
-
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 classCheckboxTreeViewer
- Returns:
- the array of checked elements
- See Also:
-