Eclipse Platform
Release 3.7

org.eclipse.jface.viewers
Class CellLabelProvider

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.jface.viewers.BaseLabelProvider
          extended by org.eclipse.jface.viewers.CellLabelProvider
All Implemented Interfaces:
IBaseLabelProvider
Direct Known Subclasses:
ColumnLabelProvider, ObservableMapCellLabelProvider, OwnerDrawLabelProvider

public abstract class CellLabelProvider
extends BaseLabelProvider

The CellLabelProvider is an abstract implementation of a label provider for structured viewers.

This class is intended to be subclassed

Since:
3.3
See Also:
as a concrete implementation

Constructor Summary
CellLabelProvider()
          Create a new instance of the receiver.
 
Method Summary
 void dispose(ColumnViewer viewer, ViewerColumn column)
          Dispose of this label provider which was used with the given column viewer and column.
 Color getToolTipBackgroundColor(Object object)
          Return the background color used for the tool tip
 int getToolTipDisplayDelayTime(Object object)
          The time in milliseconds until the tool tip is displayed.
 Font getToolTipFont(Object object)
          Get the Font used to display the tool tip
 Color getToolTipForegroundColor(Object object)
          The foreground color used to display the the text in the tool tip
 Image getToolTipImage(Object object)
          Get the image displayed in the tool tip for object.
 Point getToolTipShift(Object object)
          Return the amount of pixels in x and y direction you want the tool tip to pop up from the mouse pointer.
 int getToolTipStyle(Object object)
          The SWT style used to create the CLabel (see there for supported styles).
 String getToolTipText(Object element)
          Get the text displayed in the tool tip for object.
 int getToolTipTimeDisplayed(Object object)
          The time in milliseconds the tool tip is shown for.
protected  void initialize(ColumnViewer viewer, ViewerColumn column)
          Initialize this label provider for use with the given column viewer for the given column.
abstract  void update(ViewerCell cell)
          Update the label for cell.
 boolean useNativeToolTip(Object object)
          Return whether or not to use the native tool tip.
 
Methods inherited from class org.eclipse.jface.viewers.BaseLabelProvider
addListener, dispose, fireLabelProviderChanged, isLabelProperty, removeListener
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellLabelProvider

public CellLabelProvider()
Create a new instance of the receiver.

Method Detail

getToolTipImage

public Image getToolTipImage(Object object)
Get the image displayed in the tool tip for object.

If getToolTipText(Object) and getToolTipImage(Object) both return null the control is set back to standard behavior

Parameters:
object - the element for which the tool tip is shown
Returns:
Image or null if there is not image.

getToolTipText

public String getToolTipText(Object element)
Get the text displayed in the tool tip for object.

If getToolTipText(Object) and getToolTipImage(Object) both return null the control is set back to standard behavior

Parameters:
element - the element for which the tool tip is shown
Returns:
the String or null if there is not text to display

getToolTipBackgroundColor

public Color getToolTipBackgroundColor(Object object)
Return the background color used for the tool tip

Parameters:
object - the Object for which the tool tip is shown
Returns:
the Color used or null if you want to use the default color SWT.COLOR_INFO_BACKGROUND
See Also:
SWT.COLOR_INFO_BACKGROUND

getToolTipForegroundColor

public Color getToolTipForegroundColor(Object object)
The foreground color used to display the the text in the tool tip

Parameters:
object - the Object for which the tool tip is shown
Returns:
the Color used or null if you want to use the default color SWT.COLOR_INFO_FOREGROUND
See Also:
SWT.COLOR_INFO_FOREGROUND

getToolTipFont

public Font getToolTipFont(Object object)
Get the Font used to display the tool tip

Parameters:
object - the element for which the tool tip is shown
Returns:
Font or null if the default font is to be used.

getToolTipShift

public Point getToolTipShift(Object object)
Return the amount of pixels in x and y direction you want the tool tip to pop up from the mouse pointer. The default shift is 10px right and 0px below your mouse cursor. Be aware of the fact that you should at least position the tool tip 1px right to your mouse cursor else click events may not get propagated properly.

Parameters:
object - the element for which the tool tip is shown
Returns:
Point to shift of the tool tip or null if the default shift should be used.

useNativeToolTip

public boolean useNativeToolTip(Object object)
Return whether or not to use the native tool tip. If you switch to native tool tips only the value from getToolTipText(Object) is used all other features from custom tool tips are not supported.

To reset the control to native behavior you should return true from this method and null from getToolTipText(Object) or null from getToolTipText(Object) and getToolTipImage(Object) at the same time

Parameters:
object - the Object for which the tool tip is shown
Returns:
true if native tool tips should be used

getToolTipTimeDisplayed

public int getToolTipTimeDisplayed(Object object)
The time in milliseconds the tool tip is shown for.

Parameters:
object - the Object for which the tool tip is shown
Returns:
time in milliseconds the tool tip is shown for

getToolTipDisplayDelayTime

public int getToolTipDisplayDelayTime(Object object)
The time in milliseconds until the tool tip is displayed.

Parameters:
object - the Object for which the tool tip is shown
Returns:
time in milliseconds until the tool tip is displayed

getToolTipStyle

public int getToolTipStyle(Object object)
The SWT style used to create the CLabel (see there for supported styles). By default SWT.SHADOW_NONE is used.

Parameters:
object - the element for which the tool tip is shown
Returns:
the style used to create the label
See Also:
CLabel

update

public abstract void update(ViewerCell cell)
Update the label for cell.

Parameters:
cell - ViewerCell

initialize

protected void initialize(ColumnViewer viewer,
                          ViewerColumn column)
Initialize this label provider for use with the given column viewer for the given column. Subclasses may extend but should call the super implementation (which at this time is empty but may be changed in the future).

Parameters:
viewer - the viewer
column - the column, or null if a column is not available.
Since:
3.4

dispose

public void dispose(ColumnViewer viewer,
                    ViewerColumn column)
Dispose of this label provider which was used with the given column viewer and column. Subclasses may extend but should call the super implementation (which calls BaseLabelProvider.dispose()).

Parameters:
viewer - the viewer
column - the column, or null if a column is not available.
Since:
3.4

Eclipse Platform
Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.