Bug 84314 [Viewers] Need to allow mapping elements to multiple widgets/items
One of the projects I am working on is using an essentially graph structured dependancy model and we use TableTreeViewer for browsing (drilling down) through this graph. The nature of the model is such that the same model element can occur in multiple positions (paths) of the three. Current implementation of the TreeViewer and TableTreeViewer do not support such one-to-many mapping of model elements to widgets, leading to loads of unnecessary overhead to enshure that correct items will get updated. Suggestion: Element -> Item mapper should allow returning of more than one item per model element that is associated with this element.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
/**
     * Recursively collects all expanded elements from the given widget.
     * 
     * @param result
     *           a list (element type: <code>Object</code>) into which to
     *           collect the elements
     * @param widget
     *           the widget
     */
    private void internalCollectExpanded(List result, Widget widget) {
        Item[] items = getChildren(widget);
        for (int i = 0; i < items.length; i++) {
            Item item = items[i];
            if (getExpanded(item)) {
                Object data = item.getData();
                if (data != null)
                    result.add(data);
            }
            internalCollectExpanded(result, item);
        }
    }
    /**
     * Tries to create a path of tree items for the given element. This method
     * recursively walks up towards the root of the tree and assumes that
     * <code>getParent</code> returns the correct parent of an element.
     * 
     * @param element
     *           the element
     * @param expand
     *           <code>true</code> if all nodes on the path should be