public class LabelProvider extends StyledCellLabelProvider implements IProviderFlagsChangeListener, DelegatingStyledCellLabelProvider.IStyledLabelProvider, ICommonLabelProvider, ITableLabelProvider, ITableColorProvider
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.
COLORS_ON_SELECTION, NO_FOCUS
Constructor and Description |
---|
LabelProvider()
Eclipse constructor.
|
LabelProvider(int flags)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of the label provider.
|
Color |
getBackground(Object element,
int columnIndex)
Provides a background color for the given element at the specified index
|
Image |
getColumnImage(Object element,
int columnIndex)
Returns the label image for the given column of the given element.
|
String |
getColumnText(Object element,
int columnIndex)
Returns the label text for the given column of the given element.
|
String |
getDescription(Object element)
Provide a description for the status bar view, if available.
|
int |
getFlags()
Gets the flags.
|
Color |
getForeground(Object element,
int columnIndex)
Provides a foreground color for the given element.
|
Image |
getImage(Object element)
Returns the image for the label of the given element.
|
static JavaElementLabelProvider |
getJavaElementLabelProvider_LargeImages()
Gets the Java element label provider for large images, allocates it if required.
|
static JavaElementLabelProvider |
getJavaElementLabelProvider()
Gets the Java element label provider, allocates it if required.
|
StyledString |
getStyledText(Object element)
Returns the styled text label for the given element
|
String |
getText(Object element)
Returns 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 |
saveState(IMemento aMemento) |
void |
setFlags(int flags)
Sets the flags.
|
erase, getColumn, getViewer, initialize, isOwnerDrawEnabled, measure, paint, prepareStyleRange, setOwnerDrawEnabled, styleDecoratedString, update
dispose, initialize, setOwnerDrawEnabled, setUpOwnerDraw
getToolTipBackgroundColor, getToolTipDisplayDelayTime, getToolTipFont, getToolTipForegroundColor, getToolTipImage, getToolTipShift, getToolTipStyle, getToolTipText, getToolTipTimeDisplayed, useNativeToolTip
addListener, fireLabelProviderChanged, removeListener
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addListener, removeListener
public LabelProvider()
public LabelProvider(int flags)
flags
- The flags for the information.public static JavaElementLabelProvider getJavaElementLabelProvider()
public static JavaElementLabelProvider getJavaElementLabelProvider_LargeImages()
public void onNewFlags(int flags)
onNewFlags
in interface IProviderFlagsChangeListener
flags
- The flags from INavigatorPresentation.public void setFlags(int flags)
public int getFlags()
public void init(ICommonContentExtensionSite aConfig)
init
in interface ICommonLabelProvider
aConfig
- The extension site provides information that some extensions
will find useful to configure themselves properly in a
particular viewer.public void restoreState(IMemento aMemento)
restoreState
in interface IMementoAware
public void saveState(IMemento aMemento)
saveState
in interface IMementoAware
public void dispose()
dispose
in interface IBaseLabelProvider
dispose
in class StyledCellLabelProvider
public boolean isLabelProperty(Object element, String property)
isLabelProperty
in interface IBaseLabelProvider
isLabelProperty
in class BaseLabelProvider
element
- The element.property
- The property.true
if the label would be affected,
and false
if it would be unaffected.public Image getImage(Object element)
getImage
in interface DelegatingStyledCellLabelProvider.IStyledLabelProvider
getImage
in interface ILabelProvider
element
- The element for which to provide the label image.null
if there is no image for the given object.public String getText(Object element)
getText
in interface ILabelProvider
element
- The element for which to provide the label text.null
if there is no text label for the given object.public StyledString getStyledText(Object element)
getStyledText
in interface DelegatingStyledCellLabelProvider.IStyledLabelProvider
element
- The element to evaluate the styled string for.public String getDescription(Object element)
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.
getDescription
in interface IDescriptionProvider
element
- The element selected in the Navigator.public Image getColumnImage(Object element, int columnIndex)
getColumnImage
in interface ITableLabelProvider
element
- The object representing the entire row, or null
indicating that
no input object is set in the viewer.columnIndex
- The zero-based index of the column in which the label appears.null
if there is no image for the given object at columnIndex.public String getColumnText(Object element, int columnIndex)
getColumnText
in interface ITableLabelProvider
element
- The object representing the entire row, or null
indicating that
no input object is set in the viewer.columnIndex
- The zero-based index of the column in which the label appears.null
if there is no text for the given object at columnIndex.public Color getForeground(Object element, int columnIndex)
getForeground
in interface ITableColorProvider
element
- The element.columnIndex
- The zero-based index of the column in which the color appears.null
to use the default foreground color.public Color getBackground(Object element, int columnIndex)
getBackground
in interface ITableColorProvider
element
- The element.columnIndex
- The zero-based index of the column in which the color appearsnull
to use the default background color.iizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.