ArrayContentProvider - A default implementation for IStructuredContentProvider
Posted On Aug 13, 2008 at by Prakash G.R.Today I discovered that JFace provides a nice default implementation for the IStructuredContentProvider - the org.eclipse.jface.viewers.ArrayContentProvider class. Most of the time, the input to a ListViewer will be either an array of objects or List of objects. This content provider handles both cases. In fact it handles Collection - so you can even pass a Set or Queue to the viewer.setInput() method.
This might be the shortest tip I've ever written. Couldn't resist myself from blogging this. Hope its useful :-)
Update [6-Oct-2008]:
ArrayContentProvider is now a singleton! Which means, less memory consumed even if you use this for multiple viewers
Tired of unwanted and irrelevant results in Google? Try Eclipse Search, the Customized Seach Engine that gives you only relevant results - Powered by Google! It has plugins for Eclipse and Firefox/IE