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
TableItem ti = item;
			colorAndFontCollector.setFontsAndColors(element);
			
			
			
			for (int column = 0; column < columnCount || column == 0; column++) {
				
				String text = "";
				Image image = null;
				tableColorAndFont.setFontsAndColors(ti,element,column);
				if (tprov == null) {
					if (column == 0) {
						ViewerLabel updateLabel = new ViewerLabel(item
								.getText(), item.getImage());
						buildLabel(updateLabel,element);
						
 
			            
						if (item.isDisposed()) {
			                unmapElement(element);
			                return;
			            }   
						
						text = updateLabel.getText();
						image = updateLabel.getImage();
					}
				} else {
					text = tprov.getColumnText(element, column);
					image = tprov.getColumnImage(element, column);
				}