Eclipse Platform
Release 3.2

org.eclipse.jface.viewers
Class LabelDecorator

java.lang.Object
  extended byorg.eclipse.jface.viewers.LabelDecorator
All Implemented Interfaces:
IBaseLabelProvider, ILabelDecorator

public abstract class LabelDecorator
extends Object
implements ILabelDecorator

The LabelDecorator is an abstract superclass of ILabelDecorators that support IDecorationContext.

Since:
3.2
See Also:
IDecorationContext

Constructor Summary
LabelDecorator()
           
 
Method Summary
abstract  Image decorateImage(Image image, Object element, IDecorationContext context)
          Returns an image that is based on the given image, but decorated with additional information relating to the state of the provided element taking into account the provided context.
abstract  String decorateText(String text, Object element, IDecorationContext context)
          Returns a text label that is based on the given text label, but decorated with additional information relating to the state of the provided element taking into account the provided context.
abstract  boolean prepareDecoration(Object element, String originalText, IDecorationContext context)
          Prepare the element for decoration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.viewers.ILabelDecorator
decorateImage, decorateText
 
Methods inherited from interface org.eclipse.jface.viewers.IBaseLabelProvider
addListener, dispose, isLabelProperty, removeListener
 

Constructor Detail

LabelDecorator

public LabelDecorator()
Method Detail

decorateImage

public abstract Image decorateImage(Image image,
                                    Object element,
                                    IDecorationContext context)
Returns an image that is based on the given image, but decorated with additional information relating to the state of the provided element taking into account the provided context. Text and image decoration updates can occur as a result of other updates within the workbench including deferred decoration by background processes. Clients should handle labelProviderChangedEvents for the given element to get the complete decoration.

Parameters:
image - the input image to decorate, or null if the element has no image
element - the element whose image is being decorated
context - additional context information about the element being decorated
Returns:
the decorated image, or null if no decoration is to be applied
See Also:
LabelProviderChangedEvent, IBaseLabelProvider.addListener(org.eclipse.jface.viewers.ILabelProviderListener), CompositeImageDescriptor

decorateText

public abstract String decorateText(String text,
                                    Object element,
                                    IDecorationContext context)
Returns a text label that is based on the given text label, but decorated with additional information relating to the state of the provided element taking into account the provided context. Text and image decoration updates can occur as a result of other updates within the workbench including deferred decoration by background processes. Clients should handle labelProviderChangedEvents for the given element to get the complete decoration.

Parameters:
text - the input text label to decorate
element - the element whose image is being decorated
context - additional context information about the element being decorated
Returns:
the decorated text label, or null if no decoration is to be applied
See Also:
LabelProviderChangedEvent, IBaseLabelProvider.addListener(org.eclipse.jface.viewers.ILabelProviderListener)

prepareDecoration

public abstract boolean prepareDecoration(Object element,
                                          String originalText,
                                          IDecorationContext context)
Prepare the element for decoration. If it is already decorated and ready for update return true. If decoration is pending return false.

Parameters:
element - The element to be decorated
originalText - The starting text.
context - The decoration context
Returns:
boolean true if the decoration is ready for this element

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.