Bug 79180 [Viewers] TableViewer virtual manager may not handle programmatic scrolling
VirtualManager has a field currentVisibleIndex which holds the index of the last added item. This in itself is a major design bug since nobody guarantees in any way that items are created sequencially. A test case could easily be constructed in which after causing the creation of the the x first items the table is programatically scrolled to the middle or end jumping over any number of items. getCreatedItems() creates an array of size virtualManager.currentVisibleIndex. This array is ALWAYS smaller by 1 than the actual number of "visible" items. When creating item0 a 0 size array is returned, but 1 item is visible. When creating item1 a 1 size array is returned, but 2 items are visible ... Bug could easily be solved by creating an array of size currentVisibleIndex + 1. Also, shouldn't array copy be used here instead of the loop ? And ... why COPY the array ? ... will it be modified ? ... maybe 2 versions of the method should exist. Marcel
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java
}
	/**
	 * Adds the given element to this table viewer. If this viewer does not have
	 * a sorter, the element is added at the end; otherwise the element is
	 * inserted at the appropriate position.
	 * <p>
	 * This method should be called (by the content provider) when a single
	 * element has been added to the model, in order to cause the viewer to
	 * accurately reflect the model. This method only affects the viewer, not
	 * the model. Note that there is another method for efficiently processing
	 * the simultaneous addition of multiple elements.
	 * </p>
	 * 
	 * @param element
	 *            the element to add
	 */
	public void add(Object element) {
		add(new Object[] { element });
	}
	/**
	 * Cancels a currently active cell editor. All changes already done in the
	 * cell editor are lost.
	 */
	public void cancelEditing() {
		tableViewerImpl.cancelEditing();
	}
	/*
	 *  (non-Javadoc)
	 * @see org.eclipse.jface.viewers.StructuredViewer#doFindInputItem(java.lang.Object)
	 */