Bug 159190 [Viewers] multiple dispose listeners for elements in VIRTUAL tree viewer
3.3 Each time an element is mapped in a VIRTUAL tree viewer, a dispose listener is hooked to its item to properly unmap it. However, elements are mapped to the same item more than once (each time it is updated via doUpdateItem(Widget widget, Object element, boolean fullMap)). This results in many dispose listeners for each element to unmap it, which is a potential performance issue. The debugger subclasses the tree viewer and updates (clears) filtered children when an element is unmapped. It ends up doing the operation many times (once for each dispose callback), instead of once.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
/**
 * A concrete viewer based on an SWT <code>Tree</code> control.
 * <p>
 * This class is not intended to be subclassed outside the viewer framework. It
 * is designed to be instantiated with a pre-existing SWT tree control and
 * configured with a domain-specific content provider, label provider, element
 * filter (optional), and element sorter (optional).
 * </p>
 * <p>
 * Content providers for tree viewers must implement either the
 * {@link ITreeContentProvider} interface or (as of 3.2) the
 * {@link ILazyTreeContentProvider} interface. If the content provider is an
 * <code>ILazyTreeContentProvider</code>, the underlying Tree must be created
 * using the {@link SWT#VIRTUAL} style bit, and the tree viewer will not support
 * sorting or filtering.
 * </p>
 */
public class TreeViewer extends AbstractTreeViewer {
	/**
	 * Internal tree viewer implementation.
	 */