Bug 159918 [Viewers] TreeViewer.setChildCount(...) should preserve selection
Since changing the child count of an element in a tree can effectively remove children, the #setChildCount(...) method should preserve selection. This way if a selected item is disposed, the selection change will fire with the new <empty selection>.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java
}
		}
		return true;
	}
	/*
	 * (non-Javadoc) Method declared in AbstractTreeViewer.
	 */
	protected void showItem(Item item) {
		getTree().showItem((TreeItem) item);
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.viewers.AbstractTreeViewer#getChild(org.eclipse.swt.widgets.Widget,
	 *      int)
	 */
	protected Item getChild(Widget widget, int index) {
		if (widget instanceof TreeItem) {
			return ((TreeItem) widget).getItem(index);
		}
		if (widget instanceof Tree) {
			return ((Tree) widget).getItem(index);
		}
		return null;
	}
	protected void assertContentProviderType(IContentProvider provider) {
		if (provider instanceof ILazyTreeContentProvider) {
			return;
		}
		super.assertContentProviderType(provider);