In this lesson, you rewrite the createViewer
method
to include the CustomContentProvider
.
About this task
To modify the CARMADeveloperView
class:
Procedure
- Open the
CARMADeveloperView
class by double-clicking
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 is 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.