Package org.eclipse.ui.model
Class WorkbenchLabelProvider
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.viewers.BaseLabelProvider
org.eclipse.jface.viewers.LabelProvider
org.eclipse.ui.model.WorkbenchLabelProvider
- All Implemented Interfaces:
- DelegatingStyledCellLabelProvider.IStyledLabelProvider,- IBaseLabelProvider,- IColorProvider,- IFontProvider,- ILabelProvider
public class WorkbenchLabelProvider
extends LabelProvider
implements IColorProvider, IFontProvider, DelegatingStyledCellLabelProvider.IStyledLabelProvider
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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ImageDescriptordecorateImage(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 StringdecorateText(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.voiddispose()TheBaseLabelProviderimplementation of thisIBaseLabelProvidermethod clears its internal listener list.protected final IWorkbenchAdaptergetAdapter(Object o) Returns the implementation of IWorkbenchAdapter for the given object.protected final IWorkbenchAdapter2Returns the implementation of IWorkbenchAdapter2 for the given object.protected final IWorkbenchAdapter3Returns the implementation of IWorkbenchAdapter3 for the given object.getBackground(Object element) Provides a background color for the given element.static ILabelProviderReturns a workbench label provider that is hooked up to the decorator mechanism.protected StyledString.StylergetDecorationStyle(Object element) Sets theStyledString.Stylerto be used for string decorations.Provides a font for the given element.getForeground(Object element) Provides a foreground color for the given element.final ImageTheLabelProviderimplementation of thisILabelProvidermethod returnsnull.getStyledText(Object element) The default implementation of this returns the styled text label for the given element.final StringTheLabelProviderimplementation of thisILabelProvidermethod returns the element'stoStringstring.Methods inherited from class org.eclipse.jface.viewers.LabelProvidercreateImageProvider, createTextImageProvider, createTextProviderMethods inherited from class org.eclipse.jface.viewers.BaseLabelProvideraddListener, fireLabelProviderChanged, isLabelProperty, removeListenerMethods inherited from class org.eclipse.core.commands.common.EventManageraddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jface.viewers.IBaseLabelProvideraddListener, isLabelProperty, removeListener
- 
Constructor Details- 
WorkbenchLabelProviderpublic WorkbenchLabelProvider()Creates a new workbench label provider.
 
- 
- 
Method Details- 
getDecoratingWorkbenchLabelProviderReturns a workbench label provider that is hooked up to the decorator mechanism.- Returns:
- a new DecoratingLabelProviderwhich wraps a newWorkbenchLabelProvider
 
- 
decorateImageReturns 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.- Parameters:
- input- The base image to decorate.
- element- The element used to look up decorations.
- Returns:
- the resuling ImageDescriptor.
- See Also:
 
- 
decorateTextReturns 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.- Parameters:
- input- The base text to decorate.
- element- The element used to look up decorations.
- Returns:
- the resulting text
 
- 
disposepublic void dispose()Description copied from class:BaseLabelProviderTheBaseLabelProviderimplementation of thisIBaseLabelProvidermethod clears its internal listener list. Subclasses may extend but should call the super implementation.- Specified by:
- disposein interface- IBaseLabelProvider
- Overrides:
- disposein class- BaseLabelProvider
 
- 
getAdapterReturns the implementation of IWorkbenchAdapter for the given object.- Parameters:
- o- the object to look up.
- Returns:
- IWorkbenchAdapter ornullif the adapter is not defined or the object is not adaptable.
 
- 
getAdapter2Returns the implementation of IWorkbenchAdapter2 for the given object.- Parameters:
- o- the object to look up.
- Returns:
- IWorkbenchAdapter2 ornullif the adapter is not defined or the object is not adaptable.
 
- 
getAdapter3Returns the implementation of IWorkbenchAdapter3 for the given object.- Parameters:
- o- the object to look up.
- Returns:
- IWorkbenchAdapter3 ornullif the adapter is not defined or the object is not adaptable.
- Since:
- 3.7
 
- 
getImageDescription copied from class:LabelProviderTheLabelProviderimplementation of thisILabelProvidermethod returnsnull. Subclasses may override.- Specified by:
- getImagein interface- DelegatingStyledCellLabelProvider.IStyledLabelProvider
- Specified by:
- getImagein interface- ILabelProvider
- Overrides:
- getImagein class- LabelProvider
- Parameters:
- element- the element for which to provide the label image
- Returns:
- the image used to label the element, or nullif there is no image for the given object
 
- 
getStyledTextThe default implementation of this returns the styled text label for the given element.- Specified by:
- getStyledTextin interface- DelegatingStyledCellLabelProvider.IStyledLabelProvider
- Parameters:
- element- the element to evaluate the styled string for
- Returns:
- the styled string.
- Since:
- 3.7
 
- 
getDecorationStyleSets theStyledString.Stylerto be used for string decorations. By default thedecoration style. Clients can override.- Parameters:
- element- the element that has been decorated
- Returns:
- return the decoration style
- Since:
- 3.7
 
- 
getTextDescription copied from class:LabelProviderTheLabelProviderimplementation of thisILabelProvidermethod returns the element'stoStringstring. Subclasses may override.- Specified by:
- getTextin interface- ILabelProvider
- Overrides:
- getTextin class- LabelProvider
- Parameters:
- element- the element for which to provide the label text
- Returns:
- the text string used to label the element, or nullif there is no text label for the given object
 
- 
getForegroundDescription copied from interface:IColorProviderProvides a foreground color for the given element.- Specified by:
- getForegroundin interface- IColorProvider
- Parameters:
- element- the element
- Returns:
- the foreground color for the element, or nullto use the default foreground color
 
- 
getBackgroundDescription copied from interface:IColorProviderProvides a background color for the given element.- Specified by:
- getBackgroundin interface- IColorProvider
- Parameters:
- element- the element
- Returns:
- the background color for the element, or nullto use the default background color
 
- 
getFontDescription copied from interface:IFontProviderProvides a font for the given element.- Specified by:
- getFontin interface- IFontProvider
- Parameters:
- element- the element
- Returns:
- the font for the element, or nullto use the default font
 
 
-