Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325330 - [Tree] NPE with NO_SCROLL style bit
Summary: [Tree] NPE with NO_SCROLL style bit
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.4   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 1.4 M2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 320597
  Show dependency tree
 
Reported: 2010-09-15 06:33 EDT by Benjamin Muskalla CLA
Modified: 2010-09-15 07:00 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Muskalla CLA 2010-09-15 06:33:39 EDT
Using a Tree with the SWT.NO_SCROLL style bit leads to an NPE on resize and when adding new treeitems as the scrollbar is null.

Snippet:
		Display display = new Display();
		Shell shell = new Shell(display);

		Tree tree = new Tree(shell, SWT.NO_SCROLL);
		TreeItem treeItem= new TreeItem(tree, SWT.NONE);
		treeItem.setText(0, "foo");
		
		shell.pack();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
		
		
Stacktrace:
java.lang.NullPointerException
	at org.eclipse.swt.widgets.Tree.updateScrollBars(Tree.java:2217)
	at org.eclipse.swt.widgets.TreeItem.<init>(TreeItem.java:289)
	at org.eclipse.swt.widgets.TreeItem.<init>(TreeItem.java:131)
	at bug.App.start(App.java:20)
	at org.eclipse.rap.ui.internal.application.EntrypointApplicationWrapper.createUI(EntrypointApplicationWrapper.java:27)
	at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:245)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:114)
	at java.lang.Thread.run(Thread.java:619)
	at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)
Comment 1 Ivan Furnadjiev CLA 2010-09-15 07:00:14 EDT
Added a check for SWT.NO_SCROLL in Tree#updateScrollBars().