Bug 103747 [Viewers] calling refresh on treeviewer in treeExpanded function, but it mess
I tried calling refresh on treeviewer in treeExpanded function. The result is it mess up the tree, there is only one children without a label. Code to reproduce: public void createPartControl(Composite parent) { viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); drillDownAdapter = new DrillDownAdapter(viewer); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); viewer.setSorter(new NameSorter()); viewer.setInput(getViewSite()); viewer.addTreeListener(new ITreeViewerListener() { public void treeCollapsed(TreeExpansionEvent event) { } public void treeExpanded(TreeExpansionEvent event) { viewer.refresh(event.getElement()); }}); }
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
Object d = widget.getData();
					if (d != null) {
						Object parentElement = d;
						Object[] children;
						if (isTreePathContentProvider() && widget instanceof Item) {
							TreePath path = getTreePathFromItem((Item) widget);
							children = getSortedChildren(path);
						} else {
							children = getSortedChildren(parentElement);
						}
						for (int i = 0; i < children.length; i++) {
							createTreeItem(widget, children[i], -1);
						}
					}
				}
	
			});
		} finally {
			busy = oldBusy;
		}
	}
	/**
	 * Creates a single item for the given parent and synchronizes it with the
	 * given element.
	 * 
	 * @param parent
	 *            the parent widget
	 * @param element
	 *            the element
	 * @param index