| 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
All known Subclasses: org.eclipse.jface.viewers.TableTreeViewer, org.eclipse.jface.viewers.TreeViewer,
AbstractTreeViewer | abstract public class AbstractTreeViewer extends ColumnViewer (Code) | | Abstract base implementation for tree-structure-oriented viewers (trees and
table trees).
Nodes in the tree can be in either an expanded or a collapsed state,
depending on whether the children on a node are visible. This class
introduces public methods for controlling the expanding and collapsing of
nodes.
As of 3.2, AbstractTreeViewer supports multiple equal elements (each with a
different parent chain) in the tree. This support requires that clients
enable the element map by calling setUseHashLookup(true) .
Content providers for abstract tree viewers must implement one of the
interfaces ITreeContentProvider or (as of 3.2, to support
multiple equal elements) ITreePathContentProvider .
See Also: TreeViewer |
Inner Class :class UpdateItemSafeRunnable extends SafeRunnable | |
Field Summary | |
final public static int | ALL_LEVELS Constant indicating that all levels of the tree should be expanded or
collapsed. |
Method Summary | |
public void | add(Object parentElementOrTreePath, Object[] childElements) Adds the given child elements to this viewer as children of the given
parent element. | public void | add(Object parentElementOrTreePath, Object childElement) Adds the given child element to this viewer as a child of the given
parent element. | protected void | addSelectionListener(Control control, SelectionListener listener) Adds the given SWT selection listener to the given SWT control. | public void | addTreeListener(ITreeViewerListener listener) Adds a listener for expand and collapse events in this viewer. | abstract protected void | addTreeListener(Control control, TreeListener listener) Adds the given SWT tree listener to the given SWT control. | protected void | assertContentProviderType(IContentProvider provider) | protected void | associate(Object element, Item item) | protected void | buildLabel(ViewerLabel updateLabel, Object elementOrPath) This implementation of buildLabel handles tree paths as well as elements. | public void | collapseAll() Collapses all nodes of the viewer's tree, starting with the root. | public void | collapseToLevel(Object elementOrTreePath, int level) Collapses the subtree rooted at the given element or tree path to the
given level. | protected void | createChildren(Widget widget) Creates all children for the given widget.
The default implementation of this framework method assumes that
widget.getData() returns the element corresponding to the
node. | protected void | createTreeItem(Widget parent, Object element, int index) Creates a single item for the given parent and synchronizes it with the
given element. | protected ColumnViewerEditor | createViewerEditor() This implementation of
AbstractTreeViewer.createViewerEditor() returns null to ensure
API backwards compatibility. | protected void | disassociate(Item item) The AbstractTreeViewer implementation of this method also
recurses over children of the corresponding element. | protected Widget | doFindInputItem(Object element) | protected Widget | doFindItem(Object element) | protected int | doGetColumnCount() Returns the number of columns of this viewer. | protected void | doUpdateItem(Item item, Object element) Copies the attributes of the given element into the given SWT item. | protected void | doUpdateItem(Widget widget, Object element, boolean fullMap) | public void | expandAll() Expands all nodes of the viewer's tree, starting with the root. | public void | expandToLevel(int level) Expands the root of the viewer's tree to the given level. | public void | expandToLevel(Object elementOrTreePath, int level) Expands all ancestors of the given element or tree path so that the given
element becomes visible in this viewer's tree control, and then expands
the subtree rooted at the given element to the given level. | protected void | fireTreeCollapsed(TreeExpansionEvent event) Fires a tree collapsed event. | protected void | fireTreeExpanded(TreeExpansionEvent event) Fires a tree expanded event. | public int | getAutoExpandLevel() Returns the auto-expand level. | protected Item | getChild(Widget widget, int index) Get the child for the widget at index. | abstract protected Item[] | getChildren(Widget widget) Returns the SWT child items for the given SWT widget. | protected Widget | getColumnViewerOwner(int columnIndex) | abstract protected boolean | getExpanded(Item item) Returns whether the given SWT item is expanded or collapsed. | public Object[] | getExpandedElements() Returns a list of elements corresponding to expanded nodes in this
viewer's tree, including currently hidden ones that are marked as
expanded but are under a collapsed ancestor. | public boolean | getExpandedState(Object elementOrTreePath) Returns whether the node corresponding to the given element or tree path
is expanded or collapsed. | public TreePath[] | getExpandedTreePaths() Returns a list of tree paths corresponding to expanded nodes in this
viewer's tree, including currently hidden ones that are marked as
expanded but are under a collapsed ancestor. | protected Object[] | getFilteredChildren(Object parentElementOrTreePath) | protected Item | getItemAt(Point point) This implementation of
AbstractTreeViewer.getItemAt(Point) returns null to ensure
API backwards compatibility. | abstract protected int | getItemCount(Control control) Returns the number of child items of the given SWT control. | abstract protected int | getItemCount(Item item) Returns the number of child items of the given SWT item. | abstract protected Item[] | getItems(Item item) Returns the child items of the given SWT item. | protected Item | getNextItem(Item item, boolean includeChildren) Returns the item after the given item in the tree, or null
if there is no next item. | protected Object | getParentElement(Object elementOrTreePath) This method takes a tree path or an element. | abstract protected Item | getParentItem(Item item) Returns the parent item of the given item in the tree, or
null if there is no parent item. | protected Item | getPreviousItem(Item item) Returns the item before the given item in the tree, or null
if there is no previous item. | protected Object[] | getRawChildren(Object parentElementOrTreePath) | abstract protected Item[] | getSelection(Control control) Returns all selected items for the given SWT control. | public ISelection | getSelection() This implementation of getSelection() returns an instance of
ITreeSelection. | protected List | getSelectionFromWidget() | protected Object[] | getSortedChildren(Object parentElementOrTreePath) | protected TreePath | getTreePathFromItem(Item item) Returns the tree path for the given item. | protected ViewerRow | getViewerRowFromItem(Widget item) | public Object[] | getVisibleExpandedElements() Gets the expanded elements that are visible to the user. | protected void | handleDoubleSelect(SelectionEvent event) | protected void | handleTreeCollapse(TreeEvent event) Handles a tree collapse event from the SWT widget. | protected void | handleTreeExpand(TreeEvent event) Handles a tree expand event from the SWT widget. | protected void | hookControl(Control control) | protected int | indexForElement(Widget parent, Object element) Returns the index where the item should be inserted.
Parameters: parent - The parent widget the element will be inserted into. Parameters: element - The element to insert. | protected void | inputChanged(Object input, Object oldInput) | public void | insert(Object parentElementOrTreePath, Object element, int position) Inserts the given element as a new child element of the given parent
element at the given position. | protected void | internalAdd(Widget widget, Object parentElementOrTreePath, Object[] childElements) Adds the given child elements to this viewer as children of the given
parent element.
EXPERIMENTAL. | protected void | internalCollapseToLevel(Widget widget, int level) Recursively collapses the subtree rooted at the given widget to the given
level. | protected Widget | internalExpand(Object elementOrPath, boolean expand) Tries to create a path of tree items for the given element or tree path. | protected void | internalExpandToLevel(Widget widget, int level) Recursively expands the subtree rooted at the given widget to the given
level. | final protected Widget[] | internalFindItems(Object parentElementOrTreePath) | protected Widget | internalGetWidgetToSelect(Object elementOrTreePath) Returns the widget to be selected for the given element or tree path. | protected void | internalInitializeTree(Control tree) Initializes the tree with root items, expanding to the appropriate
level if necessary. | final protected boolean | internalIsInputOrEmptyPath(Object elementOrTreePath) Returns true if the given object is either the input or an empty tree path. | protected void | internalRefresh(Object element) | protected void | internalRefresh(Object element, boolean updateLabels) | protected void | internalRefresh(Widget widget, Object element, boolean doStruct, boolean updateLabels) Refreshes the tree starting at the given widget.
EXPERIMENTAL. | void | internalRefreshStruct(Widget widget, Object element, boolean updateLabels) Update the structure and recurse. | protected void | internalRemove(Object[] elementsOrPaths) Removes the given elements from this viewer.
EXPERIMENTAL. | protected void | internalRemove(Object parent, Object[] elements) Removes the given elements from this viewer, whenever those elements
appear as children of the given parent. | public boolean | isExpandable(Object elementOrTreePath) Return whether the tree node representing the given element or path can
be expanded. | protected boolean | isSameSelection(List items, Item[] current) Returns true if the given list and array of items refer to
the same model elements. | protected void | labelProviderChanged() | abstract protected Item | newItem(Widget parent, int style, int index) Creates a new item. | public void | remove(Object[] elementsOrTreePaths) Removes the given elements from this viewer. | public void | remove(Object parent, Object[] elements) Removes the given elements from this viewer whenever they appear as
children of the given parent element. | public void | remove(Object elementsOrTreePaths) Removes the given element from the viewer. | abstract protected void | removeAll(Control control) Removes all items from the given control. | public void | removeTreeListener(ITreeViewerListener listener) Removes a listener for expand and collapse events in this viewer. | public void | reveal(Object elementOrTreePath) This implementation of reveal() reveals the given element or tree path. | public Item | scrollDown(int x, int y) | public Item | scrollUp(int x, int y) | public void | setAutoExpandLevel(int level) Sets the auto-expand level. | public void | setContentProvider(IContentProvider provider) The AbstractTreeViewer implementation of this method
checks to ensure that the content provider is an
ITreeContentProvider . | abstract protected void | setExpanded(Item item, boolean expand) Sets the expand state of the given item. | public void | setExpandedElements(Object[] elements) Sets which nodes are expanded in this viewer's tree. | public void | setExpandedState(Object elementOrTreePath, boolean expanded) Sets whether the node corresponding to the given element or tree path is
expanded or collapsed. | public void | setExpandedTreePaths(TreePath[] treePaths) Sets which nodes are expanded in this viewer's tree. | abstract protected void | setSelection(List items) Sets the selection to the given list of items. | protected void | setSelectionToWidget(List v, boolean reveal) This implementation of setSelectionToWidget accepts a list of elements or
a list of tree paths. | protected void | setSelectionToWidget(ISelection selection, boolean reveal) | abstract protected void | showItem(Item item) Shows the given item. | protected void | updateChildren(Widget widget, Object parent, Object[] elementChildren) Updates the tree items to correspond to the child elements of the given
parent element. | protected void | updatePlus(Item item, Object element) Updates the "+"/"-" icon of the tree node from the given element. |
AbstractTreeViewer | protected AbstractTreeViewer()(Code) | | Creates an abstract tree viewer. The viewer has no input, no content
provider, a default label provider, no sorter, no filters, and has
auto-expand turned off.
|
add | public void add(Object parentElementOrTreePath, Object[] childElements)(Code) | | Adds the given child elements to this viewer as children of the given
parent element. If this viewer does not have a sorter, the elements are
added at the end of the parent's list of children in the order given;
otherwise, the elements are inserted at the appropriate positions.
This method should be called (by the content provider) when elements have
been added to the model, in order to cause the viewer to accurately
reflect the model. This method only affects the viewer, not the model.
Parameters: parentElementOrTreePath - the parent element Parameters: childElements - the child elements to add |
add | public void add(Object parentElementOrTreePath, Object childElement)(Code) | | Adds the given child element to this viewer as a child of the given
parent element. If this viewer does not have a sorter, the element is
added at the end of the parent's list of children; otherwise, the element
is inserted at the appropriate position.
This method should be called (by the content provider) when a single
element has been added to the model, in order to cause the viewer to
accurately reflect the model. This method only affects the viewer, not
the model. Note that there is another method for efficiently processing
the simultaneous addition of multiple elements.
Parameters: parentElementOrTreePath - the parent element or path Parameters: childElement - the child element |
addSelectionListener | protected void addSelectionListener(Control control, SelectionListener listener)(Code) | | Adds the given SWT selection listener to the given SWT control.
Parameters: control - the SWT control Parameters: listener - the SWT selection listener |
addTreeListener | public void addTreeListener(ITreeViewerListener listener)(Code) | | Adds a listener for expand and collapse events in this viewer. Has no
effect if an identical listener is already registered.
Parameters: listener - a tree viewer listener |
addTreeListener | abstract protected void addTreeListener(Control control, TreeListener listener)(Code) | | Adds the given SWT tree listener to the given SWT control.
Parameters: control - the SWT control Parameters: listener - the SWT tree listener |
associate | protected void associate(Object element, Item item)(Code) | | |
collapseAll | public void collapseAll()(Code) | | Collapses all nodes of the viewer's tree, starting with the root. This
method is equivalent to collapseToLevel(ALL_LEVELS) .
|
collapseToLevel | public void collapseToLevel(Object elementOrTreePath, int level)(Code) | | Collapses the subtree rooted at the given element or tree path to the
given level.
Parameters: elementOrTreePath - the element or tree path Parameters: level - non-negative level, or ALL_LEVELS to collapseall levels of the tree |
createChildren | protected void createChildren(Widget widget)(Code) | | Creates all children for the given widget.
The default implementation of this framework method assumes that
widget.getData() returns the element corresponding to the
node. Note: the node is not visually expanded! You may have to call
parent.setExpanded(true) .
Parameters: widget - the widget |
createTreeItem | protected void createTreeItem(Widget parent, Object element, int index)(Code) | | Creates a single item for the given parent and synchronizes it with the
given element.
Parameters: parent - the parent widget Parameters: element - the element Parameters: index - if non-negative, indicates the position to insert the iteminto its parent |
disassociate | protected void disassociate(Item item)(Code) | | The AbstractTreeViewer implementation of this method also
recurses over children of the corresponding element.
|
doFindInputItem | protected Widget doFindInputItem(Object element)(Code) | | |
doGetColumnCount | protected int doGetColumnCount()(Code) | | Returns the number of columns of this viewer.
Subclasses should overwrite this method, which has a default
implementation (returning 0) for API backwards compatility reasons
the number of columns since: 3.3 |
doUpdateItem | protected void doUpdateItem(Item item, Object element)(Code) | | Copies the attributes of the given element into the given SWT item.
Parameters: item - the SWT item Parameters: element - the element |
doUpdateItem | protected void doUpdateItem(Widget widget, Object element, boolean fullMap)(Code) | | |
expandAll | public void expandAll()(Code) | | Expands all nodes of the viewer's tree, starting with the root. This
method is equivalent to expandToLevel(ALL_LEVELS) .
|
expandToLevel | public void expandToLevel(int level)(Code) | | Expands the root of the viewer's tree to the given level.
Parameters: level - non-negative level, or ALL_LEVELS to expand alllevels of the tree |
expandToLevel | public void expandToLevel(Object elementOrTreePath, int level)(Code) | | Expands all ancestors of the given element or tree path so that the given
element becomes visible in this viewer's tree control, and then expands
the subtree rooted at the given element to the given level.
Parameters: elementOrTreePath - the element Parameters: level - non-negative level, or ALL_LEVELS to expand alllevels of the tree |
getAutoExpandLevel | public int getAutoExpandLevel()(Code) | | Returns the auto-expand level.
non-negative level, or ALL_LEVELS if all levels ofthe tree are expanded automatically See Also: AbstractTreeViewer.setAutoExpandLevel |
getChild | protected Item getChild(Widget widget, int index)(Code) | | Get the child for the widget at index. Note that the default
implementation is not very efficient and should be overridden if this
class is implemented.
Parameters: widget - the widget to check Parameters: index - the index of the widget Item or null if widget is not a type that cancontain items. throws: ArrayIndexOutOfBoundsException - if the index is not valid. since: 3.1 |
getChildren | abstract protected Item[] getChildren(Widget widget)(Code) | | Returns the SWT child items for the given SWT widget.
Parameters: widget - the widget the child items |
getColumnViewerOwner | protected Widget getColumnViewerOwner(int columnIndex)(Code) | | |
getExpanded | abstract protected boolean getExpanded(Item item)(Code) | | Returns whether the given SWT item is expanded or collapsed.
Parameters: item - the item true if the item is considered expanded andfalse if collapsed |
getExpandedElements | public Object[] getExpandedElements()(Code) | | Returns a list of elements corresponding to expanded nodes in this
viewer's tree, including currently hidden ones that are marked as
expanded but are under a collapsed ancestor.
This method is typically used when preserving the interesting state of a
viewer; setExpandedElements is used during the restore.
the array of expanded elements See Also: AbstractTreeViewer.setExpandedElements |
getExpandedState | public boolean getExpandedState(Object elementOrTreePath)(Code) | | Returns whether the node corresponding to the given element or tree path
is expanded or collapsed.
Parameters: elementOrTreePath - the element true if the node is expanded, andfalse if collapsed |
getExpandedTreePaths | public TreePath[] getExpandedTreePaths()(Code) | | Returns a list of tree paths corresponding to expanded nodes in this
viewer's tree, including currently hidden ones that are marked as
expanded but are under a collapsed ancestor.
This method is typically used when preserving the interesting state of a
viewer; setExpandedElements is used during the restore.
the array of expanded tree paths See Also: AbstractTreeViewer.setExpandedElements since: 3.2 |
getFilteredChildren | protected Object[] getFilteredChildren(Object parentElementOrTreePath)(Code) | | |
getItemCount | abstract protected int getItemCount(Control control)(Code) | | Returns the number of child items of the given SWT control.
Parameters: control - the control the number of children |
getItemCount | abstract protected int getItemCount(Item item)(Code) | | Returns the number of child items of the given SWT item.
Parameters: item - the item the number of children |
getItems | abstract protected Item[] getItems(Item item)(Code) | | Returns the child items of the given SWT item.
Parameters: item - the item the child items |
getNextItem | protected Item getNextItem(Item item, boolean includeChildren)(Code) | | Returns the item after the given item in the tree, or null
if there is no next item.
Parameters: item - the item Parameters: includeChildren - true if the children are considered indetermining which item is next, and false ifsubtrees are ignored the next item, or null if none |
getParentElement | protected Object getParentElement(Object elementOrTreePath)(Code) | | This method takes a tree path or an element. If the argument is not a
tree path, returns the parent of the given element or null
if the parent is not known. If the argument is a tree path with more than
one segment, returns its parent tree path, otherwise returns
null .
Parameters: elementOrTreePath - the parent element, or parent path, or null since: 3.2 |
getParentItem | abstract protected Item getParentItem(Item item)(Code) | | Returns the parent item of the given item in the tree, or
null if there is no parent item.
Parameters: item - the item the parent item, or null if none |
getPreviousItem | protected Item getPreviousItem(Item item)(Code) | | Returns the item before the given item in the tree, or null
if there is no previous item.
Parameters: item - the item the previous item, or null if none |
getSelection | abstract protected Item[] getSelection(Control control)(Code) | | Returns all selected items for the given SWT control.
Parameters: control - the control the list of selected items |
getSelection | public ISelection getSelection()(Code) | | This implementation of getSelection() returns an instance of
ITreeSelection.
since: 3.2 |
getSelectionFromWidget | protected List getSelectionFromWidget()(Code) | | |
getSortedChildren | protected Object[] getSortedChildren(Object parentElementOrTreePath)(Code) | | |
getTreePathFromItem | protected TreePath getTreePathFromItem(Item item)(Code) | | Returns the tree path for the given item.
Parameters: item - TreePath since: 3.2 |
getViewerRowFromItem | protected ViewerRow getViewerRowFromItem(Widget item)(Code) | | |
getVisibleExpandedElements | public Object[] getVisibleExpandedElements()(Code) | | Gets the expanded elements that are visible to the user. An expanded
element is only visible if the parent is expanded.
the visible expanded elements since: 2.0 |
handleDoubleSelect | protected void handleDoubleSelect(SelectionEvent event)(Code) | | |
handleTreeCollapse | protected void handleTreeCollapse(TreeEvent event)(Code) | | Handles a tree collapse event from the SWT widget.
Parameters: event - the SWT tree event |
handleTreeExpand | protected void handleTreeExpand(TreeEvent event)(Code) | | Handles a tree expand event from the SWT widget.
Parameters: event - the SWT tree event |
hookControl | protected void hookControl(Control control)(Code) | | |
indexForElement | protected int indexForElement(Widget parent, Object element)(Code) | | Returns the index where the item should be inserted.
Parameters: parent - The parent widget the element will be inserted into. Parameters: element - The element to insert. the index of the element |
insert | public void insert(Object parentElementOrTreePath, Object element, int position)(Code) | | Inserts the given element as a new child element of the given parent
element at the given position. If this viewer has a sorter, the position
is ignored and the element is inserted at the correct position in the
sort order.
This method should be called (by the content provider) when elements have
been added to the model, in order to cause the viewer to accurately
reflect the model. This method only affects the viewer, not the model.
Parameters: parentElementOrTreePath - the parent element, or the tree path to the parent Parameters: element - the element Parameters: position - a 0-based position relative to the model, or -1 to indicatethe last position since: 3.2 |
internalAdd | protected void internalAdd(Widget widget, Object parentElementOrTreePath, Object[] childElements)(Code) | | Adds the given child elements to this viewer as children of the given
parent element.
EXPERIMENTAL. Not to be used except by JDT. This method was added to
support JDT's explorations into grouping by working sets, which requires
viewers to support multiple equal elements. See bug 76482 for more
details. This support will likely be removed in Eclipse 3.2 in favor of
proper support for multiple equal elements.
Parameters: widget - the widget for the parent element Parameters: parentElementOrTreePath - the parent element Parameters: childElements - the child elements to add since: 3.1 |
internalCollapseToLevel | protected void internalCollapseToLevel(Widget widget, int level)(Code) | | Recursively collapses the subtree rooted at the given widget to the given
level.
Note that the default implementation of this method does not call
setRedraw .
Parameters: widget - the widget Parameters: level - non-negative level, or ALL_LEVELS to collapseall levels of the tree |
internalExpand | protected Widget internalExpand(Object elementOrPath, boolean expand)(Code) | | Tries to create a path of tree items for the given element or tree path.
This method recursively walks up towards the root of the tree and in the
case of an element (rather than a tree path) assumes that
getParent returns the correct parent of an element.
Parameters: elementOrPath - the element Parameters: expand - true if all nodes on the path should beexpanded, and false otherwise Widget |
internalExpandToLevel | protected void internalExpandToLevel(Widget widget, int level)(Code) | | Recursively expands the subtree rooted at the given widget to the given
level.
Note that the default implementation of this method does not call
setRedraw .
Parameters: widget - the widget Parameters: level - non-negative level, or ALL_LEVELS to collapseall levels of the tree |
internalFindItems | final protected Widget[] internalFindItems(Object parentElementOrTreePath)(Code) | | Find the items for the given element of tree path
Parameters: parentElementOrTreePath - the element or tree path the items for that element since: 3.3 |
internalGetWidgetToSelect | protected Widget internalGetWidgetToSelect(Object elementOrTreePath)(Code) | | Returns the widget to be selected for the given element or tree path.
Parameters: elementOrTreePath - the element or tree path to select the widget to be selected, or null if not found since: 3.1 |
internalInitializeTree | protected void internalInitializeTree(Control tree)(Code) | | Initializes the tree with root items, expanding to the appropriate
level if necessary.
Parameters: tree - the tree control since: 3.3 |
internalIsInputOrEmptyPath | final protected boolean internalIsInputOrEmptyPath(Object elementOrTreePath)(Code) | | Returns true if the given object is either the input or an empty tree path.
Parameters: elementOrTreePath - an element which could either be the viewer's input, or a tree path true if the given object is either the input or an empty tree path,false otherwise. since: 3.3 |
internalRefresh | protected void internalRefresh(Object element)(Code) | | |
internalRefresh | protected void internalRefresh(Object element, boolean updateLabels)(Code) | | |
internalRefresh | protected void internalRefresh(Widget widget, Object element, boolean doStruct, boolean updateLabels)(Code) | | Refreshes the tree starting at the given widget.
EXPERIMENTAL. Not to be used except by JDT. This method was added to
support JDT's explorations into grouping by working sets, which requires
viewers to support multiple equal elements. See bug 76482 for more
details. This support will likely be removed in Eclipse 3.2 in favor of
proper support for multiple equal elements.
Parameters: widget - the widget Parameters: element - the element Parameters: doStruct - true if structural changes are to be picked up,and false if only label provider changes are ofinterest Parameters: updateLabels - true to update labels for existing elements,false to only update labels as needed, assumingthat labels for existing elements are unchanged. since: 3.1 |
internalRefreshStruct | void internalRefreshStruct(Widget widget, Object element, boolean updateLabels)(Code) | | Update the structure and recurse. Items are updated in updateChildren, as
needed.
Parameters: widget - Parameters: element - Parameters: updateLabels - |
internalRemove | protected void internalRemove(Object[] elementsOrPaths)(Code) | | Removes the given elements from this viewer.
EXPERIMENTAL. Not to be used except by JDT. This method was added to
support JDT's explorations into grouping by working sets, which requires
viewers to support multiple equal elements. See bug 76482 for more
details. This support will likely be removed in Eclipse 3.2 in favor of
proper support for multiple equal elements.
Parameters: elementsOrPaths - the elements or element paths to remove since: 3.1 |
internalRemove | protected void internalRemove(Object parent, Object[] elements)(Code) | | Removes the given elements from this viewer, whenever those elements
appear as children of the given parent.
Parameters: parent - the parent element Parameters: elements - the elements to remove since: 3.1 |
isExpandable | public boolean isExpandable(Object elementOrTreePath)(Code) | | Return whether the tree node representing the given element or path can
be expanded. Clients should query expandability by path if the viewer's
content provider is an
ITreePathContentProvider .
The default implementation of this framework method calls
hasChildren on this viewer's content provider. It may be
overridden if necessary.
Parameters: elementOrTreePath - the element or path true if the tree node representing the givenelement can be expanded, or false if not |
isSameSelection | protected boolean isSameSelection(List items, Item[] current)(Code) | | Returns true if the given list and array of items refer to
the same model elements. Order is unimportant.
This method is not intended to be overridden by subclasses.
Parameters: items - the list of items Parameters: current - the array of items true if the refer to the same elements,false otherwise since: 3.1 in TreeViewer, moved to AbstractTreeViewer in 3.3 |
labelProviderChanged | protected void labelProviderChanged()(Code) | | |
newItem | abstract protected Item newItem(Widget parent, int style, int index)(Code) | | Creates a new item.
Parameters: parent - the parent widget Parameters: style - SWT style bits Parameters: index - if non-negative, indicates the position to insert the iteminto its parent the newly-created item |
remove | public void remove(Object[] elementsOrTreePaths)(Code) | | Removes the given elements from this viewer. The selection is updated if
required.
This method should be called (by the content provider) when elements have
been removed from the model, in order to cause the viewer to accurately
reflect the model. This method only affects the viewer, not the model.
Parameters: elementsOrTreePaths - the elements to remove |
remove | public void remove(Object parent, Object[] elements)(Code) | | Removes the given elements from this viewer whenever they appear as
children of the given parent element. If the given elements also appear
as children of some other parent, the other parent will remain unchanged.
The selection is updated if required.
This method should be called (by the content provider) when elements have
been removed from the model, in order to cause the viewer to accurately
reflect the model. This method only affects the viewer, not the model.
Parameters: parent - the parent of the elements to remove Parameters: elements - the elements to remove since: 3.2 |
remove | public void remove(Object elementsOrTreePaths)(Code) | | Removes the given element from the viewer. The selection is updated if
necessary.
This method should be called (by the content provider) when a single
element has been removed from the model, in order to cause the viewer to
accurately reflect the model. This method only affects the viewer, not
the model. Note that there is another method for efficiently processing
the simultaneous removal of multiple elements.
Parameters: elementsOrTreePaths - the element |
removeAll | abstract protected void removeAll(Control control)(Code) | | Removes all items from the given control.
Parameters: control - the control |
removeTreeListener | public void removeTreeListener(ITreeViewerListener listener)(Code) | | Removes a listener for expand and collapse events in this viewer. Has no
affect if an identical listener is not registered.
Parameters: listener - a tree viewer listener |
reveal | public void reveal(Object elementOrTreePath)(Code) | | This implementation of reveal() reveals the given element or tree path.
|
scrollDown | public Item scrollDown(int x, int y)(Code) | | |
scrollUp | public Item scrollUp(int x, int y)(Code) | | |
setAutoExpandLevel | public void setAutoExpandLevel(int level)(Code) | | Sets the auto-expand level. The value 0 means that there is no
auto-expand; 1 means that top-level elements are expanded, but not their
children; 2 means that top-level elements are expanded, and their
children, but not grandchildren; and so on.
The value ALL_LEVELS means that all subtrees should be
expanded.
Parameters: level - non-negative level, or ALL_LEVELS to expand alllevels of the tree |
setContentProvider | public void setContentProvider(IContentProvider provider)(Code) | | The AbstractTreeViewer implementation of this method
checks to ensure that the content provider is an
ITreeContentProvider .
|
setExpanded | abstract protected void setExpanded(Item item, boolean expand)(Code) | | Sets the expand state of the given item.
Parameters: item - the item Parameters: expand - the expand state of the item |
setExpandedElements | public void setExpandedElements(Object[] elements)(Code) | | Sets which nodes are expanded in this viewer's tree. The given list
contains the elements that are to be expanded; all other nodes are to be
collapsed.
This method is typically used when restoring the interesting state of a
viewer captured by an earlier call to getExpandedElements .
Parameters: elements - the array of expanded elements See Also: AbstractTreeViewer.getExpandedElements |
setExpandedState | public void setExpandedState(Object elementOrTreePath, boolean expanded)(Code) | | Sets whether the node corresponding to the given element or tree path is
expanded or collapsed.
Parameters: elementOrTreePath - the element Parameters: expanded - true if the node is expanded, andfalse if collapsed |
setExpandedTreePaths | public void setExpandedTreePaths(TreePath[] treePaths)(Code) | | Sets which nodes are expanded in this viewer's tree. The given list
contains the tree paths that are to be expanded; all other nodes are to
be collapsed.
This method is typically used when restoring the interesting state of a
viewer captured by an earlier call to getExpandedTreePaths .
Parameters: treePaths - the array of expanded tree paths See Also: AbstractTreeViewer.getExpandedTreePaths() since: 3.2 |
setSelection | abstract protected void setSelection(List items)(Code) | | Sets the selection to the given list of items.
Parameters: items - list of items (element type:org.eclipse.swt.widgets.Item ) |
setSelectionToWidget | protected void setSelectionToWidget(List v, boolean reveal)(Code) | | This implementation of setSelectionToWidget accepts a list of elements or
a list of tree paths.
|
setSelectionToWidget | protected void setSelectionToWidget(ISelection selection, boolean reveal)(Code) | | |
showItem | abstract protected void showItem(Item item)(Code) | | Shows the given item.
Parameters: item - the item |
updateChildren | protected void updateChildren(Widget widget, Object parent, Object[] elementChildren)(Code) | | Updates the tree items to correspond to the child elements of the given
parent element. If null is passed for the children, this method obtains
them (only if needed).
Parameters: widget - the widget Parameters: parent - the parent element Parameters: elementChildren - the child elements, or null |
updatePlus | protected void updatePlus(Item item, Object element)(Code) | | Updates the "+"/"-" icon of the tree node from the given element. It
calls isExpandable to determine whether an element is
expandable.
Parameters: item - the item Parameters: element - the element |
Methods inherited from org.eclipse.jface.viewers.StructuredViewer | public void addDoubleClickListener(IDoubleClickListener listener)(Code)(Java Doc) public void addDragSupport(int operations, Transfer[] transferTypes, DragSourceListener listener)(Code)(Java Doc) public void addDropSupport(int operations, Transfer[] transferTypes, DropTargetListener listener)(Code)(Java Doc) public void addFilter(ViewerFilter filter)(Code)(Java Doc) public void addOpenListener(IOpenListener listener)(Code)(Java Doc) public void addPostSelectionChangedListener(ISelectionChangedListener listener)(Code)(Java Doc) protected void assertContentProviderType(IContentProvider provider)(Code)(Java Doc) protected void assertElementsNotNull(Object[] elements)(Code)(Java Doc) protected void associate(Object element, Item item)(Code)(Java Doc) protected void buildLabel(ViewerLabel updateLabel, Object element)(Code)(Java Doc) void buildLabel(ViewerLabel updateLabel, Object element, IViewerLabelProvider labelProvider)(Code)(Java Doc) void buildLabel(ViewerLabel updateLabel, TreePath elementPath, ITreePathLabelProvider labelProvider)(Code)(Java Doc) void buildLabel(ViewerLabel updateLabel, Object element, ILabelProvider labelProvider)(Code)(Java Doc) protected void disassociate(Item item)(Code)(Java Doc) abstract protected Widget doFindInputItem(Object element)(Code)(Java Doc) abstract protected Widget doFindItem(Object element)(Code)(Java Doc) abstract protected void doUpdateItem(Widget item, Object element, boolean fullMap)(Code)(Java Doc) protected boolean equals(Object elementA, Object elementB)(Code)(Java Doc) protected Object[] filter(Object[] elements)(Code)(Java Doc) final protected Widget findItem(Object element)(Code)(Java Doc) final protected Widget[] findItems(Object element)(Code)(Java Doc) protected void fireDoubleClick(DoubleClickEvent event)(Code)(Java Doc) protected void fireOpen(OpenEvent event)(Code)(Java Doc) protected void firePostSelectionChanged(SelectionChangedEvent event)(Code)(Java Doc) protected ColorAndFontCollector getColorAndFontCollector()(Code)(Java Doc) public ViewerComparator getComparator()(Code)(Java Doc) public IElementComparer getComparer()(Code)(Java Doc) protected Object[] getFilteredChildren(Object parent)(Code)(Java Doc) public ViewerFilter[] getFilters()(Code)(Java Doc) protected Item getItem(int x, int y)(Code)(Java Doc) protected Object[] getRawChildren(Object parent)(Code)(Java Doc) protected Object getRoot()(Code)(Java Doc) public ISelection getSelection()(Code)(Java Doc) abstract protected List getSelectionFromWidget()(Code)(Java Doc) protected Object[] getSortedChildren(Object parent)(Code)(Java Doc) public ViewerSorter getSorter()(Code)(Java Doc) protected void handleDispose(DisposeEvent event)(Code)(Java Doc) protected void handleDoubleSelect(SelectionEvent event)(Code)(Java Doc) protected void handleInvalidSelection(ISelection invalidSelection, ISelection newSelection)(Code)(Java Doc) protected void handleLabelProviderChanged(LabelProviderChangedEvent event)(Code)(Java Doc) protected void handleOpen(SelectionEvent event)(Code)(Java Doc) protected void handlePostSelect(SelectionEvent e)(Code)(Java Doc) protected void handleSelect(SelectionEvent event)(Code)(Java Doc) protected boolean hasFilters()(Code)(Java Doc) protected void hookControl(Control control)(Code)(Java Doc) abstract protected void internalRefresh(Object element)(Code)(Java Doc) protected void internalRefresh(Object element, boolean updateLabels)(Code)(Java Doc) protected void internalUpdate(Widget widget, Object element, String[] properties)(Code)(Java Doc) protected void mapElement(Object element, Widget item)(Code)(Java Doc) protected boolean needsRefilter(Object element, String property)(Code)(Java Doc) CustomHashtable newHashtable(int capacity)(Code)(Java Doc) protected void preservingSelection(Runnable updateCode)(Code)(Java Doc) void preservingSelection(Runnable updateCode, boolean reveal)(Code)(Java Doc) public void refresh()(Code)(Java Doc) public void refresh(boolean updateLabels)(Code)(Java Doc) public void refresh(Object element)(Code)(Java Doc) public void refresh(Object element, boolean updateLabels)(Code)(Java Doc) final protected void refreshItem(Widget widget, Object element)(Code)(Java Doc) public void removeDoubleClickListener(IDoubleClickListener listener)(Code)(Java Doc) public void removeFilter(ViewerFilter filter)(Code)(Java Doc) public void removeOpenListener(IOpenListener listener)(Code)(Java Doc) public void removePostSelectionChangedListener(ISelectionChangedListener listener)(Code)(Java Doc) public void resetFilters()(Code)(Java Doc) abstract public void reveal(Object element)(Code)(Java Doc) public void setComparator(ViewerComparator comparator)(Code)(Java Doc) public void setComparer(IElementComparer comparer)(Code)(Java Doc) public void setContentProvider(IContentProvider provider)(Code)(Java Doc) public void setFilters(ViewerFilter[] filters)(Code)(Java Doc) final public void setInput(Object input)(Code)(Java Doc) public void setLabelProvider(IBaseLabelProvider labelProvider)(Code)(Java Doc) public void setSelection(ISelection selection, boolean reveal)(Code)(Java Doc) abstract protected void setSelectionToWidget(List l, boolean reveal)(Code)(Java Doc) protected void setSelectionToWidget(ISelection selection, boolean reveal)(Code)(Java Doc) public void setSorter(ViewerSorter sorter)(Code)(Java Doc) public void setUseHashlookup(boolean enable)(Code)(Java Doc) public Widget testFindItem(Object element)(Code)(Java Doc) public Widget[] testFindItems(Object element)(Code)(Java Doc) protected void unmapAllElements()(Code)(Java Doc) protected void unmapElement(Object element)(Code)(Java Doc) protected void unmapElement(Object element, Widget item)(Code)(Java Doc) public void update(Object[] elements, String[] properties)(Code)(Java Doc) public void update(Object element, String[] properties)(Code)(Java Doc) final protected void updateItem(Widget widget, Object element)(Code)(Java Doc) protected void updateSelection(ISelection selection)(Code)(Java Doc) protected boolean usingElementMap()(Code)(Java Doc)
|
Fields inherited from org.eclipse.jface.viewers.Viewer | final protected static String WIDGET_DATA_KEY(Code)(Java Doc)
|
|
|