Class CellLabelProvider

All Implemented Interfaces:
IBaseLabelProvider, IToolTipProvider
Direct Known Subclasses:
ColumnLabelProvider, ObservableMapCellLabelProvider, OwnerDrawLabelProvider

public abstract class CellLabelProvider extends BaseLabelProvider implements IToolTipProvider
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:
  • Constructor Details

    • CellLabelProvider

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

    • 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

      Specified by:
      getToolTipText in interface IToolTipProvider
      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:
    • 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:
    • 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:
    • 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