RSE
Release 1.0

org.eclipse.rse.ui.view
Interface ISystemTree

All Known Implementing Classes:
SystemView, SystemViewForm

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
 boolean areAnySelectedItemsExpandable()
           
 boolean areAnySelectedItemsExpanded()
           
 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.
 Item getViewerItem()
          Returns the tree item of the first selected object.
 boolean isSelectedOrChildSelected(Object parentElement)
          Helper method to determine if a given object is currently selected.
 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 updatePropertySheet()
          Called when a property is updated and we need to inform the Property Sheet viewer.
 

Method Detail

sameParent

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public Item getViewerItem()
Returns the tree item of the first selected object. Used for setViewerItem in a resource change event.

Returns:
the item

areAnySelectedItemsExpanded

public boolean areAnySelectedItemsExpanded()
Returns:
true if any of the selected items are currently expanded

areAnySelectedItemsExpandable

public boolean areAnySelectedItemsExpandable()
Returns:
true if any of the selected items are expandable but not yet expanded

RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.