Class AbstractTableRendering
- java.lang.Object
-
- org.eclipse.core.runtime.PlatformObject
-
- org.eclipse.debug.ui.memory.AbstractMemoryRendering
-
- org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
-
- org.eclipse.debug.ui.memory.AbstractTableRendering
-
- All Implemented Interfaces:
EventListener,IAdaptable,IMemoryRendering,IRepositionableMemoryRendering,IResettableMemoryRendering,IPropertyChangeListener
- Direct Known Subclasses:
AbstractTextRendering
public abstract class AbstractTableRendering extends org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering implements IPropertyChangeListener, IResettableMemoryRendering
Abstract implementation of a table rendering.Clients should subclass from this class if they wish to provide a table rendering.
The label of the rendering is constructed by retrieving the expression from
IMemoryBlockExtension. For IMemoryBlock, the label is constructed using the memory block's start address. This rendering manages the change states of its memory bytes if the memory block does not opt to manage the change states. For IMemoryBlockExtension, if the memory block returns false when #supportsChangeManagement() is called, this rendering will calculate the change state for each byte when its content is updated. Clients may manages the change states of its memory block by returning true when #supportsChangeManagement() is called. This will cause this rendering to stop calculating the change states of the memory block. Instead it would rely on the attributes returned in the MemoryByte array to determine if a byte has changed. For IMemoryBlock, this rendering will manage the change states its content. When firing change event, be aware of the following: - whenever a change event is fired, the content provider for Memory View view checks to see if memory has actually changed. - If memory has actually changed, a refresh will commence. Changes to the memory block will be computed and will be shown with the delta icons. - If memory has not changed, content will not be refreshed. However, previous delta information will be erased. The screen will be refreshed to show that no memory has been changed. (All delta icons will be removed.) Please note that these APIs will be called multiple times by the Memory View. To improve performance, debug adapters need to cache the content of its memory block and only retrieve updated data when necessary.- Since:
- 3.1
-
-
Field Summary
Fields Modifier and Type Field Description static StringPROPERTY_COL_SIZEProperty identifier for the column size in a table rendering This property is used for synchronization between renderings.static StringPROPERTY_ROW_SIZEProperty identifier for the row size in a table rendering This property is used for synchronization between renderings.static StringPROPERTY_SELECTED_ADDRESSProperty identifier for the selected address in a table rendering This property is used for synchronization between renderings.static StringPROPERTY_TOP_ADDRESSProperty identifier for the top row address in a table rendering.
-
Constructor Summary
Constructors Constructor Description AbstractTableRendering(String renderingId)Constructs a new table rendering of the specified type.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbecomesHidden()Notification this rendering has become hidden in its container.voidbecomesVisible()Notification this rendering has become visible in its container.protected voidcreateActions()Create actions for this renderingControlcreateControl(Composite parent)Creates the top level control for this rendering under the given parent composite.protected ControlcreateToolTipControl(Composite composite)Creates the control used to display tool tips for cells in this table.voiddisplayError(DebugException e)Displays an error message for the given exception.voiddisplayTable()Displays the content of the table viewer.voiddispose()Disposes this rendering.protected voidfillContextMenu(IMenuManager menu)Fills the context menu for this renderingbooleanformat(int bytesPerLine, int columnSize)Format view tab based on the bytes per line and column.<T> TgetAdapter(Class<T> adapter)Returns an object which is an instance of the given class associated with this object.intgetAddressableSize()Returns the addressable size of this rendering's memory block in bytes.intgetAddressableUnitPerColumn()Returns the number of addressable units per column.intgetAddressableUnitPerLine()Returns the number of addressable units per row.abstract byte[]getBytes(String renderingTypeId, BigInteger address, MemoryByte[] currentValues, String newValue)Returns bytes for the given text corresponding to bytes at the given address for the specified rendering type.intgetBytesPerColumn()Returns the number of bytes displayed in a single column cell.intgetBytesPerLine()Returns the number of bytes displayed in a row.protected IColorProvidergetColorProviderAdapter()Returns the color provider for this rendering's memory block ornullif none.ControlgetControl()Returns the top level control for this rendering.protected IFontProvidergetFontProviderAdapter()Returns the font provider for this rendering's memory block ornullif none.StringgetLabel()Returns a label for this rendering.protected ILabelProvidergetLabelProviderAdapter()Returns the label provider for this rendering's memory block ornullif none.intgetNumCharsPerByte()Returns the number of characters a byte will convert to or -1 if unknown.BigIntegergetSelectedAddress()Returns the currently selected address in this rendering.MemoryByte[]getSelectedAsBytes()Returns the currently selected content in this rendering as MemoryByte.StringgetSelectedAsString()Returns the currently selected content in this rendering as a String.abstract StringgetString(String renderingTypeId, BigInteger address, MemoryByte[] data)Returns text for the given memory bytes at the specified address for the specified rendering type.protected IMemoryBlockTablePresentationgetTablePresentationAdapter()Returns the table presentation for this rendering's memory block ornullif none.TableViewergetTableViewer()Returns this rendering's table viewer.protected StringgetToolTipText(BigInteger address, MemoryByte[] bytes)Returns the text to display in a tool tip at the specified address for the specified bytes.voidgoToAddress(BigInteger address)Moves the cursor to the specified address.booleanisDisplayingError()Returns whether the error page is displayed.voidpropertyChange(PropertyChangeEvent event)Notification that a property has changed.voidrefresh()Refresh the table viewer with the current top visible address.voidreset()Deprecated.useresetRenderingto reset this rendering.voidresetRendering()Reset this memory rendering.voidresizeColumnsToPreferredSize()Resize column to the preferred size.protected voidtoolTipAboutToShow(Control toolTipControl, TableItem item, int col)Called when the tool tip is about to show in this rendering.voidupdateLabels()Updates labels of this rendering.protected voidupdateRenderingLabel(boolean showAddress)Updates the label of this rendering, optionally displaying the base address of this rendering's memory block.-
Methods inherited from class org.eclipse.debug.ui.memory.AbstractMemoryRendering
activated, addPropertyChangeListener, createPopupMenu, deactivated, decorateImage, decorateLabel, firePropertyChangedEvent, getImage, getMemoryBlock, getMemoryRenderingContainer, getPopupMenuManager, getRenderingId, init, isVisible, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.debug.ui.memory.IMemoryRendering
activated, addPropertyChangeListener, deactivated, getImage, getMemoryBlock, getRenderingId, init, removePropertyChangeListener
-
-
-
-
Field Detail
-
PROPERTY_SELECTED_ADDRESS
public static final String PROPERTY_SELECTED_ADDRESS
Property identifier for the selected address in a table rendering This property is used for synchronization between renderings.- See Also:
- Constant Field Values
-
PROPERTY_COL_SIZE
public static final String PROPERTY_COL_SIZE
Property identifier for the column size in a table rendering This property is used for synchronization between renderings.- See Also:
- Constant Field Values
-
PROPERTY_TOP_ADDRESS
public static final String PROPERTY_TOP_ADDRESS
Property identifier for the top row address in a table rendering. This property is used for synchronization between renderings.- See Also:
- Constant Field Values
-
PROPERTY_ROW_SIZE
public static final String PROPERTY_ROW_SIZE
Property identifier for the row size in a table rendering This property is used for synchronization between renderings.- Since:
- 3.2
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractTableRendering
public AbstractTableRendering(String renderingId)
Constructs a new table rendering of the specified type.- Parameters:
renderingId- memory rendering type identifier
-
-
Method Detail
-
propertyChange
public void propertyChange(PropertyChangeEvent event)
Description copied from interface:IPropertyChangeListenerNotification that a property has changed.This method gets called when the observed object fires a property change event.
- Specified by:
propertyChangein interfaceIPropertyChangeListener- Parameters:
event- the property change event object describing which property changed and how
-
createControl
public Control createControl(Composite parent)
Description copied from interface:IMemoryRenderingCreates the top level control for this rendering under the given parent composite. This method is called after this rendering'sinitmethod has been called.Implementors are responsible for ensuring that the created control can be accessed via
getControl- Specified by:
createControlin interfaceIMemoryRendering- Parameters:
parent- the parent composite- Returns:
- the new top level control
-
format
public boolean format(int bytesPerLine, int columnSize)Format view tab based on the bytes per line and column.- Specified by:
formatin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Parameters:
bytesPerLine- - number of bytes per line, possible values: (1 / 2 / 4 / 8 / 16 / 32 / 64 / 128) * addressableSizecolumnSize- - number of bytes per column, possible values: (1 / 2 / 4 / 8 / 16 / 32 / 64 / 128) * addressableSize- Returns:
- true if format is successful, false, otherwise
-
displayTable
public void displayTable()
Displays the content of the table viewer.
-
displayError
public void displayError(DebugException e)
Displays an error message for the given exception.- Parameters:
e- exception to display
-
isDisplayingError
public boolean isDisplayingError()
Returns whether the error page is displayed.- Returns:
- whether the error page is displayed
-
getControl
public Control getControl()
Description copied from interface:IMemoryRenderingReturns the top level control for this rendering.May return
nullif the control has not been created yet.- Specified by:
getControlin interfaceIMemoryRendering- Returns:
- the top level control or
null
-
getAddressableSize
public int getAddressableSize()
Returns the addressable size of this rendering's memory block in bytes.- Specified by:
getAddressableSizein classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Returns:
- the addressable size of this rendering's memory block in bytes
-
resizeColumnsToPreferredSize
public void resizeColumnsToPreferredSize()
Resize column to the preferred size.- Specified by:
resizeColumnsToPreferredSizein classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
-
fillContextMenu
protected void fillContextMenu(IMenuManager menu)
Fills the context menu for this rendering- Parameters:
menu- menu to fill
-
getAddressableUnitPerLine
public int getAddressableUnitPerLine()
Returns the number of addressable units per row.- Specified by:
getAddressableUnitPerLinein classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Returns:
- number of addressable units per row
-
getAddressableUnitPerColumn
public int getAddressableUnitPerColumn()
Returns the number of addressable units per column.- Specified by:
getAddressableUnitPerColumnin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Returns:
- number of addressable units per column
-
getBytesPerColumn
public int getBytesPerColumn()
Returns the number of bytes displayed in a single column cell.- Specified by:
getBytesPerColumnin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Returns:
- the number of bytes displayed in a single column cell
-
getBytesPerLine
public int getBytesPerLine()
Returns the number of bytes displayed in a row.- Specified by:
getBytesPerLinein classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Returns:
- the number of bytes displayed in a row
-
updateLabels
public void updateLabels()
Updates labels of this rendering.- Specified by:
updateLabelsin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
-
getLabel
public String getLabel()
Description copied from interface:IMemoryRenderingReturns a label for this rendering.- Specified by:
getLabelin interfaceIMemoryRendering- Specified by:
getLabelin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Returns:
- the label of this rendering
-
updateRenderingLabel
protected void updateRenderingLabel(boolean showAddress)
Updates the label of this rendering, optionally displaying the base address of this rendering's memory block.- Parameters:
showAddress- whether to display the base address of this rendering's memory block in this rendering's label
-
refresh
public void refresh()
Refresh the table viewer with the current top visible address. Update labels in the memory rendering.- Specified by:
refreshin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
-
getTableViewer
public TableViewer getTableViewer()
Returns this rendering's table viewer.- Returns:
- the
TableViewer
-
dispose
public void dispose()
Description copied from interface:IMemoryRenderingDisposes this rendering.- Specified by:
disposein interfaceIMemoryRendering- Overrides:
disposein classAbstractMemoryRendering
-
goToAddress
public void goToAddress(BigInteger address) throws DebugException
Moves the cursor to the specified address. Will load more memory if the address is not currently visible.- Specified by:
goToAddressin interfaceIRepositionableMemoryRendering- Specified by:
goToAddressin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Parameters:
address- address to position cursor at- Throws:
DebugException- if an exception occurs
-
createActions
protected void createActions()
Create actions for this rendering
-
becomesHidden
public void becomesHidden()
Description copied from interface:IMemoryRenderingNotification this rendering has become hidden in its container.- Specified by:
becomesHiddenin interfaceIMemoryRendering- Overrides:
becomesHiddenin classAbstractMemoryRendering
-
becomesVisible
public void becomesVisible()
Description copied from interface:IMemoryRenderingNotification this rendering has become visible in its container. Note that a rendering does not have to be active to be visible.- Specified by:
becomesVisiblein interfaceIMemoryRendering- Overrides:
becomesVisiblein classAbstractMemoryRendering
-
reset
@Deprecated public void reset()
Deprecated.useresetRenderingto reset this rendering.Resets this memory rendering. The cursor will be moved to the base address of the memory block. The table will be positioned to have the base address at the top.
-
getSelectedAddress
public BigInteger getSelectedAddress()
Returns the currently selected address in this rendering.- Specified by:
getSelectedAddressin interfaceIRepositionableMemoryRendering- Specified by:
getSelectedAddressin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Returns:
- the currently selected address in this rendering
-
getSelectedAsString
public String getSelectedAsString()
Returns the currently selected content in this rendering as a String.- Specified by:
getSelectedAsStringin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Returns:
- the currently selected content in this rendering
-
getSelectedAsBytes
public MemoryByte[] getSelectedAsBytes()
Returns the currently selected content in this rendering as MemoryByte.- Specified by:
getSelectedAsBytesin interfaceIRepositionableMemoryRendering- Specified by:
getSelectedAsBytesin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Returns:
- the currently selected content in array of MemoryByte. Returns an empty array if the selected address is out of buffered range.
-
getNumCharsPerByte
public int getNumCharsPerByte()
Returns the number of characters a byte will convert to or -1 if unknown.- Specified by:
getNumCharsPerBytein classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Returns:
- the number of characters a byte will convert to or -1 if unknown
-
getAdapter
public <T> T getAdapter(Class<T> adapter)
Description copied from class:PlatformObjectReturns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.This implementation of the method declared by
IAdaptablepasses the request along to the platform's adapter manager; roughlyPlatform.getAdapterManager().getAdapter(this, adapter). Subclasses may override this method (however, if they do so, they should invoke the method on their superclass to ensure that the Platform's adapter manager is consulted).- Specified by:
getAdapterin interfaceIAdaptable- Overrides:
getAdapterin classPlatformObject- Type Parameters:
T- the class type- Parameters:
adapter- the class to adapt to- Returns:
- the adapted object or
null - See Also:
IAdaptable.getAdapter(Class)
-
getColorProviderAdapter
protected IColorProvider getColorProviderAdapter()
Returns the color provider for this rendering's memory block ornullif none.By default a color provider is obtained by asking this rendering's memory block for its
IColorProvideradapter. When the color provider is queried for color information, it is provided with aMemoryRenderingElementas an argument.- Returns:
- the color provider for this rendering's memory block,
or
null
-
getLabelProviderAdapter
protected ILabelProvider getLabelProviderAdapter()
Returns the label provider for this rendering's memory block ornullif none.By default a label provider is obtained by asking this rendering's memory block for its
ILabelProvideradapter. When the label provider is queried for label information, it is provided with aMemoryRenderingElementas an argument.- Returns:
- the label provider for this rendering's memory block,
or
null
-
getFontProviderAdapter
protected IFontProvider getFontProviderAdapter()
Returns the font provider for this rendering's memory block ornullif none.By default a font provider is obtained by asking this rendering's memory block for its
IFontProvideradapter. When the font provider is queried for font information, it is provided with aMemoryRenderingElementas an argument.- Returns:
- the font provider for this rendering's memory block,
or
null
-
getTablePresentationAdapter
protected IMemoryBlockTablePresentation getTablePresentationAdapter()
Returns the table presentation for this rendering's memory block ornullif none.By default a table presentation is obtained by asking this rendering's memory block for its
IMemoryBlockTablePresentationadapter.- Returns:
- the table presentation for this rendering's memory block,
or
null
-
createToolTipControl
protected Control createToolTipControl(Composite composite)
Creates the control used to display tool tips for cells in this table. By default a label is used to display the address of the cell. Clients may override this method to create custom tooltip controls.Also see the methods
getToolTipText(...)andtoolTipAboutToShow(...).- Parameters:
composite- parent for the tooltip control- Returns:
- the tooltip control to be displayed
- Since:
- 3.2
-
resetRendering
public void resetRendering() throws DebugExceptionDescription copied from interface:IResettableMemoryRenderingReset this memory rendering.- Specified by:
resetRenderingin interfaceIResettableMemoryRendering- Specified by:
resetRenderingin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Throws:
DebugException- when there is a problem resetting this memory rendering.
-
toolTipAboutToShow
protected void toolTipAboutToShow(Control toolTipControl, TableItem item, int col)
Called when the tool tip is about to show in this rendering. Clients who overridescreateTooltipControlmay need to also override this method to ensure that the tooltip shows up properly in their customized control.By default a text tooltip is displayed, and the contents for the tooltip are generated by the
getToolTipText(...)method.- Parameters:
toolTipControl- - the control for displaying the tooltipitem- - the table item where the mouse is pointing.col- - the column at which the mouse is pointing.- Since:
- 3.2
-
getToolTipText
protected String getToolTipText(BigInteger address, MemoryByte[] bytes)
Returns the text to display in a tool tip at the specified address for the specified bytes. By default the address of the bytes is displayed. Subclasses may override.- Parameters:
address- address of cell that tool tip is displayed forbytes- the bytes in the cell- Returns:
- the tooltip text for the memory bytes located at the specified address
- Since:
- 3.2
-
getString
public abstract String getString(String renderingTypeId, BigInteger address, MemoryByte[] data)
Returns text for the given memory bytes at the specified address for the specified rendering type. This is called by the label provider for. Subclasses must override.- Specified by:
getStringin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Parameters:
renderingTypeId- rendering type identifieraddress- address where the bytes belong todata- the bytes- Returns:
- a string to represent the memory. Cannot not return
null. Returns a string to pad the cell if the memory cannot be converted successfully.
-
getBytes
public abstract byte[] getBytes(String renderingTypeId, BigInteger address, MemoryByte[] currentValues, String newValue)
Returns bytes for the given text corresponding to bytes at the given address for the specified rendering type. This is called by the cell modifier when modifying bytes in a memory block. Subclasses must convert the string value to an array of bytes. The bytes will be passed to the debug adapter for memory block modification. Returnsnullif the bytes cannot be formatted properly.- Specified by:
getBytesin classorg.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering- Parameters:
renderingTypeId- rendering type identifieraddress- address the bytes begin atcurrentValues- current values of the data in bytes formatnewValue- the string to be converted to bytes- Returns:
- the bytes converted from a string
-
-