Bug 188663 [Viewers] Virtual TreeViewer with columns: First and last row have wrong labels
Seen with 3.3 M7 I have a virtual TreeViewer/ILazyTreeContentProvider with multiple columns. Upon setting new input, the first row stays blank with the exception of the first cell. And the last row shows the labels of the first row, with the exception of the first cell. The attached plugin shows the problem: When opening the view, the second column's label is blank on the first row, and the third row's second column shows the label that should be in the first row. Pressing refresh makes the problem go away. Pressing 'New Input' shows the problem again. I did some debugging and here's what I can come up with: When an empty tree is populated, setting an image into the first column on the first row will create a new image list in Tree#imageIndex(Image, int). The call to OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, hImageList); somehow causes all following SWT.SetData events to be handled before the first one that was about to set the image into the tree item. The attached SWT snippet shows this clearer (logged on the console). Once the first SetData callback gets control again, ColumnViewer's cached cell already points to the last row, which would explain why the first one stays empty and the last one gets the first row's labels.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTableViewer.java
}
			}
		} else {
			if (count != list.size()) {
				
				
				for (int i = 0; i < virtualManager.cachedElements.length; i++) {
					Object element = virtualManager.cachedElements[i];
					if (virtualElements.contains(element)) {
						Item item = doGetItem(i);
						item.getText();
						indices[count++] = i;
						virtualElements.remove(element);
						if (firstItem == null) {
							firstItem = item;
						}
					}
				}
			}
		}
		if (count < size) {
			System.arraycopy(indices, 0, indices = new int[count], 0, count);
		}
		doSetSelection(indices);
		if (reveal && firstItem != null) {
			doShowItem(firstItem);
		}
	}
	/**
	 * Set the item count of the receiver.