TPTP 4.5.0 Platform Project
Internal API Specification

org.eclipse.tptp.platform.probekit.launch.internal.wizard
Class CustomResourceTreeAndListGroup

java.lang.Object
  extended by org.eclipse.tptp.platform.probekit.launch.internal.wizard.CustomResourceTreeAndListGroup
All Implemented Interfaces:
org.eclipse.jface.viewers.ICheckStateListener, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.jface.viewers.ITreeViewerListener

public class CustomResourceTreeAndListGroup
extends java.lang.Object
implements org.eclipse.jface.viewers.ICheckStateListener, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.jface.viewers.ITreeViewerListener

Workbench-level composite that combines a CheckboxTreeViewer and CheckboxListViewer. All viewer selection-driven interactions are handled within this object. See also org.eclipse.ui.internal.ide.dialogs.ResourceTreeAndListGroup.


Constructor Summary
CustomResourceTreeAndListGroup(org.eclipse.swt.widgets.Composite parent, java.lang.Object rootObject, org.eclipse.jface.viewers.ITreeContentProvider treeContentProvider, org.eclipse.jface.viewers.ILabelProvider treeLabelProvider, org.eclipse.jface.viewers.IStructuredContentProvider listContentProvider, org.eclipse.jface.viewers.ILabelProvider listLabelProvider, int style, boolean useHeightHint)
          Create an instance of this class.
 
Method Summary
 void aboutToOpen()
          This method must be called just before this window becomes visible.
 void addCheckStateListener(org.eclipse.jface.viewers.ICheckStateListener listener)
          Add the passed listener to self's collection of clients that listen for changes to element checked states
protected  boolean areAllChildrenWhiteChecked(java.lang.Object treeElement)
          Return a boolean indicating whether all children of the passed tree element are currently white-checked
protected  boolean areAllElementsChecked(java.lang.Object treeElement)
          Return a boolean indicating whether all list elements associated with the passed tree element are currently checked
protected  void checkNewTreeElements(java.lang.Object[] elements)
          Iterate through the passed elements which are being realized for the first time and check each one in the tree viewer as appropriate
 void checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent event)
          An item was checked in one of self's two views.
protected  void createContents(org.eclipse.swt.widgets.Composite parent, int style, boolean useHeightHint)
          Lay out and initialize self's visual components.
protected  void createListViewer(org.eclipse.swt.widgets.Composite parent, boolean useHeightHint)
          Create this group's list viewer.
protected  void createTreeViewer(org.eclipse.swt.widgets.Composite parent, boolean useHeightHint)
          Create this group's tree viewer.
protected  boolean determineShouldBeAtLeastGrayChecked(java.lang.Object treeElement)
          Returns a boolean indicating whether the passed tree element should be at LEAST gray-checked.
protected  boolean determineShouldBeWhiteChecked(java.lang.Object treeElement)
          Returns a boolean indicating whether the passed tree item should be white-checked.
protected  void determineWhiteCheckedDescendents(java.lang.Object treeElement)
          Recursively add appropriate tree elements to the collection of known white-checked tree elements.
 void expandAll()
          Cause the tree viewer to expand all its items
 java.util.List getAllCheckedListItems()
          Returns a flat list of all of the leaf elements which are checked.
 void getAllCheckedListItems(ICustomElementFilter filter, org.eclipse.core.runtime.IProgressMonitor monitor)
          Returns a flat list of all of the leaf elements which are checked.
 java.util.List getAllWhiteCheckedItems()
          Returns a list of all of the items that are white checked.
 int getCheckedElementCount()
          Answer the number of elements that have been checked by the user.
