1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 15:15:25 +02:00

Bug 398329 : MemoryBrowser - switching between debuggees does not update the provider for browser operations like Import and Export

Bug 398332 : The validation logic and feedback for all of the Importers/Exporters is very bad

   I found some more editing edge cases as well as an NPE on starting a
   new connection with the Browser up, which was the result of a previous
   edit.
This commit is contained in:
Randy Rohrbach 2013-01-18 16:59:30 -05:00
parent 8aaf87fc8a
commit d51e079951
4 changed files with 220 additions and 14 deletions

View file

@ -995,7 +995,9 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
if(tabFolder != null) {
fStackLayout.topControl = tabFolder;
CTabItem tabItem = (CTabItem) tabFolder.getSelection();
getSite().getSelectionProvider().setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING)));
if ( tabItem != null ) {
getSite().getSelectionProvider().setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING)));
}
handleTabActivated(tabItem);
}
else {

View file

@ -159,11 +159,41 @@ public class PlainTextExporter implements IMemoryExporter {
textValue = fProperties.get(TRANSFER_START);
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
try
{
getStartAddress();
}
catch(Exception e)
{
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
textValue = fProperties.get(TRANSFER_END);
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
try
{
getEndAddress();
}
catch(Exception e)
{
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
try
{
BigInteger length = getEndAddress().subtract(getStartAddress());
fLengthText.setText(length.toString());
if(length.compareTo(BigInteger.ZERO) <= 0) {
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception e)
{
fLengthText.setText("0");
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
fileButton.addSelectionListener(new SelectionAdapter() {
@ -195,13 +225,25 @@ public class PlainTextExporter implements IMemoryExporter {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
BigInteger startAddress = getStartAddress();
BigInteger actualLength = getEndAddress().subtract(startAddress);
fLengthText.setText(actualLength.toString());
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
BigInteger endAddress = getEndAddress();
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception ex)
{
@ -230,6 +272,18 @@ public class PlainTextExporter implements IMemoryExporter {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
BigInteger startAddress = getStartAddress();
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
BigInteger endAddress = getEndAddress();
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception ex)
{
@ -252,15 +306,39 @@ public class PlainTextExporter implements IMemoryExporter {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
BigInteger length = getLength();
String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$
fStartText.setText(fStartText.getText().trim());
BigInteger length = getLength();
String endString;
BigInteger startAddress = getStartAddress();
BigInteger endAddress = startAddress.add(length);
if(length.compareTo(BigInteger.ZERO) <= 0) {
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
endString = endAddress.toString(16); //$NON-NLS-1$
}
else {
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
}
}
else {
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
}
fEndText.setText(endString);
if(length.compareTo(BigInteger.ZERO) <= 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception ex)
{

View file

@ -158,11 +158,41 @@ public class RAWBinaryExporter implements IMemoryExporter
textValue = fProperties.get(TRANSFER_START);
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
try
{
getStartAddress();
}
catch(Exception e)
{
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
textValue = fProperties.get(TRANSFER_END);
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
try
{
getEndAddress();
}
catch(Exception e)
{
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
try
{
BigInteger length = getEndAddress().subtract(getStartAddress());
fLengthText.setText(length.toString());
if(length.compareTo(BigInteger.ZERO) <= 0) {
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception e)
{
fLengthText.setText("0");
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
fileButton.addSelectionListener(new SelectionListener() {
@ -196,13 +226,25 @@ public class RAWBinaryExporter implements IMemoryExporter
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
BigInteger startAddress = getStartAddress();
BigInteger actualLength = getEndAddress().subtract(startAddress);
fLengthText.setText(actualLength.toString());
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
BigInteger endAddress = getEndAddress();
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception ex)
{
@ -231,6 +273,18 @@ public class RAWBinaryExporter implements IMemoryExporter
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
BigInteger startAddress = getStartAddress();
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
BigInteger endAddress = getEndAddress();
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception ex)
{
@ -253,15 +307,39 @@ public class RAWBinaryExporter implements IMemoryExporter
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
BigInteger length = getLength();
String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$
fStartText.setText(fStartText.getText().trim());
BigInteger length = getLength();
String endString;
BigInteger startAddress = getStartAddress();
BigInteger endAddress = startAddress.add(length);
if(length.compareTo(BigInteger.ZERO) <= 0) {
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
endString = endAddress.toString(16); //$NON-NLS-1$
}
else {
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
}
}
else {
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
}
fEndText.setText(endString);
if(length.compareTo(BigInteger.ZERO) <= 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception ex)
{

View file

@ -249,13 +249,25 @@ public class SRecordExporter implements IMemoryExporter
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
BigInteger startAddress = getStartAddress();
BigInteger actualLength = getEndAddress().subtract(startAddress);
fLengthText.setText(actualLength.toString());
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
BigInteger endAddress = getEndAddress();
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception ex)
{
@ -284,6 +296,18 @@ public class SRecordExporter implements IMemoryExporter
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
BigInteger startAddress = getStartAddress();
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
BigInteger endAddress = getEndAddress();
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception ex)
{
@ -306,15 +330,39 @@ public class SRecordExporter implements IMemoryExporter
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
BigInteger length = getLength();
String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$
fStartText.setText(fStartText.getText().trim());
BigInteger length = getLength();
String endString;
BigInteger startAddress = getStartAddress();
BigInteger endAddress = startAddress.add(length);
if(length.compareTo(BigInteger.ZERO) <= 0) {
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
endString = endAddress.toString(16); //$NON-NLS-1$
}
else {
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
}
}
else {
endString = "0x" + endAddress.toString(16); //$NON-NLS-1$
}
fEndText.setText(endString);
if(length.compareTo(BigInteger.ZERO) <= 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
if(startAddress.compareTo(BigInteger.ZERO) < 0) {
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
if(endAddress.compareTo(BigInteger.ZERO) < 0) {
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
}
}
catch(Exception ex)
{