Class DelegatingStyledCellLabelProvider
- All Implemented Interfaces:
IBaseLabelProvider
,IToolTipProvider
- Direct Known Subclasses:
DecoratingStyledCellLabelProvider
DelegatingStyledCellLabelProvider
is a
StyledCellLabelProvider
that delegates requests for the styled string
and the image to a
DelegatingStyledCellLabelProvider.IStyledLabelProvider
.
Existing label providers can be enhanced by implementing
DelegatingStyledCellLabelProvider.IStyledLabelProvider
so they can be
used in viewers with styled labels.
The DelegatingStyledCellLabelProvider.IStyledLabelProvider
can
optionally implement IColorProvider
and IFontProvider
to
provide foreground and background color and a default font.
Since 3.10, DelegatingStyledCellLabelProvider.IStyledLabelProvider
can optionally implement IToolTipProvider
to provide tooltip
support.
- Since:
- 3.4
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Interface marking a label provider that provides styled text labels and images. -
Field Summary
Fields inherited from class org.eclipse.jface.viewers.StyledCellLabelProvider
COLORS_ON_SELECTION, NO_FOCUS
-
Constructor Summary
ConstructorDescriptionDelegatingStyledCellLabelProvider
(DelegatingStyledCellLabelProvider.IStyledLabelProvider labelProvider) Creates aDelegatingStyledCellLabelProvider
that delegates the requests for the styled labels and the images to aDelegatingStyledCellLabelProvider.IStyledLabelProvider
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ILabelProviderListener listener) Adds a listener to this label provider.void
dispose()
TheBaseLabelProvider
implementation of thisIBaseLabelProvider
method clears its internal listener list.getBackground
(Object element) Provides a background color for the given element.Provides a font for the given element.getForeground
(Object element) Provides a foreground color for the given element.Returns the image for the label of the given element.Returns the styled string provider.protected StyledString
getStyledText
(Object element) Returns the styled text for the label of the given element.getToolTipText
(Object element) Get the text displayed in the tool tip for object.boolean
isLabelProperty
(Object element, String property) TheBaseLabelProvider
implementation of thisIBaseLabelProvider
method returnstrue
.void
removeListener
(ILabelProviderListener listener) Removes a listener to this label provider.void
update
(ViewerCell cell) Update the label for cell.Methods inherited from class org.eclipse.jface.viewers.StyledCellLabelProvider
erase, getColumn, getViewer, initialize, isOwnerDrawEnabled, measure, paint, prepareStyleRange, setOwnerDrawEnabled, styleDecoratedString
Methods inherited from class org.eclipse.jface.viewers.OwnerDrawLabelProvider
dispose, initialize, setOwnerDrawEnabled, setUpOwnerDraw
Methods inherited from class org.eclipse.jface.viewers.CellLabelProvider
getToolTipBackgroundColor, getToolTipDisplayDelayTime, getToolTipFont, getToolTipForegroundColor, getToolTipImage, getToolTipShift, getToolTipStyle, getToolTipTimeDisplayed, useNativeToolTip
Methods inherited from class org.eclipse.jface.viewers.BaseLabelProvider
fireLabelProviderChanged
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
Constructor Details
-
DelegatingStyledCellLabelProvider
public DelegatingStyledCellLabelProvider(DelegatingStyledCellLabelProvider.IStyledLabelProvider labelProvider) Creates aDelegatingStyledCellLabelProvider
that delegates the requests for the styled labels and the images to aDelegatingStyledCellLabelProvider.IStyledLabelProvider
.- Parameters:
labelProvider
- the label provider that provides the styled labels and the images
-
-
Method Details
-
update
Description copied from class:CellLabelProvider
Update the label for cell.- Overrides:
update
in classStyledCellLabelProvider
- Parameters:
cell
-ViewerCell
-
getForeground
Provides a foreground color for the given element.- Parameters:
element
- the element- Returns:
- the foreground color for the element, or
null
to use the default foreground color
-
getBackground
Provides a background color for the given element.- Parameters:
element
- the element- Returns:
- the background color for the element, or
null
to use the default background color
-
getFont
Provides a font for the given element.- Parameters:
element
- the element- Returns:
- the font for the element, or
null
to use the default font
-
getToolTipText
Description copied from class:CellLabelProvider
Get the text displayed in the tool tip for object.If
CellLabelProvider.getToolTipText(Object)
andCellLabelProvider.getToolTipImage(Object)
both returnnull
the control is set back to standard behavior- Specified by:
getToolTipText
in interfaceIToolTipProvider
- Overrides:
getToolTipText
in classCellLabelProvider
- Parameters:
element
- the element for which the tool tip is shown- Returns:
- the
String
ornull
if there is not text to display
-
getImage
Returns the image for the label of the given element. The image is owned by the label provider and must not be disposed directly. Instead, dispose the label provider when no longer needed.- Parameters:
element
- the element for which to provide the label image- Returns:
- the image used to label the element, or
null
if there is no image for the given object
-
getStyledText
Returns the styled text for the label of the given element.- Parameters:
element
- the element for which to provide the styled label text- Returns:
- the styled text string used to label the element
-
getStyledStringProvider
Returns the styled string provider.- Returns:
- the wrapped label provider
-
addListener
Description copied from interface:IBaseLabelProvider
Adds a listener to this label provider. Has no effect if an identical listener is already registered.Label provider listeners are informed about state changes that affect the rendering of the viewer that uses this label provider.
- Specified by:
addListener
in interfaceIBaseLabelProvider
- Overrides:
addListener
in classBaseLabelProvider
- Parameters:
listener
- a label provider listener
-
removeListener
Description copied from interface:IBaseLabelProvider
Removes a listener to this label provider. Has no effect if an identical listener is not registered.- Specified by:
removeListener
in interfaceIBaseLabelProvider
- Overrides:
removeListener
in classBaseLabelProvider
- Parameters:
listener
- a label provider listener
-
isLabelProperty
Description copied from class:BaseLabelProvider
TheBaseLabelProvider
implementation of thisIBaseLabelProvider
method returnstrue
. Subclasses may override.- Specified by:
isLabelProperty
in interfaceIBaseLabelProvider
- Overrides:
isLabelProperty
in classBaseLabelProvider
- Parameters:
element
- the elementproperty
- the property- Returns:
true
if the label would be affected, andfalse
if it would be unaffected
-
dispose
public void dispose()Description copied from class:BaseLabelProvider
TheBaseLabelProvider
implementation of thisIBaseLabelProvider
method clears its internal listener list. Subclasses may extend but should call the super implementation.- Specified by:
dispose
in interfaceIBaseLabelProvider
- Overrides:
dispose
in classStyledCellLabelProvider
-