Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java')
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java88
1 files changed, 83 insertions, 5 deletions
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java
index 35766ded478..ffeb18f5788 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java
@@ -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)
{

Back to the top