public class DecoratingLabelProvider extends LabelProvider implements IViewerLabelProvider, IColorProvider, IFontProvider, ITreePathLabelProvider
Constructor and Description |
---|
DecoratingLabelProvider(ILabelProvider provider,
ILabelDecorator decorator)
Creates a decorating label provider which uses the given label decorator
to decorate labels provided by the given label provider.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ILabelProviderListener listener)
The
DecoratingLabelProvider implementation of this IBaseLabelProvider method
adds the listener to both the nested label provider and the label decorator. |
void |
dispose()
The
DecoratingLabelProvider implementation of this IBaseLabelProvider method
disposes both the nested label provider and the label decorator. |
Color |
getBackground(Object element)
Provides a background color for the given element.
|
IDecorationContext |
getDecorationContext()
Return the decoration context associated with this label provider.
|
Font |
getFont(Object element)
Provides a font for the given element.
|
Color |
getForeground(Object element)
Provides a foreground color for the given element.
|
Image |
getImage(Object element)
The
DecoratingLabelProvider implementation of this
ILabelProvider method returns the image provided
by the nested label provider's getImage method,
decorated with the decoration provided by the label decorator's
decorateImage method. |
ILabelDecorator |
getLabelDecorator()
Returns the label decorator, or
null if none has been set. |
ILabelProvider |
getLabelProvider()
Returns the nested label provider.
|
String |
getText(Object element)
The
DecoratingLabelProvider implementation of this
ILabelProvider method returns the text label provided
by the nested label provider's getText method,
decorated with the decoration provided by the label decorator's
decorateText method. |
boolean |
isLabelProperty(Object element,
String property)
The
DecoratingLabelProvider implementation of this
IBaseLabelProvider method returns true if the corresponding method
on the nested label provider returns true or if the corresponding method on the
decorator returns true . |
void |
removeListener(ILabelProviderListener listener)
The
DecoratingLabelProvider implementation of this IBaseLabelProvider method
removes the listener from both the nested label provider and the label decorator. |
void |
setDecorationContext(IDecorationContext decorationContext)
Set the decoration context that will be based to the decorator
for this label provider if that decorator implements
LabelDecorator . |
void |
setLabelDecorator(ILabelDecorator decorator)
Sets the label decorator.
|
protected void |
updateForDecorationReady(ViewerLabel settings,
Object element)
Decoration is ready.
|
void |
updateLabel(ViewerLabel settings,
Object element)
Updates the label for the given element.
|
void |
updateLabel(ViewerLabel settings,
TreePath elementPath)
Updates the label for the given element.
|
fireLabelProviderChanged
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
public DecoratingLabelProvider(ILabelProvider provider, ILabelDecorator decorator)
provider
- the nested label providerdecorator
- the label decorator, or null
if no decorator is to be used initiallypublic void addListener(ILabelProviderListener listener)
DecoratingLabelProvider
implementation of this IBaseLabelProvider
method
adds the listener to both the nested label provider and the label decorator.addListener
in interface IBaseLabelProvider
addListener
in class BaseLabelProvider
listener
- a label provider listenerpublic void dispose()
DecoratingLabelProvider
implementation of this IBaseLabelProvider
method
disposes both the nested label provider and the label decorator.dispose
in interface IBaseLabelProvider
dispose
in class BaseLabelProvider
public Image getImage(Object element)
DecoratingLabelProvider
implementation of this
ILabelProvider
method returns the image provided
by the nested label provider's getImage
method,
decorated with the decoration provided by the label decorator's
decorateImage
method.getImage
in interface ILabelProvider
getImage
in class LabelProvider
element
- the element for which to provide the label imagenull
if there is no image for the given objectpublic ILabelDecorator getLabelDecorator()
null
if none has been set.null
if none has been set.public ILabelProvider getLabelProvider()
public String getText(Object element)
DecoratingLabelProvider
implementation of this
ILabelProvider
method returns the text label provided
by the nested label provider's getText
method,
decorated with the decoration provided by the label decorator's
decorateText
method.getText
in interface ILabelProvider
getText
in class LabelProvider
element
- the element for which to provide the label textnull
if there is no text label for the given objectpublic boolean isLabelProperty(Object element, String property)
DecoratingLabelProvider
implementation of this
IBaseLabelProvider
method returns true
if the corresponding method
on the nested label provider returns true
or if the corresponding method on the
decorator returns true
.isLabelProperty
in interface IBaseLabelProvider
isLabelProperty
in class BaseLabelProvider
element
- the elementproperty
- the propertytrue
if the label would be affected,
and false
if it would be unaffectedpublic void removeListener(ILabelProviderListener listener)
DecoratingLabelProvider
implementation of this IBaseLabelProvider
method
removes the listener from both the nested label provider and the label decorator.removeListener
in interface IBaseLabelProvider
removeListener
in class BaseLabelProvider
listener
- a label provider listenerpublic void setLabelDecorator(ILabelDecorator decorator)
decorator
- the label decorator, or null
if no decorations are to be appliedpublic void updateLabel(ViewerLabel settings, Object element)
IViewerLabelProvider
updateLabel
in interface IViewerLabelProvider
settings
- the label to updateelement
- the elementprotected void updateForDecorationReady(ViewerLabel settings, Object element)
settings
- The object collecting the settings.element
- The Object being decorated.public Color getBackground(Object element)
IColorProvider
getBackground
in interface IColorProvider
element
- the elementnull
to use the default background colorpublic Font getFont(Object element)
IFontProvider
getFont
in interface IFontProvider
element
- the elementnull
to use the default fontpublic Color getForeground(Object element)
IColorProvider
getForeground
in interface IColorProvider
element
- the elementnull
to use the default foreground colorpublic IDecorationContext getDecorationContext()
LabelDecorator
.public void setDecorationContext(IDecorationContext decorationContext)
LabelDecorator
.decorationContext
- the decoration context.public void updateLabel(ViewerLabel settings, TreePath elementPath)
ITreePathLabelProvider
updateLabel
in interface ITreePathLabelProvider
settings
- the label to updateelementPath
- the path of the element being decorated
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.