Bug 340488 - [Viewers] CheckboxTreeViewer doesnt support ILazyTreeContentProvider
Summary: [Viewers] CheckboxTreeViewer doesnt support ILazyTreeContentProvider
Status: CLOSED DUPLICATE of bug 58848
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-19 10:41 EDT by Prashant Deva CLA
Modified: 2017-07-06 02:46 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prashant Deva CLA 2011-03-19 10:41:06 EDT
Build Identifier: M20110210-1200

I have noticed that both in my code and the sample code for ILazyTreeContentProvider in Snippet047VirtualLazyTreeViewer, CheckboxTreeViewer behaves incorrectly when using ILazyTreeContentProvider and SWT.VIRTUAL flag.

Since I am sure the Eclipse team is aware of that I would ask-
1. To document this fact in the CheckboxTreeViewer documentation.
2. Support ILazyTreeContentProvider and SWT.VIRTUAL for CheckboxTreeViewer.



Reproducible: Always

Steps to Reproduce:
1. Open Snippet047VirtualLazyTreeViewer from the SWT samples.
2. Replace new TreeViewer() with new ChecboxTreeViewer().
3. Note that when expanding the tree, only 1 child is shown for each node, instead of 100.
Comment 1 Peter Haraszin CLA 2015-12-06 14:32:07 EST
And what is even worse is that when changing the TreeViewer to CheckboxTreeViewer ([1]) in the sample code [2], it leads to a StackOverflowError. Here's a complete stack trace which shows that updateElement, updateChildCount, etc. methods are called until a StackOverflowError occurs:
http://i.imgur.com/EPBoJeg.png

If you complement the code with setting a custom check state provider for the CheckboxTreeViewer, it solves the problem:

<code>
<pre>
v.setCheckStateProvider(new ICheckStateProvider() {

	/**
	 * TODO: provide complete solution if checkboxes are really needed
	 */
	@Override
	public boolean isGrayed(Object element) {
		return false;
	}

	/**
	 * TODO: provide complete solution if checkboxes are really needed
	 */
	@Override
	public boolean isChecked(Object element) {
		return false;
	}
});
</pre>
</code>

[1]: http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjface%2Fviewers%2FCheckboxTreeViewer.html

[2]: https://github.com/vogella/eclipse.platform.ui/blob/master/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet047VirtualLazyTreeViewer.java#L132
Comment 2 Guido Schnepp CLA 2017-07-06 02:26:04 EDT
Just tried this with Eclipse Oxygen 4.7 on 2017-07-06: This problem still exists today. :-( Luckily the solution works for me, too.
Comment 3 Guido Schnepp CLA 2017-07-06 02:37:29 EDT
Duplicate of bug 58848 from 2004. Still open.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=58848
Comment 4 Andrey Loskutov CLA 2017-07-06 02:46:10 EDT
https://wiki.eclipse.org/Platform_UI/How_to_Contribute

*** This bug has been marked as a duplicate of bug 58848 ***