|
Eclipse Platform Release 3.2 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.jface.viewers.StructuredViewer
org.eclipse.jface.viewers.AbstractTreeViewer
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
.
TreeViewer
,
TableTreeViewer
Nested Class Summary |
---|
Nested classes inherited from class org.eclipse.jface.viewers.StructuredViewer |
---|
StructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders |
Field Summary | |
---|---|
static int |
ALL_LEVELS
Constant indicating that all levels of the tree should be expanded or collapsed. |
Fields inherited from class org.eclipse.jface.viewers.Viewer |
---|
WIDGET_DATA_KEY |
Constructor Summary | |
---|---|
protected |
AbstractTreeViewer()
Creates an abstract tree viewer. |
Method Summary | |
---|---|
void |
add(Object parentElementOrTreePath,
Object childElement)
Adds the given child element to this viewer as a child of the given parent element. |
void |
add(Object parentElementOrTreePath,
Object[] childElements)
Adds the given child elements to this viewer as children of the given parent element. |
protected void |
addSelectionListener(Control control,
SelectionListener listener)
Deprecated. |
protected abstract void |
addTreeListener(Control control,
TreeListener listener)
Adds the given SWT tree listener to the given SWT control. |
void |
addTreeListener(ITreeViewerListener listener)
Adds a listener for expand and collapse events in this viewer. |
protected void |
assertContentProviderType(IContentProvider provider)
Assert that the content provider is of one of the supported types. |
protected void |
associate(Object element,
Item item)
Associates the given element with the given widget. |
void |
collapseAll()
Collapses all nodes of the viewer's tree, starting with the root. |
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. |
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 void |
disassociate(Item item)
The AbstractTreeViewer implementation of this method also
recurses over children of the corresponding element. |
protected Widget |
doFindInputItem(Object element)
Returns the widget in this viewer's control which represents the given element if it is the viewer's input. |
protected Widget |
doFindItem(Object element)
Returns the widget in this viewer's control which represent the given element. |
protected abstract 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)
Copies the attributes of the given element into the given SWT item. |
void |
expandAll()
Expands all nodes of the viewer's tree, starting with the root. |
void |
expandToLevel(int level)
Expands the root of the viewer's tree to the given level. |
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. |
int |
getAutoExpandLevel()
Returns the auto-expand level. |
protected Item |
getChild(Widget widget,
int index)
Get the child for the widget at index. |
protected abstract Item[] |
getChildren(Widget widget)
Returns the SWT child items for the given SWT widget. |
protected abstract boolean |
getExpanded(Item item)
Returns whether the given SWT item is expanded or collapsed. |
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. |
boolean |
getExpandedState(Object elementOrTreePath)
Returns whether the node corresponding to the given element or tree path is expanded or collapsed. |
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)
Returns the filtered array of children of the given element. |
protected abstract int |
getItemCount(Control control)
Returns the number of child items of the given SWT control. |
protected abstract int |
getItemCount(Item item)
Returns the number of child items of the given SWT item. |
protected abstract 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. |
protected abstract 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)
Returns the children of the given parent without sorting and filtering them. |
ISelection |
getSelection()
This implementation of getSelection() returns an instance of ITreeSelection. |
protected abstract Item[] |
getSelection(Control control)
Returns all selected items for the given SWT control. |
protected List |
getSelectionFromWidget()
Retrieves the selection, as a List , from the underlying
widget. |
protected Object[] |
getSortedChildren(Object parentElementOrTreePath)
Returns the sorted and filtered set of children of the given element. |
protected TreePath |
getTreePathFromItem(Item item)
Returns the tree path for the given item. |
Object[] |
getVisibleExpandedElements()
Gets the expanded elements that are visible to the user. |
protected void |
handleDoubleSelect(SelectionEvent event)
Handles a double-click select event from the widget. |
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)
Adds event listener hooks to the given control. |
protected int |
indexForElement(Widget parent,
Object element)
Returns the index where the item should be inserted. |
protected void |
inputChanged(Object input,
Object oldInput)
Internal hook method called when the input to this viewer is initially set or subsequently changed. |
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. |
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. |
protected Widget |
internalGetWidgetToSelect(Object elementOrTreePath)
Returns the widget to be selected for the given element or tree path. |
protected void |
internalRefresh(Object element)
Refreshes this viewer starting at the given element. |
protected void |
internalRefresh(Object element,
boolean updateLabels)
Refreshes this viewer starting at the given element. |
protected void |
internalRefresh(Widget widget,
Object element,
boolean doStruct,
boolean updateLabels)
Refreshes the tree starting at the given widget. |
protected void |
internalRemove(Object[] elementsOrPaths)
Removes the given elements from this viewer. |
protected void |
internalRemove(Object parent,
Object[] elements)
Removes the given elements from this viewer, whenever those elements appear as children of the given parent. |
boolean |
isExpandable(Object elementOrTreePath)
Return whether the tree node representing the given element or path can be expanded. |
protected void |
labelProviderChanged()
Notifies that the label provider has changed. |
protected abstract Item |
newItem(Widget parent,
int style,
int index)
Creates a new item. |
void |
remove(Object elementsOrTreePaths)
Removes the given element from the viewer. |
void |
remove(Object[] elementsOrTreePaths)
Removes the given elements from this viewer. |
void |
remove(Object parent,
Object[] elements)
Removes the given elements from this viewer whenever they appear as children of the given parent element. |
protected abstract void |
removeAll(Control control)
Removes all items from the given control. |
void |
removeTreeListener(ITreeViewerListener listener)
Removes a listener for expand and collapse events in this viewer. |
void |
reveal(Object elementOrTreePath)
This implementation of reveal() reveals the given element or tree path. |
Item |
scrollDown(int x,
int y)
Scrolls the viewer's control down by one item from the given display-relative coordinates. |
Item |
scrollUp(int x,
int y)
Scrolls the viewer's control up by one item from the given display-relative coordinates. |
void |
setAutoExpandLevel(int level)
Sets the auto-expand level. |
void |
setContentProvider(IContentProvider provider)
The AbstractTreeViewer implementation of this method
checks to ensure that the content provider is an ITreeContentProvider . |
protected abstract void |
setExpanded(Item item,
boolean expand)
Sets the expand state of the given item. |
void |
setExpandedElements(Object[] elements)
Sets which nodes are expanded in this viewer's tree. |
void |
setExpandedState(Object elementOrTreePath,
boolean expanded)
Sets whether the node corresponding to the given element or tree path is expanded or collapsed. |
void |
setExpandedTreePaths(TreePath[] treePaths)
Sets which nodes are expanded in this viewer's tree. |
protected abstract void |
setSelection(List items)
Sets the selection to the given list of items. |
protected void |
setSelectionToWidget(ISelection selection,
boolean reveal)
Converts the selection to a List and calls
setSelectionToWidget(List, boolean) . |
protected void |
setSelectionToWidget(List v,
boolean reveal)
This implementation of setSelectionToWidget accepts a list of elements or a list of tree paths. |
protected abstract void |
showItem(Item item)
Shows the given item. |
protected void |
updateChildren(Widget widget,
Object parent,
Object[] elementChildren)
Deprecated. this is no longer called by the framework |
protected void |
updatePlus(Item item,
Object element)
Updates the "+"/"-" icon of the tree node from the given element. |
Methods inherited from class org.eclipse.jface.viewers.ContentViewer |
---|
getContentProvider, getInput, getLabelProvider, handleDispose |
Methods inherited from class org.eclipse.jface.viewers.Viewer |
---|
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getControl, 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 |
Field Detail |
public static final int ALL_LEVELS
expandToLevel(int)
,
collapseToLevel(java.lang.Object, int)
,
Constant Field ValuesConstructor Detail |
protected AbstractTreeViewer()
Method Detail |
public void add(Object parentElementOrTreePath, Object[] childElements)
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.
parentElementOrTreePath
- the parent elementchildElements
- the child elements to addprotected void internalAdd(Widget widget, Object parentElementOrTreePath, Object[] childElements)
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 favour of proper support for multiple equal elements.
widget
- the widget for the parent elementparentElementOrTreePath
- the parent elementchildElements
- the child elements to addprotected int indexForElement(Widget parent, Object element)
parent
- The parent widget the element will be inserted into.element
- The element to insert.
protected Object[] getSortedChildren(Object parentElementOrTreePath)
StructuredViewer
getSortedChildren
in class StructuredViewer
parentElementOrTreePath
- the parent element
protected Object[] getFilteredChildren(Object parentElementOrTreePath)
StructuredViewer
getFilteredChildren
in class StructuredViewer
parentElementOrTreePath
- the parent element
public void add(Object parentElementOrTreePath, Object childElement)
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.
parentElementOrTreePath
- the parent element or pathchildElement
- the child elementprotected void addSelectionListener(Control control, SelectionListener listener)
control
- the SWT controllistener
- the SWT selection listenerpublic void addTreeListener(ITreeViewerListener listener)
listener
- a tree viewer listenerprotected abstract void addTreeListener(Control control, TreeListener listener)
control
- the SWT controllistener
- the SWT tree listenerprotected void associate(Object element, Item item)
StructuredViewer
associate
in class StructuredViewer
element
- the elementitem
- the widgetpublic void collapseAll()
collapseToLevel(ALL_LEVELS)
.
public void collapseToLevel(Object elementOrTreePath, int level)
elementOrTreePath
- the element or tree pathlevel
- non-negative level, or ALL_LEVELS
to collapse
all levels of the treeprotected void createChildren(Widget 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)
.
widget
- the widgetprotected void createTreeItem(Widget parent, Object element, int index)
parent
- the parent widgetelement
- the elementindex
- if non-negative, indicates the position to insert the item
into its parentprotected void disassociate(Item item)
AbstractTreeViewer
implementation of this method also
recurses over children of the corresponding element.
disassociate
in class StructuredViewer
item
- the widgetprotected Widget doFindInputItem(Object element)
StructuredViewer
This method is internal to the framework; subclassers should not call this method.
doFindInputItem
in class StructuredViewer
element
-
null
if noneprotected Widget doFindItem(Object element)
StructuredViewer
This method is internal to the framework; subclassers should not call this method.
doFindItem
in class StructuredViewer
element
-
null
if noneprotected abstract void doUpdateItem(Item item, Object element)
item
- the SWT itemelement
- the elementprotected void doUpdateItem(Widget widget, Object element, boolean fullMap)
StructuredViewer
fullMap
.
If fullMap
is true
then the current mapping
from element to widgets is removed and the new mapping is added. If
fullmap is false
then only the new map gets installed.
Installing only the new map is necessary in cases where only the order of
elements changes but not the set of elements.
This method is internal to the framework; subclassers should not call this method.
doUpdateItem
in class StructuredViewer
widget
- element
- elementfullMap
- true
if mappings are added and removed, and
false
if only the new map gets installedpublic void expandAll()
expandToLevel(ALL_LEVELS)
.
public void expandToLevel(int level)
level
- non-negative level, or ALL_LEVELS
to expand all
levels of the treepublic void expandToLevel(Object elementOrTreePath, int level)
elementOrTreePath
- the elementlevel
- non-negative level, or ALL_LEVELS
to expand all
levels of the treeprotected void fireTreeCollapsed(TreeExpansionEvent event)
event
- the tree expansion eventITreeViewerListener.treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent)
protected void fireTreeExpanded(TreeExpansionEvent event)
event
- the tree expansion eventITreeViewerListener.treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent)
public int getAutoExpandLevel()
ALL_LEVELS
if all levels
of the tree are expanded automaticallysetAutoExpandLevel(int)
protected abstract Item[] getChildren(Widget widget)
widget
- the widget
protected Item getChild(Widget widget, int index)
widget
- the widget to checkindex
- the index of the widget
null
if widget is not a type
that can contain items.
ArrayIndexOutOfBoundsException
- if the index is not valid.protected abstract boolean getExpanded(Item item)
item
- the item
true
if the item is considered expanded and
false
if collapsedpublic Object[] getExpandedElements()
This method is typically used when preserving the interesting state of a
viewer; setExpandedElements
is used during the restore.
setExpandedElements(java.lang.Object[])
public boolean getExpandedState(Object elementOrTreePath)
elementOrTreePath
- the element
true
if the node is expanded, and false
if collapsedprotected abstract int getItemCount(Control control)
control
- the control
protected abstract int getItemCount(Item item)
item
- the item
protected abstract Item[] getItems(Item item)
item
- the item
protected Item getNextItem(Item item, boolean includeChildren)
null
if there is no next item.
item
- the itemincludeChildren
- true
if the children are considered in
determining which item is next, and false
if
subtrees are ignored
null
if noneprotected abstract Item getParentItem(Item item)
null
if there is no parent item.
item
- the item
null
if noneprotected Item getPreviousItem(Item item)
null
if there is no previous item.
item
- the item
null
if noneprotected Object[] getRawChildren(Object parentElementOrTreePath)
StructuredViewer
Returns an empty array if the given parent is null
.
getRawChildren
in class StructuredViewer
parentElementOrTreePath
- the parent element
protected abstract Item[] getSelection(Control control)
control
- the control
protected List getSelectionFromWidget()
StructuredViewer
List
, from the underlying
widget.
getSelectionFromWidget
in class StructuredViewer
protected void handleDoubleSelect(SelectionEvent event)
StructuredViewer
This method is internal to the framework; subclassers should not call this method.
handleDoubleSelect
in class StructuredViewer
event
- the SWT selection eventprotected void handleTreeCollapse(TreeEvent event)
event
- the SWT tree eventprotected void handleTreeExpand(TreeEvent event)
event
- the SWT tree eventprotected void hookControl(Control control)
ContentViewer
All subclasses must call this method when their control is first established.
The ContentViewer
implementation of this method hooks
dispose events for the given control.
Subclasses may override if they need to add other control hooks;
however, super.hookControl
must be invoked.
hookControl
in class StructuredViewer
protected void inputChanged(Object input, Object oldInput)
Viewer
The default implementation does nothing. Subclassers may override this method to do something when a viewer's input is set. A typical use is populate the viewer.
inputChanged
in class Viewer
input
- the new input of this viewer, or null
if noneoldInput
- the old input element or null
if there
was previously no inputprotected void internalCollapseToLevel(Widget widget, int level)
Note that the default implementation of this method does not call
setRedraw
.
widget
- the widgetlevel
- non-negative level, or ALL_LEVELS
to collapse
all levels of the treeprotected Widget internalExpand(Object elementOrPath, boolean expand)
getParent
returns the correct parent of an element.
elementOrPath
- the elementexpand
- true
if all nodes on the path should be
expanded, and false
otherwise
protected Object getParentElement(Object elementOrTreePath)
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
.
elementOrTreePath
-
null
protected Widget internalGetWidgetToSelect(Object elementOrTreePath)
elementOrTreePath
- the element or tree path to select
null
if not foundprotected void internalExpandToLevel(Widget widget, int level)
Note that the default implementation of this method does not call
setRedraw
.
widget
- the widgetlevel
- non-negative level, or ALL_LEVELS
to collapse
all levels of the treeprotected void internalRefresh(Object element)
StructuredViewer
internalRefresh
in class StructuredViewer
element
- the elementprotected void internalRefresh(Object element, boolean updateLabels)
StructuredViewer
refresh(boolean updateLabels)
.
The default implementation simply calls
internalRefresh(element)
, ignoring
updateLabels
.
If this method is overridden to do the actual refresh, then
internalRefresh(Object element)
should simply call
internalRefresh(element, true)
.
internalRefresh
in class StructuredViewer
element
- the elementupdateLabels
- true
to update labels for existing elements,
false
to only update labels as needed, assuming
that labels for existing elements are unchanged.protected void internalRefresh(Widget widget, Object element, boolean doStruct, boolean updateLabels)
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 favour of proper support for multiple equal elements.
widget
- the widgetelement
- the elementdoStruct
- true
if structural changes are to be picked up,
and false
if only label provider changes are of
interestupdateLabels
- true
to update labels for existing elements,
false
to only update labels as needed, assuming
that labels for existing elements are unchanged.protected void internalRemove(Object[] elementsOrPaths)
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 favour of proper support for multiple equal elements.
elementsOrPaths
- the elements or element paths to removeprotected void internalRemove(Object parent, Object[] elements)
elements
- the elements to removepublic boolean isExpandable(Object elementOrTreePath)
ITreePathContentProvider
.
The default implementation of this framework method calls hasChildren
on this viewer's content provider. It may be overridden if necessary.
elementOrTreePath
- the element or path
true
if the tree node representing the given
element can be expanded, or false
if notprotected void labelProviderChanged()
ContentViewer
The ContentViewer
implementation of this method calls refresh()
.
Subclasses may reimplement or extend.
labelProviderChanged
in class ContentViewer
protected abstract Item newItem(Widget parent, int style, int index)
parent
- the parent widgetstyle
- SWT style bitsindex
- if non-negative, indicates the position to insert the item
into its parent
public void remove(Object[] elementsOrTreePaths)
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.
elementsOrTreePaths
- the elements to removepublic void remove(Object parent, Object[] elements)
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.
parent
- the parent of the elements to removeelements
- the elements to removepublic void remove(Object elementsOrTreePaths)
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.
elementsOrTreePaths
- the elementprotected abstract void removeAll(Control control)
control
- the controlpublic void removeTreeListener(ITreeViewerListener listener)
listener
- a tree viewer listenerpublic void reveal(Object elementOrTreePath)
reveal
in class StructuredViewer
elementOrTreePath
- the element to revealpublic Item scrollDown(int x, int y)
Viewer
null
if no scrolling occurred or if the viewer
doesn't represent an item-based widget.
scrollDown
in class Viewer
x
- horizontal coordinatey
- vertical coordinatepublic Item scrollUp(int x, int y)
Viewer
null
if no scrolling occurred or if the viewer
doesn't represent an item-based widget.
scrollUp
in class Viewer
x
- horizontal coordinatey
- vertical coordinatepublic void setAutoExpandLevel(int level)
The value ALL_LEVELS
means that all subtrees should be
expanded.
level
- non-negative level, or ALL_LEVELS
to expand all
levels of the treepublic void setContentProvider(IContentProvider provider)
AbstractTreeViewer
implementation of this method
checks to ensure that the content provider is an ITreeContentProvider
.
setContentProvider
in class StructuredViewer
protected void assertContentProviderType(IContentProvider provider)
StructuredViewer
assertContentProviderType
in class StructuredViewer
provider
- protected abstract void setExpanded(Item item, boolean expand)
item
- the itemexpand
- the expand state of the itempublic void setExpandedElements(Object[] elements)
This method is typically used when restoring the interesting state of a
viewer captured by an earlier call to getExpandedElements
.
elements
- the array of expanded elementsgetExpandedElements()
public void setExpandedTreePaths(TreePath[] treePaths)
This method is typically used when restoring the interesting state of a
viewer captured by an earlier call to getExpandedTreePaths
.
treePaths
- the array of expanded tree pathsgetExpandedTreePaths()
public void setExpandedState(Object elementOrTreePath, boolean expanded)
elementOrTreePath
- the elementexpanded
- true
if the node is expanded, and false
if collapsedprotected abstract void setSelection(List items)
items
- list of items (element type: org.eclipse.swt.widgets.Item
)protected void setSelectionToWidget(List v, boolean reveal)
setSelectionToWidget
in class StructuredViewer
v
- list of selected elements (element type: Object
)
or null
if the selection is to be clearedreveal
- true
if the selection is to be made visible,
and false
otherwiseprotected abstract void showItem(Item item)
item
- the itemprotected void updateChildren(Widget widget, Object parent, Object[] elementChildren)
widget
- the widgetparent
- the parent elementelementChildren
- the child elements, or nullprotected void updatePlus(Item item, Object element)
isExpandable
to determine whether an element is
expandable.
item
- the itemelement
- the elementpublic Object[] getVisibleExpandedElements()
protected TreePath getTreePathFromItem(Item item)
public ISelection getSelection()
getSelection
in interface ISelectionProvider
getSelection
in class StructuredViewer
protected void setSelectionToWidget(ISelection selection, boolean reveal)
StructuredViewer
List
and calls
setSelectionToWidget(List, boolean)
. The selection is
expected to be an IStructuredSelection
of elements. If
not, the selection is cleared.
Subclasses do not typically override this method, but implement
setSelectionToWidget(List, boolean)
instead.
setSelectionToWidget
in class StructuredViewer
selection
- an IStructuredSelection of elementsreveal
- true
to reveal the first element in the
selection, or false
otherwisepublic TreePath[] getExpandedTreePaths()
This method is typically used when preserving the interesting state of a
viewer; setExpandedElements
is used during the restore.
setExpandedElements(java.lang.Object[])
public void insert(Object parentElementOrTreePath, Object element, int position)
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.
parentElementOrTreePath
- the parent element, or the tree path to the parentelement
- the elementposition
- a 0-based position relative to the model, or -1 to indicate
the last position
|
Eclipse Platform Release 3.2 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.