Just a quick tip about JFace viewers.
Wondering where this bug comes from ??? After 10mn about reading again and again my code to figure out why my SWT tree was showing recursively (infinitely) my root object, I finally suspected JFace (without convictions) and reached this bug, source of my problem.
According to the Javadoc of the IStructuredContentProvider. public Object getElements(Object inputElement) method you can’t return a single item object array containing only inputElement.
“NOTE: For instances where the viewer is displaying a tree containing a single ‘root’ element it is still necessary that the ‘input’ does not return itself from this method. This leads to recursion issues (see bug 9262).”
To solve this issue I just created a new class for my root object and instead of returning an object containing the inputElement I return an array containing a new instance of this root element (having of course a reference on the inputElement).