Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.model
Class WorkbenchLabelProvider


java.lang.Object
  extended by 

org.eclipse.core.commands.common.EventManager
      extended by 

org.eclipse.jface.viewers.BaseLabelProvider
          extended by 

org.eclipse.jface.viewers.LabelProvider
              extended by 
org.eclipse.ui.model.WorkbenchLabelProvider
All Implemented Interfaces:
IBaseLabelProvider, IColorProvider, IFontProvider, ILabelProvider

public class WorkbenchLabelProvider
extends LabelProvider
implements IColorProvider, IFontProvider

Provides basic labels for adaptable objects that have the IWorkbenchAdapter adapter associated with them. All dispensed images are cached until the label provider is explicitly disposed. This class provides a facility for subclasses to define annotations on the labels and icons of adaptable objects.


Constructor Summary
WorkbenchLabelProvider ()
          Creates a new workbench label provider.
 
Method Summary
protected   ImageDescriptor decorateImage ( ImageDescriptor input, Object element)
          Returns an image descriptor that is based on the given descriptor, but decorated with additional information relating to the state of the provided object.
protected   String decorateText ( String input, Object element)
          Returns a label that is based on the given label, but decorated with additional information relating to the state of the provided object.
 void dispose ()
          The BaseLabelProvider implementation of this IBaseLabelProvider method clears its internal listener list.
protected   IWorkbenchAdapter getAdapter ( Object o)
          Returns the implementation of IWorkbenchAdapter for the given object.
protected   IWorkbenchAdapter2 getAdapter2 ( Object o)
          Returns the implementation of IWorkbenchAdapter2 for the given object.
  Color getBackground ( Object element)
          Provides a background color for the given element.
static  ILabelProvider getDecoratingWorkbenchLabelProvider ()
          Returns a workbench label provider that is hooked up to the decorator mechanism.
  Font getFont ( Object element)
          Provides a font for the given element.
  Color getForeground ( Object element)
          Provides a foreground color for the given element.
  Image getImage ( Object element)
          The LabelProvider implementation of this ILabelProvider method returns null.
  String getText ( Object element)
          The LabelProvider implementation of this ILabelProvider method returns the element's toString string.
 
Methods inherited from class org.eclipse.jface.viewers. BaseLabelProvider
addListener, 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
 
Methods inherited from interface org.eclipse.jface.viewers. IBaseLabelProvider
addListener, isLabelProperty, removeListener
 

Constructor Detail

WorkbenchLabelProvider

public WorkbenchLabelProvider()
Creates a new workbench label provider.

Method Detail

getDecoratingWorkbenchLabelProvider

public static 
ILabelProvider getDecoratingWorkbenchLabelProvider()
Returns a workbench label provider that is hooked up to the decorator mechanism.

Returns:
a new DecoratingLabelProvider which wraps a new WorkbenchLabelProvider

decorateImage

protected 
ImageDescriptor decorateImage(
ImageDescriptor input,
                                        
Object element)
Returns an image descriptor that is based on the given descriptor, but decorated with additional information relating to the state of the provided object. Subclasses may reimplement this method to decorate an object's image.

Parameters:
input - The base image to decorate.
element - The element used to look up decorations.
Returns:
the resuling ImageDescriptor.
See Also:
CompositeImageDescriptor

decorateText

protected 
String decorateText(
String input,
                              
Object element)
Returns a label that is based on the given label, but decorated with additional information relating to the state of the provided object. Subclasses may implement this method to decorate an object's label.

Parameters:
input - The base text to decorate.
element - The element used to look up decorations.
Returns:
the resulting text

dispose

public void dispose()
Description copied from class: BaseLabelProvider
The BaseLabelProvider implementation of this IBaseLabelProvider method clears its internal listener list. Subclasses may extend but should call the super implementation.

Specified by:
dispose in interface IBaseLabelProvider
Overrides:
dispose in class BaseLabelProvider

getAdapter

protected final 
IWorkbenchAdapter getAdapter(
Object o)
Returns the implementation of IWorkbenchAdapter for the given object.

Parameters:
o - the object to look up.
Returns:
IWorkbenchAdapter ornull if the adapter is not defined or the object is not adaptable.

getAdapter2

protected final 
IWorkbenchAdapter2 getAdapter2(
Object o)
Returns the implementation of IWorkbenchAdapter2 for the given object.

Parameters:
o - the object to look up.
Returns:
IWorkbenchAdapter2 ornull if the adapter is not defined or the object is not adaptable.

getImage

public final 
Image getImage(
Object element)
Description copied from class: LabelProvider
The LabelProvider implementation of this ILabelProvider method returns null. Subclasses may override.

Specified by:
getImage in interface ILabelProvider
Overrides:
getImage in class LabelProvider
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

getText

public final 
String getText(
Object element)
Description copied from class: LabelProvider
The LabelProvider implementation of this ILabelProvider method returns the element's toString string. Subclasses may override.

Specified by:
getText in interface ILabelProvider
Overrides:
getText in class LabelProvider
Parameters:
element - the element for which to provide the label text
Returns:
the text string used to label the element, or null if there is no text label for the given object

getForeground

public 
Color getForeground(
Object element)
Description copied from interface: IColorProvider
Provides a foreground color for the given element.

Specified by:
getForeground in interface IColorProvider
Parameters:
element - the element
Returns:
the foreground color for the element, or null to use the default foreground color

getBackground

public 
Color getBackground(
Object element)
Description copied from interface: IColorProvider
Provides a background color for the given element.

Specified by:
getBackground in interface IColorProvider
Parameters:
element - the element
Returns:
the background color for the element, or null to use the default background color

getFont

public 
Font getFont(
Object element)
Description copied from interface: IFontProvider
Provides a font for the given element.

Specified by:
getFont in interface IFontProvider
Parameters:
element - the element
Returns:
the font for the element, or null to use the default font

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

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


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire