Public Member Functions | Protected Member Functions | Package Functions | Package Attributes | Private Member Functions | Private Attributes | Static Private Attributes

de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup Class Reference

This class is a copy of the ECLIPSE INTERNAL ResourceTreeAndListGroup class. More...

List of all members.

Public Member Functions

void aboutToOpen ()
void addCheckStateListener (ICheckStateListener listener)
void checkStateChanged (final CheckStateChangedEvent event)
void expandAll ()
void getAllCheckedListItems (IElementFilter filter, IProgressMonitor monitor) throws InterruptedException
List< Object > getAllCheckedListItems ()
List< Object > getAllWhiteCheckedItems ()
int getCheckedElementCount ()
Table getListTable ()
void initialCheckListItem (Object element)
void initialCheckTreeItem (Object element)
void removeCheckStateListener (ICheckStateListener listener)
 ResourceTreeAndListGroup (Composite parent, Object rootObject, ITreeContentProvider treeContentProvider, ILabelProvider treeLabelProvider, IStructuredContentProvider listContentProvider, ILabelProvider listLabelProvider, int style, boolean useHeightHint)
void selectionChanged (SelectionChangedEvent event)
void setAllSelections (final boolean selection)
void setFocus ()
void setListComparator (ViewerComparator comparator)
void setListProviders (IStructuredContentProvider contentProvider, ILabelProvider labelProvider)
void setRoot (Object newRoot)
void setTreeComparator (ViewerComparator comparator)
void setTreeProviders (ITreeContentProvider contentProvider, ILabelProvider labelProvider)
void treeCollapsed (TreeExpansionEvent event)
void treeExpanded (TreeExpansionEvent event)
void updateSelections (Map<?,?> items)

Protected Member Functions

boolean areAllChildrenWhiteChecked (Object treeElement)
boolean areAllElementsChecked (Object treeElement)
void checkNewTreeElements (Object[] elements)
void createContents (Composite parent, int style, boolean useHeightHint)
void createListViewer (Composite parent, boolean useHeightHint)
void createTreeViewer (Composite parent, boolean useHeightHint)
boolean determineShouldBeAtLeastGrayChecked (Object treeElement)
boolean determineShouldBeWhiteChecked (Object treeElement)
void determineWhiteCheckedDescendents (Object treeElement)
String getFullLabel (Object treeElement, String parentLabel)
int getListItemsSize (Object treeElement)
void grayCheckHierarchy (Object treeElement)
void initialize ()
void listItemChecked (Object listElement, boolean state, boolean updatingFromSelection)
void notifyCheckStateChangeListeners (final CheckStateChangedEvent event)
void populateListViewer (final Object treeElement)
void setTreeChecked (Object treeElement, boolean state)
void setWhiteChecked (Object treeElement, boolean isWhiteChecked)
void treeItemChecked (Object treeElement, boolean state)
void ungrayCheckHierarchy (Object treeElement)
void updateHierarchy (Object treeElement)

Package Functions

void setListForWhiteSelection (Object treeElement)

Package Attributes

Map< Object, List<?> > checkedStateStore = new HashMap<Object, List<?>>( 9 )
Collection< Object > expandedTreeNodes = new HashSet<Object>()
CheckboxTableViewer listViewer
Object root
ITreeContentProvider treeContentProvider
CheckboxTreeViewer treeViewer
Collection< Object > whiteCheckedTreeItems = new HashSet<Object>()

Private Member Functions

void expandTreeElement (final Object item)
void findAllSelectedListElements (Object treeElement, String parentLabel, boolean addAll, IElementFilter filter, IProgressMonitor monitor) throws InterruptedException
void findAllWhiteCheckedItems (Object treeElement, Collection< Object > result)
void grayUpdateHierarchy (Object treeElement)
void primeHierarchyForSelection (Object item, Set< Object > selectedNodes)
void selectAndReveal (Object treeElement)

Private Attributes

Object currentTreeSelection
IStructuredContentProvider listContentProvider
ILabelProvider listLabelProvider
ILabelProvider treeLabelProvider

Static Private Attributes

static int PREFERRED_HEIGHT = 150

Detailed Description

This class is a copy of the ECLIPSE INTERNAL ResourceTreeAndListGroup class.

Workbench-level composite that combines a CheckboxTreeViewer and CheckboxListViewer. All viewer selection-driven interactions are handled within this object

