org.eclipse.emf.cdo.ui
Class CDOLabelDecorator

java.lang.Object
  extended by org.eclipse.emf.cdo.ui.CDOLabelDecorator
All Implemented Interfaces:
IBaseLabelProvider, ILabelDecorator

public class CDOLabelDecorator
extends Object
implements ILabelDecorator

Decorates labels of CDO objects according to a pattern.

Since:
2.0
Author:
Victor Roldan Betancort

Field Summary
static String[] DECORATION_PROPOSALS
           
static String DECORATOR_ID
           
static String DEFAULT_DECORATION
           
static String NO_DECORATION
           
 
Constructor Summary
CDOLabelDecorator()
           
CDOLabelDecorator(String pattern)
           
 
Method Summary
 void addListener(ILabelProviderListener listener)
          Adds a listener to this label provider.
 Image decorateImage(Image image, Object element)
          Returns an image that is based on the given image, but decorated with additional information relating to the state of the provided element.
 String decorateText(String text, Object element)
          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.
 void dispose()
          Disposes of this label provider.
 boolean isLabelProperty(Object element, String property)
          Returns whether the label would be affected by a change to the given property of the given element.
 String parsePattern(String unparsedPattern)
           
 void removeListener(ILabelProviderListener listener)
          Removes a listener to this label provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DECORATION_PROPOSALS

public static final String[] DECORATION_PROPOSALS

DEFAULT_DECORATION

public static final String DEFAULT_DECORATION

NO_DECORATION

public static final String NO_DECORATION

DECORATOR_ID

public static final String DECORATOR_ID
See Also:
Constant Field Values
Constructor Detail

CDOLabelDecorator

public CDOLabelDecorator()

CDOLabelDecorator

public CDOLabelDecorator(String pattern)
Method Detail

dispose

public void dispose()
Description copied from interface: org.eclipse.jface.viewers.IBaseLabelProvider
Disposes of this label provider. When a label provider is attached to a viewer, the viewer will automatically call this method when the viewer is being closed. When label providers are used outside of the context of a viewer, it is the client's responsibility to ensure that this method is called when the provider is no longer needed.

Specified by:
dispose in interface IBaseLabelProvider

parsePattern

public String parsePattern(String unparsedPattern)

decorateImage

public Image decorateImage(Image image,
                           Object element)
Description copied from interface: org.eclipse.jface.viewers.ILabelDecorator
Returns an image that is based on the given image, but decorated with additional information relating to the state of the provided element. 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.

Specified by:
decorateImage in interface ILabelDecorator
Parameters:
image - the input image to decorate, or null if the element has no image
element - the element whose image is 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 String decorateText(String text,
                           Object element)
Description copied from interface: org.eclipse.jface.viewers.ILabelDecorator
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. 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.

Specified by:
decorateText in interface ILabelDecorator
Parameters:
text - the input text label to decorate
element - the element whose image is 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)

isLabelProperty

public boolean isLabelProperty(Object element,
                               String property)
Description copied from interface: org.eclipse.jface.viewers.IBaseLabelProvider
Returns whether the label would be affected by a change to the given property of the given element. This can be used to optimize a non-structural viewer update. If the property mentioned in the update does not affect the label, then the viewer need not update the label.

Specified by:
isLabelProperty in interface IBaseLabelProvider
Parameters:
element - the element
property - the property
Returns:
true if the label would be affected, and false if it would be unaffected

addListener

public void addListener(ILabelProviderListener listener)
Description copied from interface: org.eclipse.jface.viewers.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 interface IBaseLabelProvider
Parameters:
listener - a label provider listener

removeListener

public void removeListener(ILabelProviderListener listener)
Description copied from interface: org.eclipse.jface.viewers.IBaseLabelProvider
Removes a listener to this label provider. Has no effect if an identical listener is not registered.

Specified by:
removeListener in interface IBaseLabelProvider
Parameters:
listener - a label provider listener


Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.