protected  java.lang.String getFullLabel(java.lang.Object treeElement, java.lang.String parentLabel)
          Get the full label of the treeElement (its name and its parent's name).
protected  int getListItemsSize(java.lang.Object treeElement)
          Return a count of the number of list items associated with a given tree item.
 org.eclipse.swt.widgets.Table getListTable()
          Get the table the list viewer uses.
 org.eclipse.swt.widgets.Tree getTree()
          Get the tree the tree viewer uses.
protected  void grayCheckHierarchy(java.lang.Object treeElement)
          Logically gray-check all ancestors of treeItem by ensuring that they appear in the checked table
 void initialCheckListItem(java.lang.Object element)
          Set the initial checked state of the passed list element to true.
 void initialCheckTreeItem(java.lang.Object element)
          Set the initial checked state of the passed element to true, as well as to all of its children and associated list elements
protected  void initialize()
          Initialize this group's viewers after they have been laid out.
protected  void listItemChecked(java.lang.Object listElement, boolean state, boolean updatingFromSelection)
          Callback that's invoked when the checked status of an item in the list is changed by the user.
protected  void notifyCheckStateChangeListeners(org.eclipse.jface.viewers.CheckStateChangedEvent event)
          Notify all checked state listeners that the passed element has had its checked state changed to the passed state
protected  void populateListViewer(java.lang.Object treeElement)
          Set the contents of the list viewer based upon the specified selected tree element.
 void removeCheckStateListener(org.eclipse.jface.viewers.ICheckStateListener listener)
          Remove the passed listener from self's collection of clients that listen for changes to element checked states
 void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
          Handle the selection of an item in the tree viewer
 void setAllSelections(boolean selection)
          Select or deselect all of the elements in the tree depending on the value of the selection boolean.
 void setFocus()
          Set the focus on to the list widget.
 void setListProviders(org.eclipse.jface.viewers.IStructuredContentProvider contentProvider, org.eclipse.jface.viewers.ILabelProvider labelProvider)
          Set the list viewer's providers to those passed
 void setListSorter(org.eclipse.jface.viewers.ViewerSorter sorter)
          Set the sorter that is to be applied to self's list viewer
 void setRoot(java.lang.Object newRoot)
          Set the root of the widget to be new Root.
protected  void setTreeChecked(java.lang.Object treeElement, boolean state)
          Set the checked state of the passed tree element appropriately, and do so recursively to all of its child tree elements as well
 void setTreeProviders(org.eclipse.jface.viewers.ITreeContentProvider contentProvider, org.eclipse.jface.viewers.ILabelProvider labelProvider)
          Set the tree viewer's providers to those passed
 void setTreeSorter(org.eclipse.jface.viewers.ViewerSorter sorter)
          Set the sorter that is to be applied to self's tree viewer
protected  void setWhiteChecked(java.lang.Object treeElement, boolean isWhiteChecked)
          Adjust the collection of references to white-checked tree elements appropriately.
 void treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent event)
          Handle the collapsing of an element in a tree viewer
 void treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent event)
          Handle the expansionsion of an element in a tree viewer
protected  void treeItemChecked(java.lang.Object treeElement, boolean state)
          Callback that's invoked when the checked status of an item in the tree is changed by the user.
protected  void ungrayCheckHierarchy(java.lang.Object treeElement)
          Logically un-gray-check all ancestors of treeItem iff appropriate.
protected  void updateHierarchy(java.lang.Object treeElement)
          Set the checked state of self and all ancestors appropriately
 void updateSelections(java.util.Map items)
          Update the selections of the tree elements in items to reflect the new selections provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomResourceTreeAndListGroup

public CustomResourceTreeAndListGroup(org.eclipse.swt.widgets.Composite parent,
                                      java.lang.Object rootObject,
                                      org.eclipse.jface.viewers.ITreeContentProvider treeContentProvider,
                                      org.eclipse.jface.viewers.ILabelProvider treeLabelProvider,
                                      org.eclipse.jface.viewers.IStructuredContentProvider listContentProvider,
                                      org.eclipse.jface.viewers.ILabelProvider listLabelProvider,
                                      int style,
                                      boolean useHeightHint)
Create an instance of this class. Use this constructor if you wish to specify the width and/or height of the combined widget (to only hardcode one of the sizing dimensions, specify the other dimension's value as -1)

Parameters:
parent - org.eclipse.swt.widgets.Composite
style - int
rootObject - java.lang.Object
childPropertyName - java.lang.String
parentPropertyName - java.lang.String
listPropertyName - java.lang.String
useHeightHint - If true then use the height hint to make this group big enough
Method Detail

aboutToOpen

public void aboutToOpen()
This method must be called just before this window becomes visible.


addCheckStateListener

public void addCheckStateListener(org.eclipse.jface.viewers.ICheckStateListener listener)
Add the passed listener to self's collection of clients that listen for changes to element checked states

Parameters:
listener - ICheckStateListener

areAllChildrenWhiteChecked

protected boolean areAllChildrenWhiteChecked(java.lang.Object treeElement)
Return a boolean indicating whether all children of the passed tree element are currently white-checked

Parameters:
treeElement - java.lang.Object
Returns:
boolean

areAllElementsChecked

protected boolean areAllElementsChecked(java.lang.Object treeElement)
Return a boolean indicating whether all list elements associated with the passed tree element are currently checked

Parameters:
treeElement - java.lang.Object
Returns:
boolean

checkNewTreeElements

protected void checkNewTreeElements(java.lang.Object[] elements)
Iterate through the passed elements which are being realized for the first time and check each one in the tree viewer as appropriate


checkStateChanged

public void checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent event)
An item was checked in one of self's two views. Determine which view this occurred in and delegate appropriately

