Bug 29609

Summary: [Viewers] add a default implementation of IStructuredContentProvider
Product: [Eclipse Project] Platform Reporter: Adam Kiezun <akiezun>
Component: UIAssignee: Nick Edgar <n.a.edgar>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Adam Kiezun CLA 2003-01-16 05:57:07 EST
a clone of such a class can be found in so many places in eclipse that
it seems resonable for jface to provide it as a default implementation
(called maybe ObjectArrayContentProvider or something)

everybody seems to be copying it so we might just write it once and let people 
use it

class MyContentProvider implements IStructuredContentProvider {
 public Object[] getElements(Object inputElement) {
   return (Object[])inputElement;
 }
 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
 }
 public void dispose() {
 }
}
Comment 1 Nick Edgar CLA 2003-01-16 10:44:12 EST
The name and spec for such a class would have to clearly indicate that it was 
purely for showing static arrays.  I'd also consider marking it final so that 
people don't treat it as a default implementation for general content providers.
In general, all implementors need to implement inputChanged appropriately, and 
should consider implementing dispose.
Comment 2 Nick Edgar CLA 2003-01-27 12:31:21 EST
Added ArrayContentProvider to org.eclipse.jface.viewers.
It handles both arrays and collections.