A label provider maps an element of the viewer's model to an optional image and optional text string used to display the element in the viewer's control. Certain label providers may allow multiple labels per element. This is an "abstract interface", defining methods common to all label providers, but does not actually define the methods to get the label(s) for an element. This interface should never be directly implemented. Most viewers will take either an
ILabelProvider
or an
ITableLabelProvider
.
A label provider must not be shared between viewers since a label provider generally manages SWT resources (images), which must be disposed when the viewer is disposed. To simplify life cycle management, the current label provider of a viewer is disposed when the viewer is disposed.
Label providers can be used outside the context of viewers wherever images are needed. When label providers are used in this fashion it is the responsibility of the user to ensure dispose
is called when the provider is no longer needed.
@see ILabelProvider
@see ITableLabelProvider