org.eclipse.rse.ui.view
Interface ISystemTree
-
public interface ISystemTree
To drive our GUI we find ourselves adding additional useful methods on top of the
JFace tree viewer in our subclasses. We capture those here in an interface so they
can be implemented by other viewers that wish to fully drive our UI. Typically this
is for interesting properties in the property sheet.
Method Summary
|
void
|
addDoubleClickListener
(
IDoubleClickListener listener)
Adds a double-click listener |
void
|
addFilter
(
ViewerFilter filter)
Adds a view filter |
void
|
addSelectionChangedListener
(
ISelectionChangedListener listener)
Adds a selection changed listener |
boolean
|
areAnySelectedItemsExpandable
()
|
boolean
|
areAnySelectedItemsExpanded
()
|
void
|
createTreeItems
(
TreeItem widget,
Object[] children)
Create tree items for the specified children |
void
|
expandTo
(
Object parentObject,
Object remoteObject)
Expands the parent object down to the remote object |
void
|
expandTo
(
String filterString)
Expand to the object specified by the filter string |
List
|
findAllRemoteItemReferences
(
Object element,
Object elementObject,
List matches)
Recursively tries to find a given remote object. |
Item
|
findFirstRemoteItemReference
(
Object remoteObject,
Item parentItem)
Find the first binary-match or name-match of a remote object, given its binary object. |
int
|
getChildCount
(
Object element)
|
Object[]
|
getElementNodes
(
Object element)
This returns an array containing each element in the tree, up to but not including the root. |
Object
|
getNextElement
()
This returns the element immediately after the last selected element in this tree level
Often needed for enablement decisions for move down actions. |
Object
|
getPreviousElement
()
This returns the element immediately before the first selected element in this tree level. |
Object
|
getRootParent
()
This is called to walk the tree back up to the roots and return the visible root
node for the first selected object. |
Object
|
getSelectedParent
()
This is called to accurately get the parent object for the current selection
for this viewer. |
Tree
|
getTree
()
Return the Tree widget |
Item
|
getViewerItem
()
Returns the tree item of the first selected object. |
boolean
|
isExpandable
(
Object elementOrTreePath)
Checks whether the element is expandable or not |
boolean
|
isSelectedOrChildSelected
(
Object parentElement)
Helper method to determine if a given object is currently selected. |
ISystemFilterReference
|
revealAndExpand
(
ISubSystem parentSubSystem,
ISystemFilter filter)
Expand a given filter, given a subsystem that contains a reference to the filter's pool. |
boolean
|
sameParent
()
This is called to ensure all elements in a multiple-selection have the same parent in the
tree viewer. |
void
|
select
(
Object element,
boolean expand)
Called to select an object within the tree, and optionally expand it. |
void
|
setAutoExpandLevel
(int level)
Sets the auto expand level for the corresponding tree |
void
|
updatePropertySheet
()
Called when a property is updated and we need to inform the Property Sheet viewer. |
sameParent
boolean sameParent()
- This is called to ensure all elements in a multiple-selection have the same parent in the
tree viewer. Typically used to disable actions that must take place on a coordinated
selection.
-
-
Returns:
- true if the elements of the selection in the viewer all have the same parent
select
void select(
Object element,
boolean expand)
- Called to select an object within the tree, and optionally expand it.
-
-
Parameters:
-
element
- the element in the tree to select -
expand
- true if the element is to be expanded
getChildCount
int getChildCount(
Object element)
-
-
Parameters:
-
element
- the element in the tree to query
-
Returns:
- the number of immediate children in the tree, for the given tree node
getSelectedParent
Object getSelectedParent()
- This is called to accurately get the parent object for the current selection
for this viewer.
The getParent() method in the adapter is unreliable since adapted objects are
unaware of the context which can change via filtering and view options.
-
-
Returns:
- the parent of the selection
getPreviousElement
Object getPreviousElement()
- This returns the element immediately before the first selected element in this tree level.
Often needed for enablement decisions for move up actions.
-
-
Returns:
- the object prior to the selection, null if there is none
getNextElement
Object getNextElement()
- This returns the element immediately after the last selected element in this tree level
Often needed for enablement decisions for move down actions.
-
-
Returns:
- the object after the selection, null if there is none
getRootParent
Object getRootParent()
- This is called to walk the tree back up to the roots and return the visible root
node for the first selected object.
-
-
Returns:
- the root object
getElementNodes
Object[] getElementNodes(
Object element)
- This returns an array containing each element in the tree, up to but not including the root.
The array is in reverse order, starting at the leaf and going up.
-
-
Parameters:
-
element
- the element from which to begin
-
Returns:
- the array of objects in the path from leaf to root. Excluding the leaf and root.
isSelectedOrChildSelected
boolean isSelectedOrChildSelected(
Object parentElement)
- Helper method to determine if a given object is currently selected.
Considers an element to be "selected" if a child node of the given object is currently selected.
-
-
Parameters:
-
parentElement
- the element to query
-
Returns:
- true if the element covers any portion of the selection
updatePropertySheet
void updatePropertySheet()
- Called when a property is updated and we need to inform the Property Sheet viewer.
There is no formal mechanism for this so we simulate a selection changed event as
this is the only event the property sheet listens for.
-
getViewerItem
Item getViewerItem()
- Returns the tree item of the first selected object. Used for setViewerItem in a resource
change event.
-
-
Returns:
- the item
areAnySelectedItemsExpanded
boolean areAnySelectedItemsExpanded()
-
-
Returns:
- true if any of the selected items are currently expanded
areAnySelectedItemsExpandable
boolean areAnySelectedItemsExpandable()
-
-
Returns:
- true if any of the selected items are expandable but not yet expanded
findFirstRemoteItemReference
Item findFirstRemoteItemReference(
Object remoteObject,
Item parentItem)
- Find the first binary-match or name-match of a remote object, given its binary object.
-
-
Parameters:
-
remoteObject
- - The remote object to find. -
parentItem
- - Optionally, the parent item to start the search at
-
Returns:
- TreeItem hit if found
-
Since:
- 3.0
revealAndExpand
ISystemFilterReference revealAndExpand(
ISubSystem parentSubSystem,
ISystemFilter filter)
- Expand a given filter, given a subsystem that contains a reference to the filter's pool.
This will expand down to the filter if needed
-
-
Parameters:
-
parentSubSystem
- - the subsystem containing a reference to the filter's parent pool -
filter
- - the filter to find, reveal, and expand within the subsystem context
-
Returns:
- the filter reference to the filter if found and expanded. This is a unique binary address
within the object's in this tree, so can be used in the viewer methods to affect this particular
node.
-
Since:
- 3.0
getTree
Tree getTree()
- Return the Tree widget
-
-
Returns:
- tree widget
-
Since:
- 3.0
createTreeItems
void createTreeItems(
TreeItem widget,
Object[] children)
- Create tree items for the specified children
-
-
Parameters:
-
widget
- the parent item for the items to create -
children
- the children to create items for -
Since:
- 3.0
findAllRemoteItemReferences
List findAllRemoteItemReferences(
Object element,
Object elementObject,
List matches)
- Recursively tries to find a given remote object. Since the object memory object
for a remote object is not dependable we call getAbsoluteName() on the adapter to
do the comparisons. Note this does not take into account the parent connection or
subsystem or filter, hence you must know where to start the search, else you risk
finding the wrong one.
-
-
Parameters:
-
element
- the remote object to which we want to find a tree item which references it. Can be a string or an object -
elementObject
- the actual remote element to find, for binary matching, optionally for cases when element is a string -
matches
- the List to populate with hits, or null
to
get a new List created and returned with the hits.
-
Returns:
- the List populated with hits, or
null
if null
was passed in as the List to populate and no hits were found. -
Since:
- 3.0
setAutoExpandLevel
void setAutoExpandLevel(int level)
- Sets the auto expand level for the corresponding tree
-
-
Parameters:
-
level
- the level to expand -
Since:
- 3.0
addDoubleClickListener
void addDoubleClickListener(
IDoubleClickListener listener)
- Adds a double-click listener
-
-
Parameters:
-
listener
- the listener to add -
Since:
- 3.0
isExpandable
boolean isExpandable(
Object elementOrTreePath)
- Checks whether the element is expandable or not
-
-
Parameters:
-
elementOrTreePath
- the object to expand
-
Returns:
- whether the item is expandable
-
Since:
- 3.0
expandTo
void expandTo(
Object parentObject,
Object remoteObject)
- Expands the parent object down to the remote object
-
-
Parameters:
-
parentObject
- the parent object -
remoteObject
- the child object -
Since:
- 3.0
expandTo
void expandTo(
String filterString)
- Expand to the object specified by the filter string
-
-
Parameters:
-
filterString
- the string represending the object to expand to -
Since:
- 3.0
addFilter
void addFilter(
ViewerFilter filter)
- Adds a view filter
-
-
Parameters:
-
filter
- the view filter -
Since:
- 3.0
addSelectionChangedListener
void addSelectionChangedListener(
ISelectionChangedListener listener)
- Adds a selection changed listener
-
-
Parameters:
-
listener
- the listener -
Since:
- 3.0
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.