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.IStyledLabelProvider
COLORS_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, getToolTipText
erase, getColumn, getViewer, initialize, isOwnerDrawEnabled, measure, paint, prepareStyleRange, setOwnerDrawEnabled, styleDecoratedString
dispose, initialize, setOwnerDrawEnabled, setUpOwnerDraw
getToolTipBackgroundColor, getToolTipDisplayDelayTime, getToolTipFont, getToolTipForegroundColor, getToolTipImage, getToolTipShift, getToolTipStyle, getToolTipTimeDisplayed, useNativeToolTip
fireLabelProviderChanged
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
public 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)
CellLabelProvider
update
in class DelegatingStyledCellLabelProvider
cell
- ViewerCell
public Color getForeground(Object element)
DelegatingStyledCellLabelProvider
getForeground
in class DelegatingStyledCellLabelProvider
element
- the elementnull
to
use the default foreground colorpublic Color getBackground(Object element)
DelegatingStyledCellLabelProvider
getBackground
in class DelegatingStyledCellLabelProvider
element
- the elementnull
to
use the default background colorpublic Font getFont(Object element)
DelegatingStyledCellLabelProvider
getFont
in class DelegatingStyledCellLabelProvider
element
- the elementnull
to use the
default fontpublic Image getImage(Object element)
DelegatingStyledCellLabelProvider
getImage
in class DelegatingStyledCellLabelProvider
element
- 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 DelegatingStyledCellLabelProvider
element
- 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)
IBaseLabelProvider
Label provider listeners are informed about state changes that affect the rendering of the viewer that uses this label provider.
addListener
in interface IBaseLabelProvider
addListener
in class DelegatingStyledCellLabelProvider
listener
- a label provider listenerpublic void removeListener(ILabelProviderListener listener)
IBaseLabelProvider
removeListener
in interface IBaseLabelProvider
removeListener
in class DelegatingStyledCellLabelProvider
listener
- a label provider listenerpublic boolean isLabelProperty(Object element, String property)
BaseLabelProvider
BaseLabelProvider
implementation of this
IBaseLabelProvider
method returns true
. Subclasses may
override.isLabelProperty
in interface IBaseLabelProvider
isLabelProperty
in class DelegatingStyledCellLabelProvider
element
- the elementproperty
- the propertytrue
if the label would be affected,
and false
if it would be unaffectedpublic void dispose()
BaseLabelProvider
BaseLabelProvider
implementation of this
IBaseLabelProvider
method clears its internal listener list.
Subclasses may extend but should call the super implementation.dispose
in interface IBaseLabelProvider
dispose
in class DelegatingStyledCellLabelProvider
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.