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
return new TableItem[0];
		
		TableItem[] visible = new TableItem[virtualManager.currentVisibleIndex];
		for (int i = 0; i < visible.length; i++) {
			visible[i] = table.getItem(i);
		}
		return visible;
	}
	/*
	 *  (non-Javadoc)
	 * @see org.eclipse.jface.viewers.StructuredViewer#doUpdateItem(org.eclipse.swt.widgets.Widget, java.lang.Object, boolean)
	 */
	protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
		if (widget instanceof TableItem) {
			final TableItem item = (TableItem) widget;
			
			if (fullMap) {
				associate(element, item);
			} else {
				item.setData(element);
				mapElement(element, item);
			}
			IBaseLabelProvider prov = getLabelProvider();
			ITableLabelProvider tprov = null;			
			if (prov instanceof ITableLabelProvider) {
				tprov = (ITableLabelProvider) prov;
			} 
			
			
			int columnCount = table.getColumnCount();