Eclipse Platform
2.0

org.eclipse.ui.model
Class WorkbenchLabelProvider

java.lang.Object
  |
  +--org.eclipse.jface.viewers.LabelProvider
        |
        +--org.eclipse.ui.model.WorkbenchLabelProvider
All Implemented Interfaces:
IBaseLabelProvider, ILabelProvider

public class WorkbenchLabelProvider
extends LabelProvider

Provides basic labels for adaptable objects that have the IWorkbenchAdapter adapter associated with them. All dispensed images are cached until the label provider is explicitly disposed. This class provides a facility for subclasses to define annotations on the labels and icons of adaptable objects.


Constructor Summary
WorkbenchLabelProvider()
          Creates a new workbench label provider.
 
Method Summary
protected  ImageDescriptor decorateImage(ImageDescriptor input, Object element)
          Returns an image descriptor that is based on the given descriptor, but decorated with additional information relating to the state of the provided object.
protected  String decorateText(String input, Object element)
          Returns a label that is based on the given label, but decorated with additional information relating to the state of the provided object.
 void dispose()
          Disposes of all allocated images.
protected  IWorkbenchAdapter getAdapter(Object o)
          Returns the implementation of IWorkbenchAdapter for the given object.
 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.
 
Methods inherited from class org.eclipse.jface.viewers.LabelProvider
addListener, fireLabelProviderChanged, isLabelProperty, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkbenchLabelProvider

public WorkbenchLabelProvider()
Creates a new workbench label provider.

Method Detail

decorateImage

protected ImageDescriptor decorateImage(ImageDescriptor input,
                                        Object element)
Returns an image descriptor that is based on the given descriptor, but decorated with additional information relating to the state of the provided object. Subclasses may reimplement this method to decorate an object's image.

See Also:
org.eclipse.jface.resource.CompositeImage

decorateText

protected String decorateText(String input,
                              Object element)
Returns a label that is based on the given label, but decorated with additional information relating to the state of the provided object. Subclasses may implement this method to decorate an object's label.


dispose

public final void dispose()
Disposes of all allocated images.

Specified by:
dispose in interface IBaseLabelProvider
Overrides:
dispose in class LabelProvider

getAdapter

protected final IWorkbenchAdapter getAdapter(Object o)
Returns the implementation of IWorkbenchAdapter for the given object. Returns null if the adapter is not defined or the object is not adaptable.


getImage

public final Image getImage(Object element)
Description copied from class: LabelProvider
The LabelProvider implementation of this ILabelProvider method returns null. Subclasses may override.

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

getText

public final String getText(Object element)
Description copied from class: LabelProvider
The LabelProvider implementation of this ILabelProvider method returns the element's toString string. Subclasses may override.

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

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.