mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
[200853] Enhancements focused on inheritance
This commit is contained in:
parent
87ab767fb7
commit
a89f437145
5 changed files with 182 additions and 122 deletions
|
@ -49,9 +49,9 @@ public abstract class AbstractPane extends Canvas
|
||||||
// caret
|
// caret
|
||||||
protected Caret fCaret = null;
|
protected Caret fCaret = null;
|
||||||
|
|
||||||
protected int fSubCellCaretPosition = 0; // character may not fall on
|
// character may not fall on byte boundary
|
||||||
|
protected int fSubCellCaretPosition = 0;
|
||||||
// byte boundary
|
protected int fOldSubCellCaretPosition = 0;
|
||||||
|
|
||||||
protected boolean fCaretEnabled = false;
|
protected boolean fCaretEnabled = false;
|
||||||
|
|
||||||
|
@ -185,6 +185,7 @@ public abstract class AbstractPane extends Canvas
|
||||||
{
|
{
|
||||||
public void keyPressed(KeyEvent ke)
|
public void keyPressed(KeyEvent ke)
|
||||||
{
|
{
|
||||||
|
fOldSubCellCaretPosition = fSubCellCaretPosition;
|
||||||
if((ke.stateMask & SWT.SHIFT) != 0)
|
if((ke.stateMask & SWT.SHIFT) != 0)
|
||||||
{
|
{
|
||||||
switch(ke.keyCode)
|
switch(ke.keyCode)
|
||||||
|
|
|
@ -229,7 +229,8 @@ public class AddressPane extends AbstractPane
|
||||||
gc.fillRectangle(fRendering.getCellPadding() * 2,
|
gc.fillRectangle(fRendering.getCellPadding() * 2,
|
||||||
cellHeight * i, getCellWidth(), cellHeight);
|
cellHeight * i, getCellWidth(), cellHeight);
|
||||||
|
|
||||||
gc.setForeground(fRendering.getTraditionalRendering().getColorText());
|
// Allow subclass to override this method to do its own coloring
|
||||||
|
applyCustomColor(gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
gc.drawText(fRendering.getAddressString(lineAddress),
|
gc.drawText(fRendering.getAddressString(lineAddress),
|
||||||
|
@ -244,4 +245,9 @@ public class AddressPane extends AbstractPane
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow subclass to override this method to do its own coloring
|
||||||
|
protected void applyCustomColor(GC gc)
|
||||||
|
{
|
||||||
|
gc.setForeground(fRendering.getTraditionalRendering().getColorText());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,6 +239,14 @@ public class DataPane extends AbstractPane
|
||||||
{
|
{
|
||||||
super.paint(pe);
|
super.paint(pe);
|
||||||
|
|
||||||
|
// Allow subclasses to override this method to do their own painting
|
||||||
|
doPaintData(pe);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow subclasses to override this method to do their own painting
|
||||||
|
protected void doPaintData(PaintEvent pe)
|
||||||
|
{
|
||||||
GC gc = pe.gc;
|
GC gc = pe.gc;
|
||||||
gc.setFont(fRendering.getFont());
|
gc.setFont(fRendering.getFont());
|
||||||
|
|
||||||
|
@ -283,29 +291,9 @@ public class DataPane extends AbstractPane
|
||||||
+ fRendering.getCellPadding(), cellHeight * i,
|
+ fRendering.getCellPadding(), cellHeight * i,
|
||||||
cellWidth, cellHeight);
|
cellWidth, cellHeight);
|
||||||
|
|
||||||
// TODO consider adding finer granularity?
|
// Allow subclasses to override this method to do their own coloring
|
||||||
boolean anyByteChanged = false;
|
applyCustomColor(gc, bytes, col);
|
||||||
for(int n = 0; n < bytes.length && !anyByteChanged; n++)
|
|
||||||
if(bytes[n].isChanged())
|
|
||||||
anyByteChanged = true;
|
|
||||||
|
|
||||||
// TODO consider adding finer granularity?
|
|
||||||
boolean anyByteEditing = false;
|
|
||||||
for(int n = 0; n < bytes.length && !anyByteEditing; n++)
|
|
||||||
if(bytes[n] instanceof TraditionalMemoryByte)
|
|
||||||
if(((TraditionalMemoryByte) bytes[n]).isEdited())
|
|
||||||
anyByteEditing = true;
|
|
||||||
|
|
||||||
if(anyByteEditing)
|
|
||||||
gc.setForeground(fRendering.getTraditionalRendering().getColorEdit());
|
|
||||||
else if(anyByteChanged)
|
|
||||||
gc.setForeground(fRendering.getTraditionalRendering().getColorChanged());
|
|
||||||
else if(isOdd(col))
|
|
||||||
gc.setForeground(fRendering.getTraditionalRendering().getColorText());
|
|
||||||
else
|
|
||||||
gc.setForeground(fRendering.getTraditionalRendering().getColorTextAlternate());
|
|
||||||
|
|
||||||
gc.setBackground(fRendering.getTraditionalRendering().getColorBackground());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gc.drawText(getCellText(bytes), cellWidth * col
|
gc.drawText(getCellText(bytes), cellWidth * col
|
||||||
|
@ -348,4 +336,32 @@ public class DataPane extends AbstractPane
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow subclasses to override this method to do their own coloring
|
||||||
|
protected void applyCustomColor(GC gc, MemoryByte bytes[], int col)
|
||||||
|
{
|
||||||
|
// TODO consider adding finer granularity?
|
||||||
|
boolean anyByteChanged = false;
|
||||||
|
for(int n = 0; n < bytes.length && !anyByteChanged; n++)
|
||||||
|
if(bytes[n].isChanged())
|
||||||
|
anyByteChanged = true;
|
||||||
|
|
||||||
|
// TODO consider adding finer granularity?
|
||||||
|
boolean anyByteEditing = false;
|
||||||
|
for(int n = 0; n < bytes.length && !anyByteEditing; n++)
|
||||||
|
if(bytes[n] instanceof TraditionalMemoryByte)
|
||||||
|
if(((TraditionalMemoryByte) bytes[n]).isEdited())
|
||||||
|
anyByteEditing = true;
|
||||||
|
|
||||||
|
if(anyByteEditing)
|
||||||
|
gc.setForeground(fRendering.getTraditionalRendering().getColorEdit());
|
||||||
|
else if(anyByteChanged)
|
||||||
|
gc.setForeground(fRendering.getTraditionalRendering().getColorChanged());
|
||||||
|
else if(isOdd(col))
|
||||||
|
gc.setForeground(fRendering.getTraditionalRendering().getColorText());
|
||||||
|
else
|
||||||
|
gc.setForeground(fRendering.getTraditionalRendering().getColorTextAlternate());
|
||||||
|
|
||||||
|
gc.setBackground(fRendering.getTraditionalRendering().getColorBackground());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
BigInteger fMemoryBlockStartAddress = null;
|
BigInteger fMemoryBlockStartAddress = null;
|
||||||
BigInteger fMemoryBlockEndAddress = null;
|
BigInteger fMemoryBlockEndAddress = null;
|
||||||
|
|
||||||
BigInteger fBaseAddress = null; // remember the base address
|
protected BigInteger fBaseAddress = null; // remember the base address
|
||||||
|
|
||||||
private int fColumnCount = 0; // auto calculate can be disabled by user,
|
private int fColumnCount = 0; // auto calculate can be disabled by user,
|
||||||
// making this user settable
|
// making this user settable
|
||||||
|
@ -108,31 +108,31 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
private boolean fIsDisplayLittleEndian = false;
|
private boolean fIsDisplayLittleEndian = false;
|
||||||
|
|
||||||
// constants used to identify radix
|
// constants used to identify radix
|
||||||
protected final static int RADIX_HEX = 1;
|
public final static int RADIX_HEX = 1;
|
||||||
|
|
||||||
protected final static int RADIX_DECIMAL_SIGNED = 2;
|
public final static int RADIX_DECIMAL_SIGNED = 2;
|
||||||
|
|
||||||
protected final static int RADIX_DECIMAL_UNSIGNED = 3;
|
public final static int RADIX_DECIMAL_UNSIGNED = 3;
|
||||||
|
|
||||||
protected final static int RADIX_OCTAL = 4;
|
public final static int RADIX_OCTAL = 4;
|
||||||
|
|
||||||
protected final static int RADIX_BINARY = 5;
|
public final static int RADIX_BINARY = 5;
|
||||||
|
|
||||||
// constants used to identify panes
|
// constants used to identify panes
|
||||||
protected final static int PANE_ADDRESS = 1;
|
public final static int PANE_ADDRESS = 1;
|
||||||
|
|
||||||
protected final static int PANE_BINARY = 2;
|
public final static int PANE_BINARY = 2;
|
||||||
|
|
||||||
protected final static int PANE_TEXT = 3;
|
public final static int PANE_TEXT = 3;
|
||||||
|
|
||||||
// constants used to identify text, maybe java should be queried for all available sets
|
// constants used to identify text, maybe java should be queried for all available sets
|
||||||
protected final static int TEXT_ISO_8859_1 = 1;
|
public final static int TEXT_ISO_8859_1 = 1;
|
||||||
protected final static int TEXT_USASCII = 2;
|
public final static int TEXT_USASCII = 2;
|
||||||
protected final static int TEXT_UTF8 = 3;
|
public final static int TEXT_UTF8 = 3;
|
||||||
protected final static int TEXT_UTF16 = 4;
|
protected final static int TEXT_UTF16 = 4;
|
||||||
|
|
||||||
// internal constants
|
// internal constants
|
||||||
protected final static int COLUMNS_AUTO_SIZE_TO_FIT = 0;
|
public final static int COLUMNS_AUTO_SIZE_TO_FIT = 0;
|
||||||
|
|
||||||
// view internal settings
|
// view internal settings
|
||||||
private int fCellPadding = 2;
|
private int fCellPadding = 2;
|
||||||
|
@ -166,9 +166,9 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
|
|
||||||
// instantiate the panes, TODO default visibility from state or
|
// instantiate the panes, TODO default visibility from state or
|
||||||
// plugin.xml?
|
// plugin.xml?
|
||||||
this.fAddressPane = new AddressPane(this);
|
this.fAddressPane = createAddressPane();
|
||||||
this.fBinaryPane = new DataPane(this);
|
this.fBinaryPane = createDataPane();
|
||||||
this.fTextPane = new TextPane(this);
|
this.fTextPane = createTextPane();
|
||||||
|
|
||||||
fAddressBar = new GoToAddressComposite();
|
fAddressBar = new GoToAddressComposite();
|
||||||
fAddressBarControl = fAddressBar.createControl(parent);
|
fAddressBarControl = fAddressBar.createControl(parent);
|
||||||
|
@ -398,7 +398,22 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
DebugPlugin.getDefault().addDebugEventListener(this);
|
DebugPlugin.getDefault().addDebugEventListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TraditionalRendering getTraditionalRendering() // TODO rename
|
protected AddressPane createAddressPane()
|
||||||
|
{
|
||||||
|
return new AddressPane(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DataPane createDataPane()
|
||||||
|
{
|
||||||
|
return new DataPane(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected TextPane createTextPane()
|
||||||
|
{
|
||||||
|
return new TextPane(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TraditionalRendering getTraditionalRendering() // TODO rename
|
||||||
{
|
{
|
||||||
return fParent;
|
return fParent;
|
||||||
}
|
}
|
||||||
|
@ -440,12 +455,12 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
setCurrentScrollSelection();
|
setCurrentScrollSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Selection getSelection()
|
public Selection getSelection()
|
||||||
{
|
{
|
||||||
return fSelection;
|
return fSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void logError(String message, Exception e)
|
public void logError(String message, Exception e)
|
||||||
{
|
{
|
||||||
Status status = new Status(IStatus.ERROR, fParent.getRenderingId(),
|
Status status = new Status(IStatus.ERROR, fParent.getRenderingId(),
|
||||||
DebugException.INTERNAL_ERROR, message, e);
|
DebugException.INTERNAL_ERROR, message, e);
|
||||||
|
@ -486,7 +501,26 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
if(source.getDebugTarget() == getMemoryBlock()
|
if(source.getDebugTarget() == getMemoryBlock()
|
||||||
.getDebugTarget())
|
.getDebugTarget())
|
||||||
{
|
{
|
||||||
if(kind == DebugEvent.SUSPEND && detail == 0)
|
if(kind == DebugEvent.SUSPEND)
|
||||||
|
{
|
||||||
|
handleSuspendEvent(detail);
|
||||||
|
}
|
||||||
|
else if(kind == DebugEvent.CHANGE)
|
||||||
|
{
|
||||||
|
handleChangeEvent();
|
||||||
|
}
|
||||||
|
// else if(kind == DebugEvent.RESUME)
|
||||||
|
// {
|
||||||
|
// handleResumeEvent();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleSuspendEvent(int detail)
|
||||||
|
{
|
||||||
|
if(detail == 0)
|
||||||
{
|
{
|
||||||
Display.getDefault().asyncExec(new Runnable()
|
Display.getDefault().asyncExec(new Runnable()
|
||||||
{
|
{
|
||||||
|
@ -497,7 +531,9 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if(kind == DebugEvent.CHANGE)
|
}
|
||||||
|
|
||||||
|
protected void handleChangeEvent()
|
||||||
{
|
{
|
||||||
Display.getDefault().asyncExec(new Runnable()
|
Display.getDefault().asyncExec(new Runnable()
|
||||||
{
|
{
|
||||||
|
@ -507,23 +543,20 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// else if(kind == DebugEvent.RESUME)
|
|
||||||
// {
|
protected void handleResumeEvent()
|
||||||
// Display.getDefault().asyncExec(new Runnable()
|
{
|
||||||
// {
|
Display.getDefault().asyncExec(new Runnable()
|
||||||
// public void run()
|
{
|
||||||
// {
|
public void run()
|
||||||
// //archiveDeltas();
|
{
|
||||||
// }
|
// archiveDeltas();
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// return true to enable development debug print statements
|
// return true to enable development debug print statements
|
||||||
protected boolean isDebug()
|
public boolean isDebug()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -538,7 +571,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BigInteger getBigBaseAddress()
|
public BigInteger getBigBaseAddress()
|
||||||
{
|
{
|
||||||
return fParent.getBigBaseAddress();
|
return fParent.getBigBaseAddress();
|
||||||
}
|
}
|
||||||
|
@ -553,7 +586,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return fViewportCache;
|
return fViewportCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MemoryByte[] getBytes(BigInteger address, int bytes)
|
public MemoryByte[] getBytes(BigInteger address, int bytes)
|
||||||
throws DebugException
|
throws DebugException
|
||||||
{
|
{
|
||||||
return fViewportCache.getBytes(address, bytes);
|
return fViewportCache.getBytes(address, bytes);
|
||||||
|
@ -1183,7 +1216,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setPaneVisible(int pane, boolean visible)
|
public void setPaneVisible(int pane, boolean visible)
|
||||||
{
|
{
|
||||||
switch(pane)
|
switch(pane)
|
||||||
{
|
{
|
||||||
|
@ -1202,7 +1235,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
layoutPanes();
|
layoutPanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean getPaneVisible(int pane)
|
public boolean getPaneVisible(int pane)
|
||||||
{
|
{
|
||||||
switch(pane)
|
switch(pane)
|
||||||
{
|
{
|
||||||
|
@ -1281,13 +1314,13 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
Rendering.this.redrawPanes();
|
Rendering.this.redrawPanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractPane[] getRenderingPanes()
|
public AbstractPane[] getRenderingPanes()
|
||||||
{
|
{
|
||||||
return new AbstractPane[] { fAddressPane, fBinaryPane,
|
return new AbstractPane[] { fAddressPane, fBinaryPane,
|
||||||
fTextPane };
|
fTextPane };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getCellPadding()
|
public int getCellPadding()
|
||||||
{
|
{
|
||||||
return fCellPadding;
|
return fCellPadding;
|
||||||
}
|
}
|
||||||
|
@ -1297,7 +1330,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return fPaneSpacing;
|
return fPaneSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void refresh()
|
public void refresh()
|
||||||
{
|
{
|
||||||
if(!this.isDisposed())
|
if(!this.isDisposed())
|
||||||
{
|
{
|
||||||
|
@ -1318,7 +1351,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
fViewportCache.archiveDeltas();
|
fViewportCache.archiveDeltas();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void gotoAddress(BigInteger address)
|
public void gotoAddress(BigInteger address)
|
||||||
{
|
{
|
||||||
// Ensure that the GoTo address is within the addressable range
|
// Ensure that the GoTo address is within the addressable range
|
||||||
if((address.compareTo(this.getMemoryBlockStartAddress())< 0) ||
|
if((address.compareTo(this.getMemoryBlockStartAddress())< 0) ||
|
||||||
|
@ -1336,17 +1369,17 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
fViewportAddress = newAddress;
|
fViewportAddress = newAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BigInteger getViewportStartAddress()
|
public BigInteger getViewportStartAddress()
|
||||||
{
|
{
|
||||||
return fViewportAddress;
|
return fViewportAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BigInteger getViewportEndAddress()
|
public BigInteger getViewportEndAddress()
|
||||||
{
|
{
|
||||||
return fViewportAddress.add(BigInteger.valueOf(this.getBytesPerRow() * getRowCount() / getAddressableSize()));
|
return fViewportAddress.add(BigInteger.valueOf(this.getBytesPerRow() * getRowCount() / getAddressableSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getAddressString(BigInteger address)
|
public String getAddressString(BigInteger address)
|
||||||
{
|
{
|
||||||
StringBuffer addressString = new StringBuffer(address.toString(16)
|
StringBuffer addressString = new StringBuffer(address.toString(16)
|
||||||
.toUpperCase());
|
.toUpperCase());
|
||||||
|
@ -1364,7 +1397,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return fParent.getAddressSize();
|
return fParent.getAddressSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getColumnCount()
|
public int getColumnCount()
|
||||||
{
|
{
|
||||||
return fColumnCount;
|
return fColumnCount;
|
||||||
}
|
}
|
||||||
|
@ -1410,7 +1443,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return rowCount;
|
return rowCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getBytesPerColumn()
|
public int getBytesPerColumn()
|
||||||
{
|
{
|
||||||
return fBytesPerColumn;
|
return fBytesPerColumn;
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +1458,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return getBytesPerRow() / getAddressableSize();
|
return getBytesPerRow() / getAddressableSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getAddressesPerColumn()
|
public int getAddressesPerColumn()
|
||||||
{
|
{
|
||||||
return this.getBytesPerColumn() / getAddressableSize();
|
return this.getBytesPerColumn() / getAddressableSize();
|
||||||
}
|
}
|
||||||
|
@ -1465,7 +1498,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return fMemoryBlockEndAddress;
|
return fMemoryBlockEndAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getRadix()
|
public int getRadix()
|
||||||
{
|
{
|
||||||
return fRadix;
|
return fRadix;
|
||||||
}
|
}
|
||||||
|
@ -1488,7 +1521,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setRadix(int mode)
|
public void setRadix(int mode)
|
||||||
{
|
{
|
||||||
if(fRadix == mode)
|
if(fRadix == mode)
|
||||||
return;
|
return;
|
||||||
|
@ -1498,7 +1531,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
layoutPanes();
|
layoutPanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setTextMode(int mode)
|
public void setTextMode(int mode)
|
||||||
{
|
{
|
||||||
fTextMode = mode;
|
fTextMode = mode;
|
||||||
|
|
||||||
|
@ -1506,7 +1539,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
layoutPanes();
|
layoutPanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getTextMode()
|
public int getTextMode()
|
||||||
{
|
{
|
||||||
return fTextMode;
|
return fTextMode;
|
||||||
}
|
}
|
||||||
|
@ -1527,7 +1560,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getBytesPerCharacter()
|
public int getBytesPerCharacter()
|
||||||
{
|
{
|
||||||
if(fTextMode == Rendering.TEXT_UTF16)
|
if(fTextMode == Rendering.TEXT_UTF16)
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -1535,12 +1568,12 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isTargetLittleEndian()
|
public boolean isTargetLittleEndian()
|
||||||
{
|
{
|
||||||
return fIsTargetLittleEndian;
|
return fIsTargetLittleEndian;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setTargetLittleEndian(boolean littleEndian)
|
public void setTargetLittleEndian(boolean littleEndian)
|
||||||
{
|
{
|
||||||
if(fIsTargetLittleEndian == littleEndian)
|
if(fIsTargetLittleEndian == littleEndian)
|
||||||
return;
|
return;
|
||||||
|
@ -1572,7 +1605,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
layoutPanes();
|
layoutPanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setBytesPerColumn(int byteCount)
|
public void setBytesPerColumn(int byteCount)
|
||||||
{
|
{
|
||||||
if(fBytesPerColumn != byteCount)
|
if(fBytesPerColumn != byteCount)
|
||||||
{
|
{
|
||||||
|
@ -1655,7 +1688,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
static final char[] hexdigits = { '0', '1', '2', '3', '4', '5', '6', '7',
|
static final char[] hexdigits = { '0', '1', '2', '3', '4', '5', '6', '7',
|
||||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||||
|
|
||||||
protected String getRadixText(MemoryByte bytes[], int radix,
|
public String getRadixText(MemoryByte bytes[], int radix,
|
||||||
boolean isLittleEndian)
|
boolean isLittleEndian)
|
||||||
{
|
{
|
||||||
boolean readable = true;
|
boolean readable = true;
|
||||||
|
@ -1800,7 +1833,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
return errorText.toString();
|
return errorText.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getRadixCharacterCount(int radix, int bytes)
|
public int getRadixCharacterCount(int radix, int bytes)
|
||||||
{
|
{
|
||||||
switch(radix)
|
switch(radix)
|
||||||
{
|
{
|
||||||
|
@ -1863,7 +1896,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
|| character == ' ';
|
|| character == ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String formatText(MemoryByte[] memoryBytes,
|
public String formatText(MemoryByte[] memoryBytes,
|
||||||
boolean isLittleEndian, int textMode)
|
boolean isLittleEndian, int textMode)
|
||||||
{
|
{
|
||||||
// check memory byte for unreadable bytes
|
// check memory byte for unreadable bytes
|
||||||
|
|
|
@ -259,6 +259,30 @@ public class TextPane extends AbstractPane
|
||||||
gc.fillRectangle(cellWidth * col, cellHeight * i,
|
gc.fillRectangle(cellWidth * col, cellHeight * i,
|
||||||
cellWidth, cellHeight);
|
cellWidth, cellHeight);
|
||||||
|
|
||||||
|
applyCustomColor(gc, bytes, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
gc.drawText(fRendering.formatText(bytes,
|
||||||
|
isLittleEndian, fRendering.getTextMode()), cellWidth * col, cellHeight * i
|
||||||
|
+ fRendering.getCellPadding());
|
||||||
|
|
||||||
|
if(fRendering.isDebug())
|
||||||
|
gc.drawRectangle(cellWidth * col, cellHeight * i
|
||||||
|
+ fRendering.getCellPadding(), cellWidth,
|
||||||
|
cellHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
fRendering.logError(TraditionalRenderingMessages
|
||||||
|
.getString("TraditionalRendering.FAILURE_PAINT"), e); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void applyCustomColor(GC gc, MemoryByte bytes[], int col)
|
||||||
|
{
|
||||||
// TODO reuse, this could be in the abstract base
|
// TODO reuse, this could be in the abstract base
|
||||||
// TODO consider adding finer granularity?
|
// TODO consider adding finer granularity?
|
||||||
boolean anyByteChanged = false;
|
boolean anyByteChanged = false;
|
||||||
|
@ -284,24 +308,4 @@ public class TextPane extends AbstractPane
|
||||||
|
|
||||||
gc.setBackground(fRendering.getTraditionalRendering().getColorBackground());
|
gc.setBackground(fRendering.getTraditionalRendering().getColorBackground());
|
||||||
}
|
}
|
||||||
|
|
||||||
gc.drawText(fRendering.formatText(bytes,
|
|
||||||
isLittleEndian, fRendering.getTextMode()), cellWidth * col, cellHeight * i
|
|
||||||
+ fRendering.getCellPadding());
|
|
||||||
|
|
||||||
if(fRendering.isDebug())
|
|
||||||
gc.drawRectangle(cellWidth * col, cellHeight * i
|
|
||||||
+ fRendering.getCellPadding(), cellWidth,
|
|
||||||
cellHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
fRendering.logError(TraditionalRenderingMessages
|
|
||||||
.getString("TraditionalRendering.FAILURE_PAINT"), e); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue