Bug 79957 [Viewers] NPE changing input usingTableViewer and virtual
I'm using the latest code for Table viewer with a private virtual manager class in table viewer. i've straight forward code ... <code> Table table=new Table(shell,SWT.VIRTUAL); TableViewer tv=new TableViewer(table); tv.setContentProvider(new NetworkContentProvider()); tv.setLabelProvider(new NetworkLabelProvider()); tv.setInput(model); . . . in a selection event handler for a button, i've to reset the model input . . tv.setInput(model1); . . Same code works fine without the SWT.VIRTUAL style bit,but when VIRTUAL is set it throws a null pointer exception... the stack trace was java.lang.NullPointerException at org.eclipse.jface.viewers.TableViewer$1.handleEvent(TableViewer.java:103) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805) at org.eclipse.swt.widgets.Table.wmNotifyChild(Table.java:3158) at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:4040) at org.eclipse.swt.widgets.Composite.WM_NOTIFY(Composite.java:722) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3025) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1400) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3349) at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1403) at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:137) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3056) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3349) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1479) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2440) at jface.viewers.TestJfaceVirtual.main(TestJfaceVirtual.java:49)
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java
* A concrete viewer based on a SWT <code>Table</code> control.
 * <p>
 * This class is not intended to be subclassed outside the viewer framework. It
 * is designed to be instantiated with a pre-existing SWT table control and
 * configured with a domain-specific content provider, table label provider,
 * element filter (optional), and element sorter (optional).
 * </p>
 * <p>
 * Label providers for table viewers must implement either the
 * <code>ITableLabelProvider</code> or the <code>ILabelProvider</code>
 * interface (see <code>TableViewer.setLabelProvider</code> for more details).
 * </p>
 * <p>
 * As of 3.1 the TableViewer now supports the SWT.VIRTUAL
 * flag. It is important to note that if SWT.VIRTUAL is in use
 * that the Widget based APIs will return null in both the
 * cases where either the element is not specified or not
 * created yet. 
 * </p>
 * <p>
 * Users of SWT.VIRTUAL should also avoid using getItems()
 * from the Table within the TreeViewer as this does not
 * necessarily generate a callback for the TreeViewer 
 * to populate the items. It also has the side effect of
 * creating all of the items thereby eliminating the
 * performance improvements of SWT.VIRTUAL.
 * </p>
 * @see SWT#VIRTUAL
 * @see #doFindItem(Object)
 * @see #internalRefresh(Object, boolean)