public class DecoratingStyledCellLabelProvider extends DelegatingStyledCellLabelProvider
DecoratingStyledCellLabelProvider is a
DelegatingStyledCellLabelProvider that uses a nested
DelegatingStyledCellLabelProvider.IStyledLabelProvider to compute
styled text label and image and takes a ILabelDecorator to decorate
the label.
Use this label provider as a replacement for the
DecoratingLabelProvider when decorating styled text labels.
The DecoratingStyledCellLabelProvider will try to evaluate the text
decoration added by the ILabelDecorator and will apply the style
returned by getDecorationStyle(Object)
The ILabelDecorator can optionally implement IColorDecorator
and IFontDecorator to provide foreground and background color and
font decoration.
DelegatingStyledCellLabelProvider.IStyledLabelProviderCOLORS_ON_SELECTION, NO_FOCUS| Constructor and Description |
|---|
DecoratingStyledCellLabelProvider(DelegatingStyledCellLabelProvider.IStyledLabelProvider labelProvider,
ILabelDecorator decorator,
IDecorationContext decorationContext)
Creates a
DecoratingStyledCellLabelProvider that delegates the
requests for styled labels and for images to a
DelegatingStyledCellLabelProvider.IStyledLabelProvider. |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ILabelProviderListener listener)
Adds a listener to this label provider.
|
void |
dispose()
The
BaseLabelProvider implementation of this
IBaseLabelProvider method clears its internal listener list. |
Color |
getBackground(Object element)
Provides a background color for the given element.
|
IDecorationContext |
getDecorationContext()
Returns the decoration context associated with this label provider.
|
protected StyledString.Styler |
getDecorationStyle(Object element)
Sets the
StyledString.Styler to be used for string
decorations. |
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)
Returns the image for the label of the given element.
|
ILabelDecorator |
getLabelDecorator()
Returns the decorator or
null if no decorator is installed |
protected StyledString |
getStyledText(Object element)
Returns the styled text for the label of the given element.
|
boolean |
isLabelProperty(Object element,
String property)
The
BaseLabelProvider implementation of this
IBaseLabelProvider method returns true. |
void |
removeListener(ILabelProviderListener listener)
Removes a listener to this label provider.
|
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 newDecorator)
Sets the label decorator.
|
void |
update(ViewerCell cell)
Update the label for cell.
|
getStyledStringProvider, getToolTipTexterase, getColumn, getViewer, initialize, isOwnerDrawEnabled, measure, paint, prepareStyleRange, setOwnerDrawEnabled, styleDecoratedStringdispose, initialize, setOwnerDrawEnabled, setUpOwnerDrawgetToolTipBackgroundColor, getToolTipDisplayDelayTime, getToolTipFont, getToolTipForegroundColor, getToolTipImage, getToolTipShift, getToolTipStyle, getToolTipTimeDisplayed, useNativeToolTipfireLabelProviderChangedaddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectpublic DecoratingStyledCellLabelProvider(DelegatingStyledCellLabelProvider.IStyledLabelProvider labelProvider, ILabelDecorator decorator, IDecorationContext decorationContext)
DecoratingStyledCellLabelProvider that delegates the
requests for styled labels and for images to a
DelegatingStyledCellLabelProvider.IStyledLabelProvider.labelProvider - the styled label providerdecorator - a label decorator or null to not decorate the
labeldecorationContext - a decoration context or null if the no
decorator is configured or the default decorator should be
usedpublic IDecorationContext getDecorationContext()
LabelDecorator.public void setDecorationContext(IDecorationContext decorationContext)
LabelDecorator.decorationContext - the decoration context.public void update(ViewerCell cell)
CellLabelProviderupdate in class DelegatingStyledCellLabelProvidercell - ViewerCellpublic Color getForeground(Object element)
DelegatingStyledCellLabelProvidergetForeground in class DelegatingStyledCellLabelProviderelement - the elementnull to
use the default foreground colorpublic Color getBackground(Object element)
DelegatingStyledCellLabelProvidergetBackground in class DelegatingStyledCellLabelProviderelement - the elementnull to
use the default background colorpublic Font getFont(Object element)
DelegatingStyledCellLabelProvidergetFont in class DelegatingStyledCellLabelProviderelement - the elementnull to use the
default fontpublic Image getImage(Object element)
DelegatingStyledCellLabelProvidergetImage in class DelegatingStyledCellLabelProviderelement - the element for which to provide the label imagenull if
there is no image for the given objectprotected StyledString getStyledText(Object element)
getStyledText in class DelegatingStyledCellLabelProviderelement - the element for which to provide the styled label textprotected StyledString.Styler getDecorationStyle(Object element)
StyledString.Styler to be used for string
decorations. By default the
decoration style. Clients
can override.
Note that it is the client's responsibility to react on color changes of
the decoration color by refreshing the viewelement - the element that has been decoratedpublic ILabelDecorator getLabelDecorator()
null if no decorator is installednull if no decorator is installedpublic void setLabelDecorator(ILabelDecorator newDecorator)
newDecorator - the label decorator, or null if no decorations
are to be appliedpublic void addListener(ILabelProviderListener listener)
IBaseLabelProviderLabel provider listeners are informed about state changes that affect the rendering of the viewer that uses this label provider.
addListener in interface IBaseLabelProvideraddListener in class DelegatingStyledCellLabelProviderlistener - a label provider listenerpublic void removeListener(ILabelProviderListener listener)
IBaseLabelProviderremoveListener in interface IBaseLabelProviderremoveListener in class DelegatingStyledCellLabelProviderlistener - a label provider listenerpublic boolean isLabelProperty(Object element, String property)
BaseLabelProviderBaseLabelProvider implementation of this
IBaseLabelProvider method returns true. Subclasses may
override.isLabelProperty in interface IBaseLabelProviderisLabelProperty in class DelegatingStyledCellLabelProviderelement - the elementproperty - the propertytrue if the label would be affected,
and false if it would be unaffectedpublic void dispose()
BaseLabelProviderBaseLabelProvider implementation of this
IBaseLabelProvider method clears its internal listener list.
Subclasses may extend but should call the super implementation.dispose in interface IBaseLabelProviderdispose in class DelegatingStyledCellLabelProvider
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.