Author:
skaegebein
Version:
0.8.0
Since:
0.8.0

Constructor & Destructor Documentation

de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.ResourceTreeAndListGroup ( Composite  parent,
Object  rootObject,
ITreeContentProvider  treeContentProvider,
ILabelProvider  treeLabelProvider,
IStructuredContentProvider  listContentProvider,
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 
rootObject 
treeContentProvider 
treeLabelProvider 
listContentProvider 
listLabelProvider 
style 
useHeightHint If true then use the height hint to make this group big enough

Member Function Documentation

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.aboutToOpen (  ) 

This method must be called just before this window becomes visible.

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.addCheckStateListener ( ICheckStateListener  listener  ) 

Add the passed listener to self's collection of clients that listen for changes to element checked states

Parameters:
listener ICheckStateListener
boolean de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.areAllChildrenWhiteChecked ( Object  treeElement  )  [protected]

Return a boolean indicating whether all children of the passed tree element are currently white-checked

Returns:
boolean
Parameters:
treeElement java.lang.Object
boolean de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.areAllElementsChecked ( Object  treeElement  )  [protected]

Return a boolean indicating whether all list elements associated with the passed tree element are currently checked

Returns:
boolean
Parameters:
treeElement java.lang.Object
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.checkNewTreeElements ( Object[]  elements  )  [protected]

Iterate through the passed elements which are being realized for the first time and check each one in the tree viewer as appropriate

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.checkStateChanged ( final CheckStateChangedEvent  event  ) 

An item was checked in one of self's two views. Determine which view this occurred in and delegate appropriately

Parameters:
event CheckStateChangedEvent
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.createContents ( Composite  parent,
int  style,
boolean  useHeightHint 
) [protected]

Lay out and initialize self's visual components.

Parameters:
parent org.eclipse.swt.widgets.Composite
style the style flags for the new Composite
useHeightHint If true yse the preferredHeight.
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.createListViewer ( Composite  parent,
boolean  useHeightHint 
) [protected]

Create this group's list viewer.

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.createTreeViewer ( Composite  parent,
boolean  useHeightHint 
) [protected]

Create this group's tree viewer.

boolean de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.determineShouldBeAtLeastGrayChecked ( Object  treeElement  )  [protected]

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:
treeElement java.lang.Object
Returns:
boolean
See also:
determineShouldBeWhiteChecked(Object)
boolean de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.determineShouldBeWhiteChecked ( Object  treeElement  )  [protected]

Returns a boolean indicating whether the passed tree item should be white-checked.

Returns:
boolean
Parameters:
treeElement java.lang.Object
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.determineWhiteCheckedDescendents ( Object  treeElement  )  [protected]

Recursively add appropriate tree elements to the collection of known white-checked tree elements.

Parameters:
treeElement java.lang.Object
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.expandAll (  ) 

Cause the tree viewer to expand all its items

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.expandTreeElement ( final Object  item  )  [private]

Expand an element in a tree viewer

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.findAllSelectedListElements ( Object  treeElement,
String  parentLabel,
boolean  addAll,
IElementFilter  filter,
IProgressMonitor  monitor 
) throws InterruptedException [private]

Add all of the selected children of nextEntry to result recursively. This does not set any values in the checked state.

Parameters:
The treeElement being queried
addAll a boolean to indicate if the checked state store needs to be queried
filter IElementFilter - the filter being used on the data
monitor IProgressMonitor or null that the cancel is polled for
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.findAllWhiteCheckedItems ( Object  treeElement,
Collection< Object >  result 
) [private]

Find all of the white checked children of the treeElement and add them to the collection. If the element itself is white select add it. If not then add any selected list elements and recurse down to the children.

Parameters:
treeElement java.lang.Object
result java.util.Collection
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.getAllCheckedListItems ( IElementFilter  filter,
IProgressMonitor  monitor 
) throws 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
Exceptions:
InterruptedException If the find is interrupted.
List<Object> de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.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.
List<Object> de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.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
int de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.getCheckedElementCount (  ) 

Answer the number of elements that have been checked by the user.

Returns:
int
String de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.getFullLabel ( Object  treeElement,
String  parentLabel 
) [protected]

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
int de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.getListItemsSize ( Object  treeElement  )  [protected]

Return a count of the number of list items associated with a given tree item.

Returns:
int
Parameters:
treeElement java.lang.Object
Table de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.getListTable (  ) 

Get the table the list viewer uses.

Returns:
org.eclipse.swt.widgets.Table
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.grayCheckHierarchy ( Object  treeElement  )  [protected]

Logically gray-check all ancestors of treeItem by ensuring that they appear in the checked table

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.grayUpdateHierarchy ( Object  treeElement  )  [private]

Set the checked state of self and all ancestors appropriately. Do not white check anyone - this is only done down a hierarchy.

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.initialCheckListItem ( Object  element  ) 

Set the initial checked state of the passed list element to true.

Parameters:
element 
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.initialCheckTreeItem ( 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

Parameters:
element 
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.initialize (  )  [protected]

Initialize this group's viewers after they have been laid out.

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.listItemChecked ( Object  listElement,
boolean  state,
boolean  updatingFromSelection 
) [protected]

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.

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.notifyCheckStateChangeListeners ( final CheckStateChangedEvent  event  )  [protected]

Notify all checked state listeners that the passed element has had its checked state changed to the passed state

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.populateListViewer ( final Object  treeElement  )  [protected]

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
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.primeHierarchyForSelection ( Object  item,
Set< Object >  selectedNodes 
) [private]

Logically gray-check all ancestors of treeItem by ensuring that they appear in the checked table. Add any elements to the selectedNodes so we can track that has been done.

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.removeCheckStateListener ( ICheckStateListener  listener  ) 

Remove the passed listener from self's collection of clients that listen for changes to element checked states

Parameters:
listener ICheckStateListener
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.selectAndReveal ( Object  treeElement  )  [private]
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.selectionChanged ( SelectionChangedEvent  event  ) 

Handle the selection of an item in the tree viewer

Parameters:
event SelectionChangedEvent
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.setAllSelections ( final 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.

Parameters:
selection 
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.setFocus (  ) 

Set the focus on to the list widget.

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.setListComparator ( ViewerComparator  comparator  ) 

Set the comparator that is to be applied to self's list viewer

Parameters:
comparator the sorter for the list
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.setListForWhiteSelection ( Object  treeElement  )  [package]

The treeElement has been white selected. Get the list for the element and set it in the checked state store.

Parameters:
treeElement the element being updated
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.setListProviders ( IStructuredContentProvider  contentProvider,
ILabelProvider  labelProvider 
)

Set the list viewer's providers to those passed

Parameters:
contentProvider ITreeContentProvider
labelProvider ILabelProvider
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.setRoot ( Object  newRoot  ) 

Set the root of the widget to be new Root. Regenerate all of the tables and lists from this value.

Parameters:
newRoot 
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.setTreeChecked ( Object  treeElement,
boolean  state 
) [protected]

Set the checked state of the passed tree element appropriately, and do so recursively to all of its child tree elements as well

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.setTreeComparator ( ViewerComparator  comparator  ) 

Set the comparator that is to be applied to self's tree viewer

Parameters:
comparator the comparator for the tree
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.setTreeProviders ( ITreeContentProvider  contentProvider,
ILabelProvider  labelProvider 
)

Set the tree viewer's providers to those passed

Parameters:
contentProvider ITreeContentProvider
labelProvider ILabelProvider
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.setWhiteChecked ( Object  treeElement,
boolean  isWhiteChecked 
) [protected]

Adjust the collection of references to white-checked tree elements appropriately.

Parameters:
treeElement java.lang.Object
isWhiteChecked boolean
void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.treeCollapsed ( TreeExpansionEvent  event  ) 

Handle the collapsing of an element in a tree viewer

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.treeExpanded ( TreeExpansionEvent  event  ) 

Handle the expansionsion of an element in a tree viewer

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.treeItemChecked ( Object  treeElement,
boolean  state 
) [protected]

Callback that's invoked when the checked status of an item in the tree is changed by the user.

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.ungrayCheckHierarchy ( Object  treeElement  )  [protected]

Logically un-gray-check all ancestors of treeItem iff appropriate.

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.updateHierarchy ( Object  treeElement  )  [protected]

Set the checked state of self and all ancestors appropriately

void de.fraunhofer.isst.axbench.autosarinterface.wizards.synchronization.eclipse.ResourceTreeAndListGroup.updateSelections ( Map<?,?>  items  ) 

Update the selections of the tree elements in items to reflect the new selections provided.

Parameters:
items 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.

Member Data Documentation