Bug 29609 - [Viewers] add a default implementation of IStructuredContentProvider
Summary: [Viewers] add a default implementation of IStructuredContentProvider
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-16 05:57 EST by Adam Kiezun CLA
Modified: 2003-01-27 12:31 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.