Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandy Rohrbach2013-01-18 21:59:30 +0000
committerRandy Rohrbach2013-01-18 22:04:08 +0000
commitd51e0799513fd9a6dd2b1c057882c7fba6c9e46c (patch)
tree19a09ff151a3d3fd5021a2fe9c06a0915a01a8e1
parent8aaf87fc8ada270c7891af38e795fbd7416243b3 (diff)
downloadorg.eclipse.cdt-d51e0799513fd9a6dd2b1c057882c7fba6c9e46c.tar.gz
org.eclipse.cdt-d51e0799513fd9a6dd2b1c057882c7fba6c9e46c.tar.xz
org.eclipse.cdt-d51e0799513fd9a6dd2b1c057882c7fba6c9e46c.zip
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.
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java4
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java88
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java88
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java54
4 files changed, 220 insertions, 14 deletions
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java
index b26235a224a..21c1584aae9 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java
@@ -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 {
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)
{
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java
index 0a622e17333..1f4190cafbd 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java
@@ -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)
{
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java
index c76326874f8..9484110a842 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java
@@ -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)
{

Back to the top