In this lesson, you will rewrite the createViewer method
to include the CustomContentProvider.
To modify the CARMADeveloperView class:
- Open the CARMADeveloperView class by double-clicking
on it in its package. The source should open in the editor.
- Scroll down to the createViewer method
and change it so that it uses the CustomContextProvider.
It's helpful to note that the CARMATreeViewer constructor
allows for a context provider to be specified to the viewer.
The
following is example sample code:
protected StructuredViewer createViewer(Composite parent)
{
/* Create the structure that you want to be present in the view here.
* For this tutorial, you will use the CARMA tree model, like the repositories view.
*/
CARMATreeViewer viewer = new CARMATreeViewer(parent, new CustomContextProvider());
viewer.setLabelProvider(new CustomLabelProvider());
return viewer;
}
- Save the source and debug any errors.