Specified by:
checkStateChanged in interface org.eclipse.jface.viewers.ICheckStateListener
Parameters:
event - CheckStateChangedEvent

createContents

protected void createContents(org.eclipse.swt.widgets.Composite parent,
                              int style,
                              boolean useHeightHint)
Lay out and initialize self's visual components.

Parameters:
parent - org.eclipse.swt.widgets.Composite
useHeightHint. - If true yse the preferredHeight.

createListViewer

protected void createListViewer(org.eclipse.swt.widgets.Composite parent,
                                boolean useHeightHint)
Create this group's list viewer.


createTreeViewer

protected void createTreeViewer(org.eclipse.swt.widgets.Composite parent,
                                boolean useHeightHint)
Create this group's tree viewer.


determineShouldBeAtLeastGrayChecked

protected boolean determineShouldBeAtLeastGrayChecked(java.lang.Object treeElement)
Returns a boolean indicating whether the passed tree element should be at LEAST gray-checked. Note that this method does not consider whether it should be white-checked, so a specified tree item which should be white-checked will result in a true answer from this method. To determine whether a tree item should be white-checked use method #determineShouldBeWhiteChecked(Object).

Parameters:
element - java.lang.Object
Returns:
boolean
See Also:
determineShouldBeWhiteChecked(java.lang.Object)

determineShouldBeWhiteChecked

protected boolean determineShouldBeWhiteChecked(java.lang.Object treeElement)
Returns a boolean indicating whether the passed tree item should be white-checked.

Parameters:
treeElement - java.lang.Object
Returns:
boolean

determineWhiteCheckedDescendents

protected void determineWhiteCheckedDescendents(java.lang.Object treeElement)
Recursively add appropriate tree elements to the collection of known white-checked tree elements.

Parameters:
treeElement - java.lang.Object

expandAll

public void expandAll()
Cause the tree viewer to expand all its items


getAllCheckedListItems

public void getAllCheckedListItems(ICustomElementFilter filter,
                                   org.eclipse.core.runtime.IProgressMonitor monitor)
                            throws java.lang.InterruptedException
Returns a flat list of all of the leaf elements which are checked. Filter then based on the supplied ElementFilter. If monitor is cancelled then return null

Parameters:
filter - - the filter for the data
monitor - IProgressMonitor or null
Throws:
java.lang.InterruptedException

getAllCheckedListItems

public java.util.List getAllCheckedListItems()
Returns a flat list of all of the leaf elements which are checked.

Returns:
all of the leaf elements which are checked. This API does not return null in order to keep backwards compatibility.

getAllWhiteCheckedItems

public java.util.List getAllWhiteCheckedItems()
Returns a list of all of the items that are white checked. Any folders that are white checked are added and then any files from white checked folders are added.

Returns:
the list of all of the items that are white checked

getCheckedElementCount

public int getCheckedElementCount()
Answer the number of elements that have been checked by the user.

Returns:
int

getFullLabel

protected java.lang.String getFullLabel(java.lang.Object treeElement,
                                        java.lang.String parentLabel)
