Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.jface.viewers
Class LabelProvider

    java.lang.Object
      org.eclipse.jface.viewers.LabelProvider

All Implemented Interfaces:
  IBaseLabelProvider, ILabelProvider

Direct Known Subclasses:
  ComboBoxLabelProvider, DecoratingLabelProvider, EnvironmentTab.EnvironmentVariableLabelProvider, FileEditorMappingLabelProvider, PerspectiveLabelProvider, PreferenceLabelProvider, WorkbenchLabelProvider, WorkbenchPartLabelProvider

public class LabelProvider
extends Object
implements ILabelProvider

A label provider implementation which, by default, uses an element's `toString` value for its text and `null` for its image.

This class may be used as is, or subclassed to provide richer labels. Subclasses may override any of the following methods:

- `isLabelProperty`
- `getImage`
- `getText`
- `dispose`

Constructor Summary
`LabelProvider()` Creates a new label provider.

Method Summary
`void` | `addListener(ILabelProviderListener listener)` Adds a listener to this label provider.
`void` | `dispose()` The `LabelProvider` implementation of this `IBaseLabelProvider` method does nothing.
`protected void` | `fireLabelProviderChanged(LabelProviderChangedEvent event)` Fires a label provider changed event to all registered listeners Only listeners registered at the time this method is called are notified.
`Image` | `getImage(Object element)` The `LabelProvider` implementation of this `ILabelProvider` method returns `null`.
`String` | `getText(Object element)` The `LabelProvider` implementation of this `ILabelProvider` method returns the element's `toString` string.
`boolean` | `isLabelProperty(Object element, String property)` The `LabelProvider` implementation of this `IBaseLabelProvider` method returns `true`.
`void` | `removeListener(ILabelProviderListener listener)` Removes a listener to this label provider.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LabelProvider

    public LabelProvider()

  Creates a new label provider.

Method Detail

### addListener

    public void addListener(ILabelProviderListener listener)

  Description copied from interface: `IBaseLabelProvider`
  Adds a listener to this label provider. Has no effect if an identical listener is already registered.

  Label provider listeners are informed about state changes that affect the rendering of the viewer that uses this label provider.

  Specified by:
    `addListener` in interface `IBaseLabelProvider`
  Parameters:
    `listener` - a label provider listener

### dispose

    public void dispose()

  The `LabelProvider` implementation of this `IBaseLabelProvider` method does nothing. Subclasses may extend.

  Specified by:
    `dispose` in interface `IBaseLabelProvider`

### fireLabelProviderChanged

    protected void fireLabelProviderChanged(LabelProviderChangedEvent event)

  Fires a label provider changed event to all registered listeners Only listeners registered at the time this method is called are notified.

  Parameters:
    `event` - a label provider changed event
  See Also:
    `ILabelProviderListener.labelProviderChanged(org.eclipse.jface.viewers.LabelProviderChangedEvent)`

### getImage

    public Image getImage(Object element)

  The `LabelProvider` implementation of this `ILabelProvider` method returns `null`. Subclasses may override.

  Specified by:
    `getImage` in interface `ILabelProvider`
  Parameters:
    `element` - the element for which to provide the label image
  Returns:
    the image used to label the element, or `null` if there is no image for the given object

### getText

    public String getText(Object element)

  The `LabelProvider` implementation of this `ILabelProvider` method returns the element's `toString` string. Subclasses may override.

  Specified by:
    `getText` in interface `ILabelProvider`
  Parameters:
    `element` - the element for which to provide the label text
  Returns:
    the text string used to label the element, or `null` if there is no text label for the given object

### isLabelProperty

    public boolean isLabelProperty(Object element,
                                   String property)

  The `LabelProvider` implementation of this `IBaseLabelProvider` method returns `true`. Subclasses may override.

  Specified by:
    `isLabelProperty` in interface `IBaseLabelProvider`
  Parameters:
    `element` - the element
    `property` - the property
  Returns:
    `true` if the label would be affected, and `false` if it would be unaffected

### removeListener

    public void removeListener(ILabelProviderListener listener)

  Description copied from interface: `IBaseLabelProvider`
  Removes a listener to this label provider. Has no affect if an identical listener is not registered.

  Specified by:
    `removeListener` in interface `IBaseLabelProvider`
  Parameters:
    `listener` - a label provider listener

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.