Package com._1c.g5.v8.dt.ui.dialog
Class ImprovedCheckboxTreeViewer
- 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
-
- com._1c.g5.v8.dt.ui.dialog.ImprovedCheckboxTreeViewer
-
- All Implemented Interfaces:
ICheckable
,IInputProvider
,IInputSelectionProvider
,IPostSelectionProvider
,ISelectionProvider
public class ImprovedCheckboxTreeViewer extends CheckboxTreeViewer
Checkbox tree viewer implementation with improved performance. Improved performance achieved through improved methods.
-
-
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
Constructors Constructor Description ImprovedCheckboxTreeViewer(org.eclipse.swt.widgets.Tree tree)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object[]
getCheckedElements()
List<Object>
getUncheckedElements()
Returns a list of unchecked elements in this viewer's tree, including currently hidden ones that are marked as unchecked but are under a collapsed ancestor.boolean
hasCheckedElements(boolean canBeGrayed)
Returnstrue
if viewer has at least one checked element.void
setAllElementsChecked(boolean state)
Sets all tree elements checked state.protected void
setCheckGrayedChildren(org.eclipse.swt.widgets.Item item, boolean state)
Sets the check grayed state for the children of the given item.void
setCheckStateProvider(ICheckStateProvider checkStateProvider)
boolean
setParentsCheckGrayed(Object element, boolean state)
Sets the check grayed state for the given element and its parents in this viewer.boolean
setSubtreeChecked(Object element, boolean state)
boolean
setSubtreeCheckGrayed(Object element, boolean state)
Sets the checked state for the given element and its visiblechildren in this viewer.-
Methods inherited from class org.eclipse.jface.viewers.CheckboxTreeViewer
addCheckStateListener, doUpdateItem, fireCheckStateChanged, getChecked, getGrayed, getGrayedElements, handleDoubleSelect, handleSelect, preservingSelection, removeCheckStateListener, setAllChecked, setChecked, setCheckedChildren, setCheckedElements, 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, setExpanded, 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, expandAll, expandToLevel, expandToLevel, expandToLevel, expandToLevel, fireTreeCollapsed, fireTreeExpanded, getAutoExpandLevel, 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, setExpandedElements, setExpandedState, setExpandedTreePaths, setExpandPreCheckFilters, setSelectionToWidget, setSelectionToWidget, updateChildren
-
Methods inherited from class org.eclipse.jface.viewers.ColumnViewer
applyEditorValue, cancelEditing, checkBusy, getCell, getCellEditors, getCellModifier, getColumnProperties, getColumnViewerEditor, getItem, getLabelProvider, getViewerRow, handleDispose, 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, 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
-
-
-
-
Method Detail
-
setSubtreeChecked
public boolean setSubtreeChecked(Object element, boolean state)
- Overrides:
setSubtreeChecked
in classCheckboxTreeViewer
-
setSubtreeCheckGrayed
public boolean setSubtreeCheckGrayed(Object element, boolean state)
Sets the checked state for the given element and its visiblechildren in this viewer. Assumes that the element has been expanded before. To enforce that the item is expanded, call expandToLevelfor the element. Does not fire events to check state listeners.- Parameters:
element
- - element to set subtree state. Cannot benull
.state
- - state to set.- Returns:
true
if check grayed state could be set.
-
getUncheckedElements
public List<Object> getUncheckedElements()
Returns a list of unchecked elements in this viewer's tree, including currently hidden ones that are marked as unchecked but are under a collapsed ancestor.- Returns:
- the list of unchecked elements, never
null
-
getCheckedElements
public Object[] getCheckedElements()
- Overrides:
getCheckedElements
in classCheckboxTreeViewer
-
setParentsCheckGrayed
public boolean setParentsCheckGrayed(Object element, boolean state)
Sets the check grayed state for the given element and its parents in this viewer.- Parameters:
element
- the elementstate
-true
if the item should be check grayed, andfalse
if it should be ungrayed- Returns:
true
if the element is visible and the check gray state could be set, andfalse
otherwise
-
setCheckStateProvider
public void setCheckStateProvider(ICheckStateProvider checkStateProvider)
- Overrides:
setCheckStateProvider
in classCheckboxTreeViewer
-
hasCheckedElements
public boolean hasCheckedElements(boolean canBeGrayed)
Returnstrue
if viewer has at least one checked element.- Parameters:
canBeGrayed
- -true
if grayed element count as checked.- Returns:
true
if viewer has checked elements.
-
setAllElementsChecked
public void setAllElementsChecked(boolean state)
Sets all tree elements checked state.- Parameters:
state
-true
if items should be checked, andfalse
if it should be unchecked.
-
setCheckGrayedChildren
protected void setCheckGrayedChildren(org.eclipse.swt.widgets.Item item, boolean state)
Sets the check grayed state for the children of the given item.- Parameters:
item
- the itemstate
-true
if the item should be checked, andfalse
if it should be unchecked
-
-