|
|||||||||
| Home >> All >> org >> eclipse >> jface >> [ viewers overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.jface.viewers
Class AbstractTreeViewer

java.lang.Objectorg.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.jface.viewers.StructuredViewer
org.eclipse.jface.viewers.AbstractTreeViewer
- All Implemented Interfaces:
- IInputProvider, IInputSelectionProvider, IPostSelectionProvider, ISelectionProvider
- Direct Known Subclasses:
- TableTreeViewer, TreeViewer
- public abstract class AbstractTreeViewer
- extends StructuredViewer
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.
Content providers for abstract tree viewers must implement the ITreeContentProvider
interface.
| Nested Class Summary | |
(package private) class |
AbstractTreeViewer.UpdateItemSafeRunnable
Safe runnable used to update an item. |
| Field Summary | |
static int |
ALL_LEVELS
Constant indicating that all levels of the tree should be expanded or collapsed. |
private int |
expandToLevel
The level to which the tree is automatically expanded each time the viewer's input is changed (that is, by setInput). |
private org.eclipse.jface.util.ListenerList |
treeListeners
List of registered tree listeners (element type: TreeListener). |
| Fields inherited from class org.eclipse.jface.viewers.StructuredViewer |
|
| Fields inherited from class org.eclipse.jface.viewers.ContentViewer |
|
| 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(java.lang.Object parentElement,
java.lang.Object childElement)
Adds the given child element to this viewer as a child of the given parent element. |
void |
add(java.lang.Object parentElement,
java.lang.Object[] childElements)
Adds the given child elements to this viewer as children of the given parent element. |
protected void |
addSelectionListener(org.eclipse.swt.widgets.Control control,
org.eclipse.swt.events.SelectionListener listener)
Deprecated. |
protected abstract void |
addTreeListener(org.eclipse.swt.widgets.Control control,
org.eclipse.swt.events.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 |
associate(java.lang.Object element,
org.eclipse.swt.widgets.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(java.lang.Object element,
int level)
Collapses the subtree rooted at the given element to the given level. |
private void |
createAddedElement(org.eclipse.swt.widgets.Widget widget,
java.lang.Object element)
Create the new element in the parent widget. |
protected void |
createChildren(org.eclipse.swt.widgets.Widget widget)
Creates all children for the given widget. |
protected void |
createTreeItem(org.eclipse.swt.widgets.Widget parent,
java.lang.Object element,
int index)
Creates a single item for the given parent and synchronizes it with the given element. |
protected void |
disassociate(org.eclipse.swt.widgets.Item item)
The AbstractTreeViewer implementation of this method also
recurses over children of the corresponding element. |
private void |
disassociateChildren(org.eclipse.swt.widgets.Item item)
Disassociates the children of the given SWT item from their corresponding elements. |
protected org.eclipse.swt.widgets.Widget |
doFindInputItem(java.lang.Object element)
Returns the widget in this viewer's control which represents the given element if it is the viewer's input. |
protected org.eclipse.swt.widgets.Widget |
doFindItem(java.lang.Object element)
Returns the widget in this viewer's control which represent the given element. |
protected abstract void |
doUpdateItem(org.eclipse.swt.widgets.Item item,
java.lang.Object element)
Copies the attributes of the given element into the given SWT item. |
protected void |
doUpdateItem(org.eclipse.swt.widgets.Widget widget,
java.lang.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(java.lang.Object element,
int level)
Expands all ancestors of the given element 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 abstract org.eclipse.swt.widgets.Item[] |
getChildren(org.eclipse.swt.widgets.Widget widget)
Returns the SWT child items for the given SWT widget. |
protected abstract boolean |
getExpanded(org.eclipse.swt.widgets.Item item)
Returns whether the given SWT item is expanded or collapsed. |
java.lang.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(java.lang.Object element)
Returns whether the node corresponding to the given element is expanded or collapsed. |
protected abstract int |
getItemCount(org.eclipse.swt.widgets.Control control)
Returns the number of child items of the given SWT control. |
protected abstract int |
getItemCount(org.eclipse.swt.widgets.Item item)
Returns the number of child items of the given SWT item. |
protected abstract org.eclipse.swt.widgets.Item[] |
getItems(org.eclipse.swt.widgets.Item item)
Returns the child items of the given SWT item. |
protected org.eclipse.swt.widgets.Item |
getNextItem(org.eclipse.swt.widgets.Item item,
boolean includeChildren)
Returns the item after the given item in the tree, or null
if there is no next item. |
protected abstract org.eclipse.swt.widgets.Item |
getParentItem(org.eclipse.swt.widgets.Item item)
Returns the parent item of the given item in the tree, or null
if there is parent item. |
protected org.eclipse.swt.widgets.Item |
getPreviousItem(org.eclipse.swt.widgets.Item item)
Returns the item before the given item in the tree, or null
if there is no previous item. |
protected java.lang.Object[] |
getRawChildren(java.lang.Object parent)
Returns the children of the given parent without sorting and filtering them. |
protected abstract org.eclipse.swt.widgets.Item[] |
getSelection(org.eclipse.swt.widgets.Control control)
Returns all selected items for the given SWT control. |
protected java.util.List |
getSelectionFromWidget()
Retrieves the selection, as a List, from the underlying
widget. |
java.lang.Object[] |
getVisibleExpandedElements()
Gets the expanded elements that are visible to the user. |
protected void |
handleTreeCollapse(org.eclipse.swt.events.TreeEvent event)
Handles a tree collapse event from the SWT widget. |
protected void |
handleTreeExpand(org.eclipse.swt.events.TreeEvent event)
Handles a tree expand event from the SWT widget. |
protected void |
hookControl(org.eclipse.swt.widgets.Control control)
Adds event listener hooks to the given control. |
protected int |
indexForElement(org.eclipse.swt.widgets.Widget parent,
java.lang.Object element)
Returns the index where the item should be inserted. |
protected void |
inputChanged(java.lang.Object input,
java.lang.Object oldInput)
Internal hook method called when the input to this viewer is initially set or subsequently changed. |
protected void |
internalCollapseToLevel(org.eclipse.swt.widgets.Widget widget,
int level)
Recursively collapses the subtree rooted at the given widget to the given level. |
private void |
internalCollectExpanded(java.util.List result,
org.eclipse.swt.widgets.Widget widget)
Recursively collects all expanded elements from the given widget. |
private void |
internalCollectVisibleExpanded(java.util.ArrayList result,
org.eclipse.swt.widgets.Widget widget)
|
protected org.eclipse.swt.widgets.Widget |
internalExpand(java.lang.Object element,
boolean expand)
Tries to create a path of tree items for the given element. |
protected void |
internalExpandToLevel(org.eclipse.swt.widgets.Widget widget,
int level)
Recursively expands the subtree rooted at the given widget to the given level. |
private org.eclipse.swt.widgets.Widget |
internalFindChild(org.eclipse.swt.widgets.Item parent,
java.lang.Object element)
Non-recursively tries to find the given element as a child of the given parent item. |
private org.eclipse.swt.widgets.Widget |
internalFindItem(org.eclipse.swt.widgets.Item parent,
java.lang.Object element)
Recursively tries to find the given element. |
protected void |
internalRefresh(java.lang.Object element)
Refreshes this viewer starting at the given element. |
protected void |
internalRefresh(java.lang.Object element,
boolean updateLabels)
Refreshes this viewer starting at the given element. |
private void |
internalRefresh(org.eclipse.swt.widgets.Widget widget,
java.lang.Object element,
boolean doStruct,
boolean updateLabels)
Refreshes the tree starting at the given widget. |
private void |
internalRefreshStruct(org.eclipse.swt.widgets.Widget widget,
java.lang.Object element,
boolean updateLabels)
Update the structure and recurse. |
private void |
internalRemove(java.lang.Object[] elements)
Removes the given elements from this viewer. |
private void |
internalSetExpanded(CustomHashtable expandedElements,
org.eclipse.swt.widgets.Widget widget)
Sets the expanded state of all items to correspond to the given set of expanded elements. |
boolean |
isExpandable(java.lang.Object element)
Return whether the tree node representing the given element can be expanded. |
protected void |
labelProviderChanged()
Notifies that the label provider has changed. |
protected abstract org.eclipse.swt.widgets.Item |
newItem(org.eclipse.swt.widgets.Widget parent,
int style,
int index)
Creates a new item. |
void |
remove(java.lang.Object element)
Removes the given element from the viewer. |
void |
remove(java.lang.Object[] elements)
Removes the given elements from this viewer. |
protected abstract void |
removeAll(org.eclipse.swt.widgets.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(java.lang.Object element)
Ensures that the given element is visible, scrolling the viewer if necessary. |
private org.eclipse.swt.widgets.Item |
rightMostVisibleDescendent(org.eclipse.swt.widgets.Item item)
Returns the rightmost visible descendent of the given item. |
org.eclipse.swt.widgets.Item |
scrollDown(int x,
int y)
Scrolls the viewer's control down by one item from the given display-relative coordinates. |
org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.Item item,
boolean expand)
Sets the expand state of the given item. |
void |
setExpandedElements(java.lang.Object[] elements)
Sets which nodes are expanded in this viewer's tree. |
void |
setExpandedState(java.lang.Object element,
boolean expanded)
Sets whether the node corresponding to the given element is expanded or collapsed. |
protected abstract void |
setSelection(java.util.List items)
Sets the selection to the given list of items. |
protected void |
setSelectionToWidget(java.util.List v,
boolean reveal)
Parlays the given list of selected elements into selections on this viewer's control. |
protected abstract void |
showItem(org.eclipse.swt.widgets.Item item)
Shows the given item. |
protected void |
updateChildren(org.eclipse.swt.widgets.Widget widget,
java.lang.Object parent,
java.lang.Object[] elementChildren)
Deprecated. this is no longer called by the framework |
private void |
updateChildren(org.eclipse.swt.widgets.Widget widget,
java.lang.Object parent,
java.lang.Object[] elementChildren,
boolean updateLabels)
Updates the tree items to correspond to the child elements of the given parent element. |
protected void |
updatePlus(org.eclipse.swt.widgets.Item item,
java.lang.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, setLabelProvider |
| 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 |
ALL_LEVELS
public static final int ALL_LEVELS
- Constant indicating that all levels of the tree should be expanded or
collapsed.
- See Also:
expandToLevel55 ,collapseToLevel(java.lang.Object, int)55 , Constant Field Values
treeListeners
private org.eclipse.jface.util.ListenerList treeListeners
- List of registered tree listeners (element type:
TreeListener).
expandToLevel
private int expandToLevel
- The level to which the tree is automatically expanded each time the
viewer's input is changed (that is, by
setInput). A value of 0 means that auto-expand is off.- See Also:
setAutoExpandLevel(int)55
| Constructor Detail |
AbstractTreeViewer
protected AbstractTreeViewer()
- 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.
| Method Detail |
add
public void add(java.lang.Object parentElement, java.lang.Object[] childElements)
- 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.
createAddedElement
private void createAddedElement(org.eclipse.swt.widgets.Widget widget, java.lang.Object element)
- Create the new element in the parent widget. If the
child already exists do nothing.
indexForElement
protected int indexForElement(org.eclipse.swt.widgets.Widget parent, java.lang.Object element)
- Returns the index where the item should be inserted.
add
public void add(java.lang.Object parentElement, java.lang.Object childElement)
- 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.
addSelectionListener
protected void addSelectionListener(org.eclipse.swt.widgets.Control control, org.eclipse.swt.events.SelectionListener listener)
- Deprecated.
- Adds the given SWT selection listener to the given SWT control.
- Adds the given SWT selection listener to the given SWT control.
addTreeListener
public void addTreeListener(ITreeViewerListener listener)
- Adds a listener for expand and collapse events in this viewer. Has no
effect if an identical listener is already registered.
addTreeListener
protected abstract void addTreeListener(org.eclipse.swt.widgets.Control control, org.eclipse.swt.events.TreeListener listener)
- Adds the given SWT tree listener to the given SWT control.
associate
protected void associate(java.lang.Object element, org.eclipse.swt.widgets.Item item)
- Description copied from class:
StructuredViewer - Associates the given element with the given widget. Sets the given item's
data to be the element, and maps the element to the item in the element
map (if enabled).
- Overrides:
associatein classStructuredViewer
collapseAll
public void collapseAll()
- Collapses all nodes of the viewer's tree, starting with the root. This
method is equivalent to
collapseToLevel(ALL_LEVELS).
collapseToLevel
public void collapseToLevel(java.lang.Object element, int level)
- Collapses the subtree rooted at the given element to the given level.
createChildren
protected void createChildren(org.eclipse.swt.widgets.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. Note: the node is not visually expanded! You may have to callparent.setExpanded(true).
createTreeItem
protected void createTreeItem(org.eclipse.swt.widgets.Widget parent, java.lang.Object element, int index)
- Creates a single item for the given parent and synchronizes it with the
given element.
disassociate
protected void disassociate(org.eclipse.swt.widgets.Item item)
- The
AbstractTreeViewerimplementation of this method also recurses over children of the corresponding element.- Overrides:
disassociatein classStructuredViewer
disassociateChildren
private void disassociateChildren(org.eclipse.swt.widgets.Item item)
- Disassociates the children of the given SWT item from their
corresponding elements.
doFindInputItem
protected org.eclipse.swt.widgets.Widget doFindInputItem(java.lang.Object element)
- Description copied from class:
StructuredViewer - Returns the widget in this viewer's control which represents the given
element if it is the viewer's input.
This method is internal to the framework; subclassers should not call this method.
- Specified by:
doFindInputItemin classStructuredViewer
doFindItem
protected org.eclipse.swt.widgets.Widget doFindItem(java.lang.Object element)
- Description copied from class:
StructuredViewer - Returns the widget in this viewer's control which represent the given
element. This method searchs all the children of the input element.
This method is internal to the framework; subclassers should not call this method.
- Specified by:
doFindItemin classStructuredViewer
doUpdateItem
protected abstract void doUpdateItem(org.eclipse.swt.widgets.Item item, java.lang.Object element)
- Copies the attributes of the given element into the given SWT item.
doUpdateItem
protected void doUpdateItem(org.eclipse.swt.widgets.Widget widget, java.lang.Object element, boolean fullMap)
- Description copied from class:
StructuredViewer - Copies the attributes of the given element into the given SWT item. The
element map is updated according to the value of
fullMap. IffullMapistruethen the current mapping from element to widgets is removed and the new mapping is added. If fullmap isfalsethen 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.
- Specified by:
doUpdateItemin classStructuredViewer
expandAll
public void expandAll()
- 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)
- Expands the root of the viewer's tree to the given level.
expandToLevel
public void expandToLevel(java.lang.Object element, int level)
- Expands all ancestors of the given element 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.
fireTreeCollapsed
protected void fireTreeCollapsed(TreeExpansionEvent event)
- Fires a tree collapsed event. Only listeners registered at the time this
method is called are notified.
fireTreeExpanded
protected void fireTreeExpanded(TreeExpansionEvent event)
- Fires a tree expanded event. Only listeners registered at the time this
method is called are notified.
getAutoExpandLevel
public int getAutoExpandLevel()
- Returns the auto-expand level.
getChildren
protected abstract org.eclipse.swt.widgets.Item[] getChildren(org.eclipse.swt.widgets.Widget widget)
- Returns the SWT child items for the given SWT widget.
getExpanded
protected abstract boolean getExpanded(org.eclipse.swt.widgets.Item item)
- Returns whether the given SWT item is expanded or collapsed.
getExpandedElements
public java.lang.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.
This method is typically used when preserving the interesting state of a viewer;
setExpandedElementsis used during the restore.
getExpandedState
public boolean getExpandedState(java.lang.Object element)
- Returns whether the node corresponding to the given element is expanded
or collapsed.
getItemCount
protected abstract int getItemCount(org.eclipse.swt.widgets.Control control)
- Returns the number of child items of the given SWT control.
getItemCount
protected abstract int getItemCount(org.eclipse.swt.widgets.Item item)
- Returns the number of child items of the given SWT item.
getItems
protected abstract org.eclipse.swt.widgets.Item[] getItems(org.eclipse.swt.widgets.Item item)
- Returns the child items of the given SWT item.
getNextItem
protected org.eclipse.swt.widgets.Item getNextItem(org.eclipse.swt.widgets.Item item, boolean includeChildren)
- Returns the item after the given item in the tree, or
nullif there is no next item.
getParentItem
protected abstract org.eclipse.swt.widgets.Item getParentItem(org.eclipse.swt.widgets.Item item)
- Returns the parent item of the given item in the tree, or
nullif there is parent item.
getPreviousItem
protected org.eclipse.swt.widgets.Item getPreviousItem(org.eclipse.swt.widgets.Item item)
- Returns the item before the given item in the tree, or
nullif there is no previous item.
getRawChildren
protected java.lang.Object[] getRawChildren(java.lang.Object parent)
- Description copied from class:
StructuredViewer - Returns the children of the given parent without sorting and filtering
them. The resulting array must not be modified, as it may come directly
from the model's internal state.
Returns an empty array if the given parent is
null.- Overrides:
getRawChildrenin classStructuredViewer
getSelection
protected abstract org.eclipse.swt.widgets.Item[] getSelection(org.eclipse.swt.widgets.Control control)
- Returns all selected items for the given SWT control.
getSelectionFromWidget
protected java.util.List getSelectionFromWidget()
- Description copied from class:
StructuredViewer - Retrieves the selection, as a
List, from the underlying widget.- Specified by:
getSelectionFromWidgetin classStructuredViewer
handleTreeCollapse
protected void handleTreeCollapse(org.eclipse.swt.events.TreeEvent event)
- Handles a tree collapse event from the SWT widget.
handleTreeExpand
protected void handleTreeExpand(org.eclipse.swt.events.TreeEvent event)
- Handles a tree expand event from the SWT widget.
hookControl
protected void hookControl(org.eclipse.swt.widgets.Control control)
- Description copied from class:
ContentViewer - Adds event listener hooks to the given control.
All subclasses must call this method when their control is first established.
The
ContentViewerimplementation of this method hooks dispose events for the given control. Subclasses may override if they need to add other control hooks; however,super.hookControlmust be invoked.- Overrides:
hookControlin classStructuredViewer
inputChanged
protected void inputChanged(java.lang.Object input, java.lang.Object oldInput)
- Description copied from class:
Viewer - Internal hook method called when the input to this viewer is
initially set or subsequently changed.
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.
- Overrides:
inputChangedin classViewer
internalCollapseToLevel
protected void internalCollapseToLevel(org.eclipse.swt.widgets.Widget widget, int level)
- Recursively collapses the subtree rooted at the given widget to the
given level.
Note that the default implementation of this method does not callsetRedraw.
internalCollectExpanded
private void internalCollectExpanded(java.util.List result, org.eclipse.swt.widgets.Widget widget)
- Recursively collects all expanded elements from the given widget.
internalExpand
protected org.eclipse.swt.widgets.Widget internalExpand(java.lang.Object element, boolean expand)
- Tries to create a path of tree items for the given element. This method
recursively walks up towards the root of the tree and assumes that
getParentreturns the correct parent of an element.
internalExpandToLevel
protected void internalExpandToLevel(org.eclipse.swt.widgets.Widget widget, int level)
- Recursively expands the subtree rooted at the given widget to the given
level.
Note that the default implementation of this method does not callsetRedraw.
internalFindChild
private org.eclipse.swt.widgets.Widget internalFindChild(org.eclipse.swt.widgets.Item parent, java.lang.Object element)
- Non-recursively tries to find the given element as a child of the given
parent item.
internalFindItem
private org.eclipse.swt.widgets.Widget internalFindItem(org.eclipse.swt.widgets.Item parent, java.lang.Object element)
- Recursively tries to find the given element.
internalRefresh
protected void internalRefresh(java.lang.Object element)
- Description copied from class:
StructuredViewer - Refreshes this viewer starting at the given element.
- Specified by:
internalRefreshin classStructuredViewer
internalRefresh
protected void internalRefresh(java.lang.Object element, boolean updateLabels)
- Description copied from class:
StructuredViewer - Refreshes this viewer starting at the given element. Labels are updated
as described in
refresh(boolean updateLabels).The default implementation simply calls
internalRefresh(element), ignoringupdateLabels.If this method is overridden to do the actual refresh, then
internalRefresh(Object element)should simply callinternalRefresh(element, true).- Overrides:
internalRefreshin classStructuredViewer
internalRefresh
private void internalRefresh(org.eclipse.swt.widgets.Widget widget, java.lang.Object element, boolean doStruct, boolean updateLabels)
- Refreshes the tree starting at the given widget.
internalRefreshStruct
private void internalRefreshStruct(org.eclipse.swt.widgets.Widget widget, java.lang.Object element, boolean updateLabels)
- Update the structure and recurse. Items are updated in updateChildren,
as needed.
internalRemove
private void internalRemove(java.lang.Object[] elements)
- Removes the given elements from this viewer.
internalSetExpanded
private void internalSetExpanded(CustomHashtable expandedElements, org.eclipse.swt.widgets.Widget widget)
- Sets the expanded state of all items to correspond to the given set of
expanded elements.
isExpandable
public boolean isExpandable(java.lang.Object element)
- Return whether the tree node representing the given element can be
expanded.
The default implementation of this framework method calls
hasChildrenon this viewer's content provider. It may be overridden if necessary.
labelProviderChanged
protected void labelProviderChanged()
- Description copied from class:
ContentViewer - Notifies that the label provider has changed.
The
ContentViewerimplementation of this method callsrefresh(). Subclasses may reimplement or extend.- Overrides:
labelProviderChangedin classContentViewer
newItem
protected abstract org.eclipse.swt.widgets.Item newItem(org.eclipse.swt.widgets.Widget parent, int style, int index)
- Creates a new item.
remove
public void remove(java.lang.Object[] elements)
- 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.
remove
public void remove(java.lang.Object element)
- 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.
removeAll
protected abstract void removeAll(org.eclipse.swt.widgets.Control control)
- Removes all items from the given control.
removeTreeListener
public void removeTreeListener(ITreeViewerListener listener)
- Removes a listener for expand and collapse events in this viewer. Has no
affect if an identical listener is not registered.
reveal
public void reveal(java.lang.Object element)
- Description copied from class:
StructuredViewer - Ensures that the given element is visible, scrolling the viewer if
necessary. The selection is unchanged.
- Specified by:
revealin classStructuredViewer
rightMostVisibleDescendent
private org.eclipse.swt.widgets.Item rightMostVisibleDescendent(org.eclipse.swt.widgets.Item item)
- Returns the rightmost visible descendent of the given item. Returns the
item itself if it has no children.
scrollDown
public org.eclipse.swt.widgets.Item scrollDown(int x, int y)
- Description copied from class:
Viewer - Scrolls the viewer's control down by one item from the given
display-relative coordinates. Returns the newly revealed Item,
or
nullif no scrolling occurred or if the viewer doesn't represent an item-based widget.- Overrides:
scrollDownin classViewer
scrollUp
public org.eclipse.swt.widgets.Item scrollUp(int x, int y)
- Description copied from class:
Viewer - Scrolls the viewer's control up by one item from the given
display-relative coordinates. Returns the newly revealed Item,
or
nullif no scrolling occurred or if the viewer doesn't represent an item-based widget.
setAutoExpandLevel
public void setAutoExpandLevel(int level)
- 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_LEVELSmeans that all subtrees should be expanded.
setContentProvider
public void setContentProvider(IContentProvider provider)
- The
AbstractTreeViewerimplementation of this method checks to ensure that the content provider is anITreeContentProvider.- Overrides:
setContentProviderin classStructuredViewer
setExpanded
protected abstract void setExpanded(org.eclipse.swt.widgets.Item item, boolean expand)
- Sets the expand state of the given item.
setExpandedElements
public void setExpandedElements(java.lang.Object[] elements)
- 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.
setExpandedState
public void setExpandedState(java.lang.Object element, boolean expanded)
- Sets whether the node corresponding to the given element is expanded or
collapsed.
setSelection
protected abstract void setSelection(java.util.List items)
- Sets the selection to the given list of items.
setSelectionToWidget
protected void setSelectionToWidget(java.util.List v, boolean reveal)
- Description copied from class:
StructuredViewer - Parlays the given list of selected elements into selections on this
viewer's control.
Subclasses should override to set their selection based on the given list of elements.
- Specified by:
setSelectionToWidgetin classStructuredViewer
showItem
protected abstract void showItem(org.eclipse.swt.widgets.Item item)
- Shows the given item.
updateChildren
protected void updateChildren(org.eclipse.swt.widgets.Widget widget, java.lang.Object parent, java.lang.Object[] elementChildren)
- Deprecated. this is no longer called by the framework
- 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).
- 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).
updateChildren
private void updateChildren(org.eclipse.swt.widgets.Widget widget, java.lang.Object parent, java.lang.Object[] elementChildren, boolean updateLabels)
- 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).
- Since:
- 2.1
updatePlus
protected void updatePlus(org.eclipse.swt.widgets.Item item, java.lang.Object element)
- Updates the "+"/"-" icon of the tree node from the given element. It
calls
isExpandableto determine whether an element is expandable.
getVisibleExpandedElements
public java.lang.Object[] getVisibleExpandedElements()
- Gets the expanded elements that are visible to the user. An expanded
element is only visible if the parent is expanded.
- Since:
- 2.0
internalCollectVisibleExpanded
private void internalCollectVisibleExpanded(java.util.ArrayList result, org.eclipse.swt.widgets.Widget widget)
|
|||||||||
| Home >> All >> org >> eclipse >> jface >> [ viewers overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC