Package com.iizigo.navigator
Class LabelProvider
- All Implemented Interfaces:
- IProviderFlagsChangeListener,- DelegatingStyledCellLabelProvider.IStyledLabelProvider,- IBaseLabelProvider,- ILabelProvider,- ITableColorProvider,- ITableLabelProvider,- IToolTipProvider,- ICommonLabelProvider,- IDescriptionProvider,- IMementoAware
public class LabelProvider extends StyledCellLabelProvider implements IProviderFlagsChangeListener, DelegatingStyledCellLabelProvider.IStyledLabelProvider, ICommonLabelProvider, ITableLabelProvider, ITableColorProvider
The IIZI general purpose label provider.
The label provider implementation is straight-forward. Its task is to produce a textual and graphical representation of every element. In addition, it implements the IDescriptionProvider interface to provide description in the status bar when an element is selected. Please note, that this class is not CNF-specific but is related to JFace ContentProvider and JFace LabelProvider, as usual for any Viewer.
- Author:
- Christopher Mindus
- Field Summary- Fields inherited from class org.eclipse.jface.viewers.StyledCellLabelProvider- COLORS_ON_SELECTION, NO_FOCUS
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- void- dispose()Disposes of the label provider.- getBackground- (Object element, int columnIndex) Provides a background color for the given element at the specified index- getColumnImage- (Object element, int columnIndex) Returns the label image for the given column of the given element.- getColumnText- (Object element, int columnIndex) Returns the label text for the given column of the given element.- getDescription- (Object element) Provide a description for the status bar view, if available.- int- getFlags()Gets the flags.- getForeground- (Object element, int columnIndex) Provides a foreground color for the given element.Returns the image for the label of the given element.- static JavaElementLabelProviderGets the Java element label provider, allocates it if required.- static JavaElementLabelProviderGets the Java element label provider for large images, allocates it if required.- getStyledText- (Object element) Returns the styled text label for the given elementReturns the text for the label of the given element.- void- init- (ICommonContentExtensionSite aConfig) Initialize the label provider with the given configuration.- boolean- isLabelProperty- (Object element, String property) Returns whether the label would be affected by a change to the given property of the given element.- void- onNewFlags- (int flags) Called when the flags changed.- void- restoreState- (IMemento aMemento) - void- void- setFlags- (int flags) Sets the flags.- Methods inherited from class org.eclipse.jface.viewers.StyledCellLabelProvider- erase, getColumn, getViewer, initialize, isOwnerDrawEnabled, measure, paint, prepareStyleRange, setOwnerDrawEnabled, styleDecoratedString, update- Methods inherited from class org.eclipse.jface.viewers.OwnerDrawLabelProvider- dispose, initialize, setOwnerDrawEnabled, setUpOwnerDraw- Methods inherited from class org.eclipse.jface.viewers.CellLabelProvider- getToolTipBackgroundColor, getToolTipDisplayDelayTime, getToolTipFont, getToolTipForegroundColor, getToolTipImage, getToolTipShift, getToolTipStyle, getToolTipText, getToolTipTimeDisplayed, useNativeToolTip- Methods inherited from class org.eclipse.jface.viewers.BaseLabelProvider- addListener, fireLabelProviderChanged, 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, removeListener
- Constructor Details- LabelProviderpublic LabelProvider()Eclipse constructor.
- LabelProviderpublic LabelProvider- (int flags) Constructor.- Parameters:
- flags- The flags for the information.
 
 
- Method Details- getJavaElementLabelProviderGets the Java element label provider, allocates it if required.
- getJavaElementLabelProvider_LargeImagesGets the Java element label provider for large images, allocates it if required.
- onNewFlagspublic void onNewFlags- (int flags) Called when the flags changed.- Specified by:
- onNewFlagsin interface- IProviderFlagsChangeListener
- Parameters:
- flags- The flags from INavigatorPresentation.
 
- setFlagspublic void setFlags- (int flags) Sets the flags.
- getFlagspublic int getFlags()Gets the flags.
- restoreState- Specified by:
- restoreStatein interface- IMementoAware
 
- saveState- Specified by:
- saveStatein interface- IMementoAware
 
- disposepublic void dispose()Disposes of the label provider.- Specified by:
- disposein interface- IBaseLabelProvider
- Overrides:
- disposein class- StyledCellLabelProvider
 
- isLabelPropertyReturns 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:
- isLabelPropertyin interface- IBaseLabelProvider
- Overrides:
- isLabelPropertyin class- BaseLabelProvider
- Parameters:
- element- The element.
- property- The property.
- Returns:
- trueif the label would be affected, and- falseif it would be unaffected.
 
- getImageReturns the image for the label of the given element. The image is owned by the label provider and must not be disposed directly. Instead, dispose the label provider when no longer needed.- Specified by:
- getImagein interface- DelegatingStyledCellLabelProvider.IStyledLabelProvider
- Specified by:
- getImagein interface- ILabelProvider
- Parameters:
- element- The element for which to provide the label image.
- Returns:
- The image used to label the element, or nullif there is no image for the given object.
 
- getTextReturns the text for the label of the given element.- Specified by:
- getTextin interface- ILabelProvider
- Parameters:
- element- The element for which to provide the label text.
- Returns:
- The text string used to label the element, or nullif there is no text label for the given object.
 
- getStyledTextReturns the styled text label for the given element- Specified by:
- getStyledTextin interface- DelegatingStyledCellLabelProvider.IStyledLabelProvider
- Parameters:
- element- The element to evaluate the styled string for.
- Returns:
- The styled string.
 
- getDescriptionProvide a description for the status bar view, if available. A default string of the form "(x) items selected" will be used if this method choose to return null.- The empty string ("") will be respected as a valid value if returned. Return null if the extension defers to the default method of supplying status bar descriptions. - Specified by:
- getDescriptionin interface- IDescriptionProvider
- Parameters:
- element- The element selected in the Navigator.
- Returns:
- A description for the status bar view, or null if not available.
 
- getColumnImageReturns the label image for the given column of the given element.- Specified by:
- getColumnImagein interface- ITableLabelProvider
- Parameters:
- element- The object representing the entire row, or- nullindicating that no input object is set in the viewer.
- columnIndex- The zero-based index of the column in which the label appears.
- Returns:
- Image or nullif there is no image for the given object at columnIndex.
 
- getColumnTextReturns the label text for the given column of the given element.- Specified by:
- getColumnTextin interface- ITableLabelProvider
- Parameters:
- element- The object representing the entire row, or- nullindicating that no input object is set in the viewer.
- columnIndex- The zero-based index of the column in which the label appears.
- Returns:
- String or or nullif there is no text for the given object at columnIndex.
 
- getForegroundProvides a foreground color for the given element.- Specified by:
- getForegroundin interface- ITableColorProvider
- Parameters:
- element- The element.
- columnIndex- The zero-based index of the column in which the color appears.
- Returns:
- The foreground color for the element, or nullto use the default foreground color.
 
- getBackgroundProvides a background color for the given element at the specified index- Specified by:
- getBackgroundin interface- ITableColorProvider
- Parameters:
- element- The element.
- columnIndex- The zero-based index of the column in which the color appears
- Returns:
- The background color for the element, or nullto use the default background color.