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/TableTreeViewer.java
/**
     * The table tree viewer implementation of this <code>Viewer</code> framework
     * method ensures that the given label provider is an instance
     * of either <code>ITableLabelProvider</code> or <code>ILabelProvider</code>.
     * If it is an <code>ITableLabelProvider</code>, then it provides a
     * separate label text and image for each column. If it is an 
     * <code>ILabelProvider</code>, then it provides only the label text 
     * and image for the first column, and any remaining columns are blank.
     */
    public void setLabelProvider(IBaseLabelProvider labelProvider) {
        Assert.isTrue(labelProvider instanceof ITableLabelProvider
                || labelProvider instanceof ILabelProvider);
        super.setLabelProvider(labelProvider);
    }
    /* (non-Javadoc)
     * Method declared in AbstractTreeViewer.
     */
    protected void setSelection(List items) {
        TableTreeItem[] newItems = new TableTreeItem[items.size()];
        items.toArray(newItems);
        getTableTree().setSelection(newItems);
    }
    /* (non-Javadoc)
     * Method declared in AbstractTreeViewer.
     */
    protected void showItem(Item item) {
        getTableTree().showItem((TableTreeItem) item);
    }
}