Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 334103

Summary: [Tree] Sibling items are not visible after collapsing tree
Product: [RT] RAP Reporter: Michael Klein <michael.klein>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: tbuschto
Version: 1.4   
Target Milestone: 1.4 M5   
Hardware: All   
OS: All   
Whiteboard:

Description Michael Klein CLA 2011-01-12 08:56:56 EST
Environment: Firefox 3.6.13/IE 8.0.7600 on Win7

The bug occurs using RAP 1.4 M4

Steps to reproduce (using the snippet below):
* scroll down (to the end, so Root 1 is no more visible)
* collapse Root 3
* try to find Root 1
-> The unnecessary scollbar disappears but the content is not set to origin 0, 0

Expected:
Scroll up before hide scrollbar.


Here is the snippet to reproduce:

public class Snippet implements IEntryPoint {

	public int createUI() {
		Display display = new Display();
		Shell shell = new Shell(display, SWT.TITLE);
		createContent(shell);
		shell.layout();
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		return 0;
	}

	private void createContent(Shell shell) {
		shell.setLayout(new GridLayout(1, false));

		Tree tree = new Tree(shell, SWT.NONE | SWT.MULTI);
		tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		TreeViewer viewer = new TreeViewer(tree);
		viewer.setLabelProvider(new LabelProvider());

		viewer.setContentProvider(new ITreeContentProvider() {
			public Object[] getElements(Object inputElement) {
				return new Object[] {"Root 1", "Root 2", "Root 3"};
			}
			public Object[] getChildren(Object parentElement) {
				if (hasChildren(parentElement)) {
					String[] input = new String[10];
					for (int i = 0; i < input.length; i++) {
						input[i] = "Item " + i;
					}
					return input;
				}
				return new Object[0];
			}
			public boolean hasChildren(Object element) {
				return element.toString().startsWith("Root");
			}
			public void dispose() {
			}
			public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
			}
			public Object getParent(Object element) {
				return null;
			}
		});
		
		viewer.setInput(new Object[0]);
		viewer.expandAll();
	}

}
Comment 1 Ivan Furnadjiev CLA 2011-01-18 03:51:42 EST
I can reproduce it with Controls Demo -> Tree Tab too.
Comment 2 Tim Buschtoens CLA 2011-01-21 05:49:26 EST
Fixed in CVS HEAD.

This was actually a bug in the scrollbar which did not fire a change event when the value changed due to a setMaximum call.