public abstract class AbstractTableRendering extends org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering implements IPropertyChangeListener, IResettableMemoryRendering
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.
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_COL_SIZE
Property identifier for the column size in a table rendering
This property is used for synchronization between renderings.
|
static String |
PROPERTY_ROW_SIZE
Property identifier for the row size in a table rendering
This property is used for synchronization between renderings.
|
static String |
PROPERTY_SELECTED_ADDRESS
Property identifier for the selected address in a table rendering
This property is used for synchronization between renderings.
|
static String |
PROPERTY_TOP_ADDRESS
Property identifier for the top row address in a table rendering.
|
Constructor and Description |
---|
AbstractTableRendering(String renderingId)
Constructs a new table rendering of the specified type.
|
Modifier and Type | Method and Description |
---|---|
void |
becomesHidden()
Notification this rendering has become hidden in its container.
|
void |
becomesVisible()
Notification this rendering has become visible in its container.
|
protected void |
createActions()
Create actions for this rendering
|
Control |
createControl(Composite parent)
Creates the top level control for this rendering under the given parent composite.
|
protected Control |
createToolTipControl(Composite composite)
Creates the control used to display tool tips for cells in this table.
|
void |
displayError(DebugException e)
Displays an error message for the given exception.
|
void |
displayTable()
Displays the content of the table viewer.
|
void |
dispose()
Disposes this rendering.
|
protected void |
fillContextMenu(IMenuManager menu)
Fills the context menu for this rendering
|
boolean |
format(int bytesPerLine,
int columnSize)
Format view tab based on the bytes per line and column.
|
Object |
getAdapter(Class adapter)
Returns an object which is an instance of the given class
associated with this object.
|
int |
getAddressableSize()
Returns the addressable size of this rendering's memory block in bytes.
|
int |
getAddressableUnitPerColumn()
Returns the number of addressable units per column.
|
int |
getAddressableUnitPerLine()
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.
|
int |
getBytesPerColumn()
Returns the number of bytes displayed in a single column cell.
|
int |
getBytesPerLine()
Returns the number of bytes displayed in a row.
|
protected IColorProvider |
getColorProviderAdapter()
Returns the color provider for this rendering's memory block or
null if none. |
Control |
getControl()
Returns the top level control for this rendering.
|
protected IFontProvider |
getFontProviderAdapter()
Returns the font provider for this rendering's memory block or
null if none. |
String |
getLabel()
Returns a label for this rendering.
|
protected ILabelProvider |
getLabelProviderAdapter()
Returns the label provider for this rendering's memory block or
null if none. |
int |
getNumCharsPerByte()
Returns the number of characters a byte will convert to
or -1 if unknown.
|
BigInteger |
getSelectedAddress()
Returns the currently selected address in this rendering.
|
MemoryByte[] |
getSelectedAsBytes()
Returns the currently selected content in this rendering as MemoryByte.
|
String |
getSelectedAsString()
Returns the currently selected content in this rendering as a String.
|
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.
|
protected IMemoryBlockTablePresentation |
getTablePresentationAdapter()
Returns the table presentation for this rendering's memory block or
null if none. |
TableViewer |
getTableViewer()
Returns this rendering's table viewer.
|
protected String |
getToolTipText(BigInteger address,
MemoryByte[] bytes)
Returns the text to display in a tool tip at the specified address
for the specified bytes.
|
void |
goToAddress(BigInteger address)
Moves the cursor to the specified address.
|
boolean |
isDisplayingError()
Returns whether the error page is displayed.
|
void |
propertyChange(PropertyChangeEvent event)
Notification that a property has changed.
|
void |
refresh()
Refresh the table viewer with the current top visible address.
|
void |
reset()
Deprecated.
use
resetRendering to reset this rendering. |
void |
resetRendering()
Reset this memory rendering.
|
void |
resizeColumnsToPreferredSize()
Resize column to the preferred size.
|
protected void |
toolTipAboutToShow(Control toolTipControl,
TableItem item,
int col)
Called when the tool tip is about to show in this rendering.
|
void |
updateLabels()
Updates labels of this rendering.
|
protected void |
updateRenderingLabel(boolean showAddress)
Updates the label of this rendering, optionally displaying the
base address of this rendering's memory block.
|
activated, addPropertyChangeListener, createPopupMenu, deactivated, decorateImage, decorateLabel, firePropertyChangedEvent, getImage, getMemoryBlock, getMemoryRenderingContainer, getPopupMenuManager, getRenderingId, init, isVisible, removePropertyChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
activated, addPropertyChangeListener, deactivated, getImage, getMemoryBlock, getRenderingId, init, removePropertyChangeListener
public static final String PROPERTY_SELECTED_ADDRESS
public static final String PROPERTY_COL_SIZE
public static final String PROPERTY_TOP_ADDRESS
public static final String PROPERTY_ROW_SIZE
public AbstractTableRendering(String renderingId)
renderingId
- memory rendering type identifierpublic void propertyChange(PropertyChangeEvent event)
IPropertyChangeListener
This method gets called when the observed object fires a property change event.
propertyChange
in interface IPropertyChangeListener
event
- the property change event object describing which property
changed and howpublic Control createControl(Composite parent)
IMemoryRendering
init
method has been
called.
Implementors are responsible for ensuring that
the created control can be accessed via getControl
createControl
in interface IMemoryRendering
parent
- the parent compositepublic boolean format(int bytesPerLine, int columnSize)
format
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
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) * addressableSizepublic void displayTable()
public void displayError(DebugException e)
e
- exception to displaypublic boolean isDisplayingError()
public Control getControl()
IMemoryRendering
May return null
if the control
has not been created yet.
getControl
in interface IMemoryRendering
null
public int getAddressableSize()
getAddressableSize
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public void resizeColumnsToPreferredSize()
resizeColumnsToPreferredSize
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
protected void fillContextMenu(IMenuManager menu)
menu
- menu to fillpublic int getAddressableUnitPerLine()
getAddressableUnitPerLine
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public int getAddressableUnitPerColumn()
getAddressableUnitPerColumn
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public int getBytesPerColumn()
getBytesPerColumn
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public int getBytesPerLine()
getBytesPerLine
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public void updateLabels()
updateLabels
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public String getLabel()
IMemoryRendering
getLabel
in interface IMemoryRendering
getLabel
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
protected void updateRenderingLabel(boolean showAddress)
showAddress
- whether to display the base address of this
rendering's memory block in this rendering's labelpublic void refresh()
refresh
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public TableViewer getTableViewer()
TableViewer
public void dispose()
IMemoryRendering
dispose
in interface IMemoryRendering
dispose
in class AbstractMemoryRendering
public void goToAddress(BigInteger address) throws DebugException
goToAddress
in interface IRepositionableMemoryRendering
goToAddress
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
address
- address to position cursor atDebugException
- if an exception occursprotected void createActions()
public void becomesHidden()
IMemoryRendering
becomesHidden
in interface IMemoryRendering
becomesHidden
in class AbstractMemoryRendering
public void becomesVisible()
IMemoryRendering
becomesVisible
in interface IMemoryRendering
becomesVisible
in class AbstractMemoryRendering
@Deprecated public void reset()
resetRendering
to reset this rendering.public BigInteger getSelectedAddress()
getSelectedAddress
in interface IRepositionableMemoryRendering
getSelectedAddress
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public String getSelectedAsString()
getSelectedAsString
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public MemoryByte[] getSelectedAsBytes()
getSelectedAsBytes
in interface IRepositionableMemoryRendering
getSelectedAsBytes
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public int getNumCharsPerByte()
getNumCharsPerByte
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
public Object getAdapter(Class adapter)
PlatformObject
null
if
no such object can be found.
This implementation of the method declared by IAdaptable
passes the request along to the platform's adapter manager; roughly
Platform.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).
getAdapter
in interface IAdaptable
getAdapter
in class PlatformObject
adapter
- the class to adapt tonull
IAdaptable.getAdapter(Class)
protected IColorProvider getColorProviderAdapter()
null
if none.
By default a color provider is obtained by asking this rendering's
memory block for its IColorProvider
adapter. When the color
provider is queried for color information, it is provided with a
MemoryRenderingElement
as an argument.
null
protected ILabelProvider getLabelProviderAdapter()
null
if none.
By default a label provider is obtained by asking this rendering's
memory block for its ILabelProvider
adapter. When the label
provider is queried for label information, it is provided with a
MemoryRenderingElement
as an argument.
null
protected IFontProvider getFontProviderAdapter()
null
if none.
By default a font provider is obtained by asking this rendering's
memory block for its IFontProvider
adapter. When the font
provider is queried for font information, it is provided with a
MemoryRenderingElement
as an argument.
null
protected IMemoryBlockTablePresentation getTablePresentationAdapter()
null
if none.
By default a table presentation is obtained by asking this rendering's
memory block for its IMemoryBlockTablePresentation
adapter.
null
protected Control createToolTipControl(Composite composite)
Also see the methods getToolTipText(...)
and
toolTipAboutToShow(...)
.
composite
- parent for the tooltip controlpublic void resetRendering() throws DebugException
IResettableMemoryRendering
resetRendering
in interface IResettableMemoryRendering
resetRendering
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
DebugException
- when there is a problem resetting this memory rendering.protected void toolTipAboutToShow(Control toolTipControl, TableItem item, int col)
createTooltipControl
may 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.
toolTipControl
- - the control for displaying the tooltipitem
- - the table item where the mouse is pointing.col
- - the column at which the mouse is pointing.protected String getToolTipText(BigInteger address, MemoryByte[] bytes)
address
- address of cell that tool tip is displayed forbytes
- the bytes in the cellpublic abstract String getString(String renderingTypeId, BigInteger address, MemoryByte[] data)
getString
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
renderingTypeId
- rendering type identifieraddress
- address where the bytes belong todata
- the bytesnull
.
Returns a string to pad the cell if the memory cannot be converted
successfully.public abstract byte[] getBytes(String renderingTypeId, BigInteger address, MemoryByte[] currentValues, String newValue)
null
if the bytes cannot be formatted properly.getBytes
in class org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering
renderingTypeId
- rendering type identifieraddress
- address the bytes begin atcurrentValues
- current values of the data in bytes formatnewValue
- the string to be converted to bytes
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.