Package org.eclipse.jface.viewers
Class OwnerDrawLabelProvider
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.viewers.BaseLabelProvider
org.eclipse.jface.viewers.CellLabelProvider
org.eclipse.jface.viewers.OwnerDrawLabelProvider
- All Implemented Interfaces:
- IBaseLabelProvider,- IToolTipProvider
- Direct Known Subclasses:
- StyledCellLabelProvider
OwnerDrawLabelProvider is an abstract implementation of a label provider that
 handles custom draw.
 
This class is intended to be subclassed by implementors.
- Since:
- 3.3
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new instance of the receiver based on a column viewer.
- 
Method SummaryModifier and TypeMethodDescriptionvoiddispose(ColumnViewer viewer, ViewerColumn column) Dispose of this label provider which was used with the given column viewer and column.protected voidHandle the erase event.protected voidinitialize(ColumnViewer viewer, ViewerColumn column) This implementation ofCellLabelProvider.initialize(ColumnViewer, ViewerColumn)delegates toinitialize(ColumnViewer, ViewerColumn, boolean)with a value oftrueforenableOwnerDraw.protected final voidinitialize(ColumnViewer viewer, ViewerColumn column, boolean enableOwnerDraw) May be called from subclasses that overrideinitialize(ColumnViewer, ViewerColumn)but want to customize whether owner draw will be enabled.protected abstract voidHandle the measure event.protected abstract voidHandle the paint event.protected voidsetOwnerDrawEnabled(ColumnViewer viewer, ViewerColumn column, boolean enabled) Enables or disables owner draw for the given viewer and column.static voidsetUpOwnerDraw(ColumnViewer viewer) Deprecated.voidupdate(ViewerCell cell) Update the label for cell.Methods inherited from class org.eclipse.jface.viewers.CellLabelProvidergetToolTipBackgroundColor, getToolTipDisplayDelayTime, getToolTipFont, getToolTipForegroundColor, getToolTipImage, getToolTipShift, getToolTipStyle, getToolTipText, getToolTipTimeDisplayed, useNativeToolTipMethods inherited from class org.eclipse.jface.viewers.BaseLabelProvideraddListener, dispose, fireLabelProviderChanged, isLabelProperty, removeListenerMethods inherited from class org.eclipse.core.commands.common.EventManageraddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
- 
Constructor Details- 
OwnerDrawLabelProviderpublic OwnerDrawLabelProvider()Create a new instance of the receiver based on a column viewer.
 
- 
- 
Method Details- 
setUpOwnerDrawDeprecated.Since 3.4, the default implementation ofCellLabelProvider.initialize(ColumnViewer, ViewerColumn)in this class will set up the necessary owner draw callbacks automatically. Calls to this method can be removed.Set up the owner draw callbacks for the viewer.- Parameters:
- viewer- the viewer the owner draw is set up
 
- 
disposeDescription copied from class:CellLabelProviderDispose of this label provider which was used with the given column viewer and column. Subclasses may extend but should call the super implementation (which callsBaseLabelProvider.dispose()).- Overrides:
- disposein class- CellLabelProvider
- Parameters:
- viewer- the viewer
- column- the column, or- nullif a column is not available.
 
- 
initializeThis implementation ofCellLabelProvider.initialize(ColumnViewer, ViewerColumn)delegates toinitialize(ColumnViewer, ViewerColumn, boolean)with a value oftrueforenableOwnerDraw. Subclasses may override this method but should either call the super implementation or, alternatively,initialize(ColumnViewer, ViewerColumn, boolean).- Overrides:
- initializein class- CellLabelProvider
- Parameters:
- viewer- the viewer
- column- the column, or- nullif a column is not available.
 
- 
initializeMay be called from subclasses that overrideinitialize(ColumnViewer, ViewerColumn)but want to customize whether owner draw will be enabled. This method callssuper.initialize(ColumnViewer, ViewerColumn), and then enables or disables owner draw by callingsetOwnerDrawEnabled(ColumnViewer, ViewerColumn, boolean).- Parameters:
- viewer- the viewer
- column- the column, or- nullif a column is not available.
- enableOwnerDraw-- trueif owner draw should be enabled for the given viewer and column,- falseotherwise.
- Since:
- 3.4
 
- 
updateDescription copied from class:CellLabelProviderUpdate the label for cell.- Specified by:
- updatein class- CellLabelProvider
- Parameters:
- cell-- ViewerCell
 
- 
eraseHandle the erase event. The default implementation colors the background of selected areas withSWT.COLOR_LIST_SELECTIONand foregrounds withSWT.COLOR_LIST_SELECTION_TEXT. Note that this implementation causes non-native behavior on some platforms. Subclasses should override this method and not call the super implementation.- Parameters:
- event- the erase event
- element- the model object
- See Also:
 
- 
measureHandle the measure event.- Parameters:
- event- the measure event
- element- the model element
- See Also:
 
- 
paintHandle the paint event.- Parameters:
- event- the paint event
- element- the model element
- See Also:
 
- 
setOwnerDrawEnabledEnables or disables owner draw for the given viewer and column. This method will attach or remove a listener to the underlying control as necessary. This method is called frominitialize(ColumnViewer, ViewerColumn)anddispose(ColumnViewer, ViewerColumn)but may be called from subclasses to enable or disable owner draw dynamically.- Parameters:
- viewer- the viewer
- column- the column, or- nullif a column is not available
- enabled-- trueif owner draw should be enabled,- falseotherwise
- Since:
- 3.4
 
 
- 
CellLabelProvider.initialize(ColumnViewer, ViewerColumn)in this class will set up the necessary owner draw callbacks automatically.