Get the full label of the treeElement (its name and its parent's name).

Parameters:
treeElement - - the element being exported
parentLabel - - the label of the parent, can be null
Returns:
String

getListItemsSize

protected int getListItemsSize(java.lang.Object treeElement)
Return a count of the number of list items associated with a given tree item.

Parameters:
treeElement - java.lang.Object
Returns:
int

getListTable

public org.eclipse.swt.widgets.Table getListTable()
Get the table the list viewer uses.

Returns:
org.eclipse.swt.widgets.Table

getTree

public org.eclipse.swt.widgets.Tree getTree()
Get the tree the tree viewer uses.

Returns:
org.eclipse.swt.widgets.Table

grayCheckHierarchy

protected void grayCheckHierarchy(java.lang.Object treeElement)
Logically gray-check all ancestors of treeItem by ensuring that they appear in the checked table


initialCheckListItem

public void initialCheckListItem(java.lang.Object element)
Set the initial checked state of the passed list element to true.


initialCheckTreeItem

public void initialCheckTreeItem(java.lang.Object element)
Set the initial checked state of the passed element to true, as well as to all of its children and associated list elements


initialize

protected void initialize()
Initialize this group's viewers after they have been laid out.


listItemChecked

protected void listItemChecked(java.lang.Object listElement,
                               boolean state,
                               boolean updatingFromSelection)
Callback that's invoked when the checked status of an item in the list is changed by the user. Do not try and update the hierarchy if we are building the initial list.


notifyCheckStateChangeListeners

protected void notifyCheckStateChangeListeners(org.eclipse.jface.viewers.CheckStateChangedEvent event)
Notify all checked state listeners that the passed element has had its checked state changed to the passed state


populateListViewer

protected void populateListViewer(java.lang.Object treeElement)
Set the contents of the list viewer based upon the specified selected tree element. This also includes checking the appropriate list items.

Parameters:
treeElement - java.lang.Object

removeCheckStateListener

public void removeCheckStateListener(org.eclipse.jface.viewers.ICheckStateListener listener)
Remove the passed listener from self's collection of clients that listen for changes to element checked states

Parameters:
listener - ICheckStateListener

selectionChanged

public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
Handle the selection of an item in the tree viewer

Specified by:
selectionChanged in interface org.eclipse.jface.viewers.ISelectionChangedListener
Parameters:
selection - ISelection

setAllSelections

public void setAllSelections(boolean selection)
Select or deselect all of the elements in the tree depending on the value of the selection boolean. Be sure to update the displayed files as well.


setListProviders

public void setListProviders(org.eclipse.jface.viewers.IStructuredContentProvider contentProvider,
                             org.eclipse.jface.viewers.ILabelProvider labelProvider)
Set the list viewer's providers to those passed

Parameters:
contentProvider - ITreeContentProvider
labelProvider - ILabelProvider

setListSorter

public void setListSorter(org.eclipse.jface.viewers.ViewerSorter sorter)
Set the sorter that is to be applied to self's list viewer


setRoot

public void setRoot(java.lang.Object newRoot)
Set the root of the widget to be new Root. Regenerate all of the tables and lists from this value.

Parameters:
newRoot -

setTreeChecked

protected void setTreeChecked(java.lang.Object treeElement,
                              boolean state)
Set the checked state of the passed tree element appropriately, and do so recursively to all of its child tree elements as well


setTreeProviders

public void setTreeProviders(org.eclipse.jface.viewers.ITreeContentProvider contentProvider,
                             org.eclipse.jface.viewers.ILabelProvider labelProvider)
Set the tree viewer's providers to those passed

Parameters:
contentProvider - ITreeContentProvider
labelProvider - ILabelProvider

setTreeSorter

public void setTreeSorter(org.eclipse.jface.viewers.ViewerSorter sorter)
Set the sorter that is to be applied to self's tree viewer


setWhiteChecked

protected void setWhiteChecked(java.lang.Object treeElement,
                               boolean isWhiteChecked)
Adjust the collection of references to white-checked tree elements appropriately.

Parameters:
treeElement - java.lang.Object
isWhiteChecked - boolean

treeCollapsed

public void treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent event)
Handle the collapsing of an element in a tree viewer

Specified by:
treeCollapsed in interface org.eclipse.jface.viewers.ITreeViewerListener

treeExpanded

public void treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent event)
Handle the expansionsion of an element in a tree viewer

Specified by:
treeExpanded in interface org.eclipse.jface.viewers.ITreeViewerListener

treeItemChecked

protected void treeItemChecked(java.lang.Object treeElement,
                               boolean state)
Callback that's invoked when the checked status of an item in the tree is changed by the user.


ungrayCheckHierarchy

protected void ungrayCheckHierarchy(java.lang.Object treeElement)
Logically un-gray-check all ancestors of treeItem iff appropriate.


updateHierarchy

protected void updateHierarchy(java.lang.Object treeElement)
Set the checked state of self and all ancestors appropriately


updateSelections

public void updateSelections(java.util.Map items)
Update the selections of the tree elements in items to reflect the new selections provided.

Parameters:
Map - with keys of Object (the tree element) and values of List (the selected list elements). NOTE: This method does not special case keys with no values (i.e., a tree element with an empty list). If a tree element does not have any selected items, do not include the element in the Map.

setFocus

public void setFocus()
Set the focus on to the list widget.


TPTP 4.5.0 Platform Project
Internal API Specification