mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +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
This commit is contained in:
parent
7c58fc5f33
commit
7bbf2d8511
9 changed files with 231 additions and 121 deletions
|
@ -994,7 +994,9 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
|||
CTabFolder tabFolder = fContextFolders.get(retrieval);
|
||||
if(tabFolder != null) {
|
||||
fStackLayout.topControl = tabFolder;
|
||||
handleTabActivated(tabFolder.getSelection());
|
||||
CTabItem tabItem = (CTabItem) tabFolder.getSelection();
|
||||
getSite().getSelectionProvider().setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING)));
|
||||
handleTabActivated(tabItem);
|
||||
}
|
||||
else {
|
||||
tabFolder = createTabFolder(fRenderingsComposite);
|
||||
|
|
|
@ -32,13 +32,11 @@
|
|||
<importer
|
||||
name="%importer.name.0"
|
||||
id="org.eclipse.cdt.debug.ui.memory.transport.SRecordImporter"
|
||||
maxmemorysize="32"
|
||||
class="org.eclipse.cdt.debug.ui.memory.transport.SRecordImporter">
|
||||
</importer>
|
||||
<exporter
|
||||
name="%exporter.name.0"
|
||||
id="org.eclipse.cdt.debug.ui.memory.transport.SRecordExporter"
|
||||
maxmemorysize="32"
|
||||
class="org.eclipse.cdt.debug.ui.memory.transport.SRecordExporter">
|
||||
</exporter>
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
fStartText = new Text(composite, SWT.BORDER);
|
||||
data = new FormData();
|
||||
data.left = new FormAttachment(startLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
// end address
|
||||
|
@ -112,7 +112,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(endLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fEndText.setLayoutData(data);
|
||||
|
||||
// length
|
||||
|
@ -128,7 +128,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(lengthLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fLengthText.setLayoutData(data);
|
||||
|
||||
// file
|
||||
|
@ -145,7 +145,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(fileLabel);
|
||||
data.width = 300;
|
||||
data.width = 360;
|
||||
fFileText.setLayoutData(data);
|
||||
|
||||
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
||||
|
@ -189,26 +189,26 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
|
||||
fStartText.addKeyListener(new KeyListener() {
|
||||
public void keyReleased(KeyEvent e) {
|
||||
boolean valid = true;
|
||||
try
|
||||
{
|
||||
getStartAddress();
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
|
||||
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||
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));
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
valid = false;
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
fStartText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK) :
|
||||
Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
|
||||
//
|
||||
|
||||
BigInteger endAddress = getEndAddress();
|
||||
BigInteger startAddress = getStartAddress();
|
||||
|
||||
fLengthText.setText(endAddress.subtract(startAddress).toString());
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
|
@ -219,20 +219,22 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
public void keyReleased(KeyEvent e) {
|
||||
try
|
||||
{
|
||||
getEndAddress();
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
|
||||
BigInteger endAddress = getEndAddress();
|
||||
BigInteger startAddress = getStartAddress();
|
||||
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||
fLengthText.setText(actualLength.toString());
|
||||
|
||||
String lengthString = endAddress.subtract(startAddress).toString();
|
||||
|
||||
if(!fLengthText.getText().equals(lengthString))
|
||||
fLengthText.setText(lengthString);
|
||||
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
|
@ -246,23 +248,31 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
public void keyReleased(KeyEvent e) {
|
||||
try
|
||||
{
|
||||
BigInteger length = getLength();
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
BigInteger startAddress = getStartAddress();
|
||||
String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$
|
||||
if(!fEndText.getText().equals(endString))
|
||||
|
||||
BigInteger length = getLength();
|
||||
String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$
|
||||
fStartText.setText(fStartText.getText().trim());
|
||||
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));
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
if ( fLengthText.getText().trim().length() != 0 ) {
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
}
|
||||
|
@ -273,9 +283,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
validate();
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
}
|
||||
public void keyPressed(KeyEvent e) {}
|
||||
});
|
||||
|
||||
composite.pack();
|
||||
|
@ -301,6 +309,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
public BigInteger getEndAddress()
|
||||
{
|
||||
String text = fEndText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -311,6 +320,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -321,6 +331,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
public BigInteger getLength()
|
||||
{
|
||||
String text = fLengthText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -340,7 +351,6 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
try
|
||||
{
|
||||
getEndAddress();
|
||||
|
||||
getStartAddress();
|
||||
|
||||
BigInteger length = getLength();
|
||||
|
@ -348,8 +358,19 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||
isValid = false;
|
||||
|
||||
if(!getFile().getParentFile().exists())
|
||||
File file = getFile();
|
||||
if ( file != null ) {
|
||||
File parentFile = file.getParentFile();
|
||||
|
||||
if(parentFile != null && ! parentFile.exists() )
|
||||
isValid = false;
|
||||
|
||||
if(parentFile != null && parentFile.exists() && ( ! parentFile.canRead() || ! parentFile.isDirectory() ) )
|
||||
isValid = false;
|
||||
|
||||
if ( file.isDirectory() )
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -357,7 +378,6 @@ public class PlainTextExporter implements IMemoryExporter {
|
|||
}
|
||||
|
||||
fParentDialog.setValid(isValid);
|
||||
|
||||
}
|
||||
|
||||
public String getId()
|
||||
|
|
|
@ -113,7 +113,7 @@ public class PlainTextImporter implements IMemoryImporter {
|
|||
data = new FormData();
|
||||
// data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||
data.left = new FormAttachment(labelStartText);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
// file
|
||||
|
@ -226,9 +226,10 @@ public class PlainTextImporter implements IMemoryImporter {
|
|||
try
|
||||
{
|
||||
getStartAddress();
|
||||
if(!getFile().exists())
|
||||
if(!getFile().exists()) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
isValid = false;
|
||||
|
@ -245,6 +246,7 @@ public class PlainTextImporter implements IMemoryImporter {
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
|
|
@ -95,7 +95,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
fStartText = new Text(composite, SWT.BORDER);
|
||||
data = new FormData();
|
||||
data.left = new FormAttachment(startLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
// end address
|
||||
|
@ -111,7 +111,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(endLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fEndText.setLayoutData(data);
|
||||
|
||||
// length
|
||||
|
@ -127,7 +127,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(lengthLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fLengthText.setLayoutData(data);
|
||||
|
||||
// file
|
||||
|
@ -144,7 +144,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(fileLabel);
|
||||
data.width = 300;
|
||||
data.width = 360;
|
||||
fFileText.setLayoutData(data);
|
||||
|
||||
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
||||
|
@ -190,26 +190,26 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
|
||||
fStartText.addKeyListener(new KeyListener() {
|
||||
public void keyReleased(KeyEvent e) {
|
||||
boolean valid = true;
|
||||
try
|
||||
{
|
||||
getStartAddress();
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
|
||||
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||
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));
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
valid = false;
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
fStartText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK) :
|
||||
Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
|
||||
//
|
||||
|
||||
BigInteger endAddress = getEndAddress();
|
||||
BigInteger startAddress = getStartAddress();
|
||||
|
||||
fLengthText.setText(endAddress.subtract(startAddress).toString());
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
|
@ -220,20 +220,22 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
public void keyReleased(KeyEvent e) {
|
||||
try
|
||||
{
|
||||
getEndAddress();
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
|
||||
BigInteger endAddress = getEndAddress();
|
||||
BigInteger startAddress = getStartAddress();
|
||||
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||
fLengthText.setText(actualLength.toString());
|
||||
|
||||
String lengthString = endAddress.subtract(startAddress).toString();
|
||||
|
||||
if(!fLengthText.getText().equals(lengthString))
|
||||
fLengthText.setText(lengthString);
|
||||
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
|
@ -247,23 +249,31 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
public void keyReleased(KeyEvent e) {
|
||||
try
|
||||
{
|
||||
BigInteger length = getLength();
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
BigInteger startAddress = getStartAddress();
|
||||
String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$
|
||||
if(!fEndText.getText().equals(endString))
|
||||
|
||||
BigInteger length = getLength();
|
||||
String endString = "0x" + getStartAddress().add(length).toString(16); //$NON-NLS-1$
|
||||
fStartText.setText(fStartText.getText().trim());
|
||||
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));
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
if ( fLengthText.getText().trim().length() != 0 ) {
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
}
|
||||
|
@ -274,9 +284,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
validate();
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
}
|
||||
public void keyPressed(KeyEvent e) {}
|
||||
});
|
||||
|
||||
composite.pack();
|
||||
|
@ -303,6 +311,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
public BigInteger getEndAddress()
|
||||
{
|
||||
String text = fEndText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -313,6 +322,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -323,6 +333,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
public BigInteger getLength()
|
||||
{
|
||||
String text = fLengthText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -342,7 +353,6 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
try
|
||||
{
|
||||
getEndAddress();
|
||||
|
||||
getStartAddress();
|
||||
|
||||
BigInteger length = getLength();
|
||||
|
@ -350,8 +360,19 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||
isValid = false;
|
||||
|
||||
if(!getFile().getParentFile().exists())
|
||||
File file = getFile();
|
||||
if ( file != null ) {
|
||||
File parentFile = file.getParentFile();
|
||||
|
||||
if(parentFile != null && ! parentFile.exists() )
|
||||
isValid = false;
|
||||
|
||||
if(parentFile != null && parentFile.exists() && ( ! parentFile.canRead() || ! parentFile.isDirectory() ) )
|
||||
isValid = false;
|
||||
|
||||
if ( file.isDirectory() )
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -361,7 +382,6 @@ public class RAWBinaryExporter implements IMemoryExporter
|
|||
fParentDialog.setValid(isValid);
|
||||
}
|
||||
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return "rawbinary"; //$NON-NLS-1$
|
||||
|
|
|
@ -95,7 +95,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
|||
fStartText = new Text(composite, SWT.BORDER);
|
||||
FormData data = new FormData();
|
||||
data.left = new FormAttachment(labelStartText);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
// file
|
||||
|
@ -206,9 +206,10 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
|||
try
|
||||
{
|
||||
getStartAddress();
|
||||
if(!getFile().exists())
|
||||
if(!getFile().exists()) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
isValid = false;
|
||||
|
@ -225,6 +226,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
|
|
@ -98,7 +98,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
fStartText = new Text(composite, SWT.BORDER);
|
||||
data = new FormData();
|
||||
data.left = new FormAttachment(startLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
// end address
|
||||
|
@ -114,7 +114,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(endLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fEndText.setLayoutData(data);
|
||||
|
||||
// length
|
||||
|
@ -130,7 +130,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(lengthLabel);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fLengthText.setLayoutData(data);
|
||||
|
||||
// file
|
||||
|
@ -147,7 +147,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||
data.left = new FormAttachment(fileLabel);
|
||||
data.width = 300;
|
||||
data.width = 360;
|
||||
fFileText.setLayoutData(data);
|
||||
|
||||
fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$
|
||||
|
@ -156,6 +156,24 @@ public class SRecordExporter implements IMemoryExporter
|
|||
data.left = new FormAttachment(fFileText);
|
||||
fileButton.setLayoutData(data);
|
||||
|
||||
// Restriction notice about 32-bit support
|
||||
|
||||
Label spacingLabel = new Label(composite, SWT.NONE);
|
||||
|
||||
spacingLabel.setText(""); //$NON-NLS-1$
|
||||
data = new FormData();
|
||||
data.left = new FormAttachment(0);
|
||||
data.top = new FormAttachment(fileLabel);
|
||||
spacingLabel.setLayoutData(data);
|
||||
|
||||
Label restrictionLabel = new Label(composite, SWT.NONE);
|
||||
|
||||
restrictionLabel.setText(Messages.getString("SRecordExporter.32BitLimitationMessage")); //$NON-NLS-1$
|
||||
data = new FormData();
|
||||
data.left = new FormAttachment(0);
|
||||
data.top = new FormAttachment(spacingLabel);
|
||||
restrictionLabel.setLayoutData(data);
|
||||
|
||||
String textValue = fProperties.get(TRANSFER_FILE);
|
||||
fFileText.setText(textValue != null ? textValue : ""); //$NON-NLS-1$
|
||||
|
||||
|
@ -171,7 +189,6 @@ public class SRecordExporter implements IMemoryExporter
|
|||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
|
||||
textValue = fProperties.get(TRANSFER_END);
|
||||
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||
|
||||
|
@ -186,7 +203,11 @@ public class SRecordExporter implements IMemoryExporter
|
|||
|
||||
try
|
||||
{
|
||||
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
||||
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)
|
||||
{
|
||||
|
@ -225,21 +246,24 @@ public class SRecordExporter implements IMemoryExporter
|
|||
try
|
||||
{
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||
String lengthString = actualLength.toString();
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
|
||||
if(!fLengthText.getText().equals(lengthString)) {
|
||||
if ( ! actualLength.equals( BigInteger.ZERO ) ) {
|
||||
fLengthText.setText(lengthString);
|
||||
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||
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));
|
||||
}
|
||||
}
|
||||
validate();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
validate();
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {}
|
||||
|
@ -249,24 +273,25 @@ public class SRecordExporter implements IMemoryExporter
|
|||
public void keyReleased(KeyEvent e) {
|
||||
try
|
||||
{
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
|
||||
BigInteger actualLength = getEndAddress().subtract(getStartAddress());
|
||||
String lengthString = actualLength.toString();
|
||||
fLengthText.setText(actualLength.toString());
|
||||
|
||||
if(!fLengthText.getText().equals(lengthString)) {
|
||||
if ( ! actualLength.equals( BigInteger.ZERO ) ) {
|
||||
fLengthText.setText(lengthString);
|
||||
if(actualLength.compareTo(BigInteger.ZERO) <= 0) {
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
}
|
||||
|
||||
validate();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
validate();
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {}
|
||||
|
@ -277,21 +302,29 @@ public class SRecordExporter implements IMemoryExporter
|
|||
public void keyReleased(KeyEvent e) {
|
||||
try
|
||||
{
|
||||
BigInteger length = getLength();
|
||||
fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
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$
|
||||
if(!fEndText.getText().equals(endString)) {
|
||||
if ( ! length.equals( BigInteger.ZERO ) ) {
|
||||
fStartText.setText(fStartText.getText().trim());
|
||||
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));
|
||||
}
|
||||
}
|
||||
validate();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
validate();
|
||||
if ( fLengthText.getText().trim().length() != 0 ) {
|
||||
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||
}
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
@ -333,6 +366,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
public BigInteger getEndAddress()
|
||||
{
|
||||
String text = fEndText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -347,6 +381,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -361,6 +396,7 @@ public class SRecordExporter implements IMemoryExporter
|
|||
public BigInteger getLength()
|
||||
{
|
||||
String text = fLengthText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
@ -381,7 +417,6 @@ public class SRecordExporter implements IMemoryExporter
|
|||
try
|
||||
{
|
||||
getEndAddress();
|
||||
|
||||
getStartAddress();
|
||||
|
||||
BigInteger length = getLength();
|
||||
|
@ -389,8 +424,19 @@ public class SRecordExporter implements IMemoryExporter
|
|||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||
isValid = false;
|
||||
|
||||
if(!getFile().getParentFile().exists())
|
||||
File file = getFile();
|
||||
if ( file != null ) {
|
||||
File parentFile = file.getParentFile();
|
||||
|
||||
if(parentFile != null && ! parentFile.exists() )
|
||||
isValid = false;
|
||||
|
||||
if(parentFile != null && parentFile.exists() && ( ! parentFile.canRead() || ! parentFile.isDirectory() ) )
|
||||
isValid = false;
|
||||
|
||||
if ( file.isDirectory() )
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -400,7 +446,6 @@ public class SRecordExporter implements IMemoryExporter
|
|||
fParentDialog.setValid(isValid);
|
||||
}
|
||||
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return "srecord"; //$NON-NLS-1$
|
||||
|
|
|
@ -115,7 +115,7 @@ public class SRecordImporter implements IMemoryImporter {
|
|||
data = new FormData();
|
||||
data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||
data.left = new FormAttachment(fComboRestoreToThisAddress);
|
||||
data.width = 100;
|
||||
data.width = 120;
|
||||
fStartText.setLayoutData(data);
|
||||
|
||||
fComboRestoreToFileAddress.addSelectionListener(new SelectionListener() {
|
||||
|
@ -247,6 +247,24 @@ public class SRecordImporter implements IMemoryImporter {
|
|||
final boolean scrollToStart = fProperties.getBoolean(TRANSFER_SCROLL_TO_START);
|
||||
fScrollToBeginningOnImportComplete.setSelection(scrollToStart);
|
||||
|
||||
// Restriction notice about 32-bit support
|
||||
|
||||
Label spacingLabel = new Label(composite, SWT.NONE);
|
||||
|
||||
spacingLabel.setText(""); //$NON-NLS-1$
|
||||
data = new FormData();
|
||||
data.left = new FormAttachment(0);
|
||||
data.top = new FormAttachment(fScrollToBeginningOnImportComplete);
|
||||
spacingLabel.setLayoutData(data);
|
||||
|
||||
Label restrictionLabel = new Label(composite, SWT.NONE);
|
||||
|
||||
restrictionLabel.setText(Messages.getString("SRecordImporter.32BitLimitationMessage")); //$NON-NLS-1$
|
||||
data = new FormData();
|
||||
data.left = new FormAttachment(0);
|
||||
data.top = new FormAttachment(spacingLabel);
|
||||
restrictionLabel.setLayoutData(data);
|
||||
|
||||
composite.pack();
|
||||
parent.pack();
|
||||
|
||||
|
@ -294,6 +312,7 @@ public class SRecordImporter implements IMemoryImporter {
|
|||
public BigInteger getStartAddress()
|
||||
{
|
||||
String text = fStartText.getText();
|
||||
text = text.trim();
|
||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||
hex ? 16 : 10);
|
||||
|
|
|
@ -51,6 +51,7 @@ SRecordExporter.EndAddress=End address:
|
|||
SRecordExporter.Length=Length:
|
||||
SRecordExporter.Name=SRecord
|
||||
SRecordExporter.StartAddress=Start address:
|
||||
SRecordExporter.32BitLimitationMessage=SRecord format only supports 32-bit address spaces.
|
||||
|
||||
SRecordImporter.ChecksumFalure=Checksum failure of line =
|
||||
SRecordImporter.ChooseFile=Choose memory import file
|
||||
|
@ -62,6 +63,7 @@ SRecordImporter.InvalidData=Invalid file format. Invalid data at line %d
|
|||
SRecordImporter.InvalidLineLength=Invalid file format. Invalid line length at line %d
|
||||
SRecordImporter.Name=SRecord
|
||||
SRecordImporter.ScrollToStart=Scroll to restore address
|
||||
SRecordImporter.32BitLimitationMessage=SRecord format only supports 32-bit address spaces.
|
||||
|
||||
RAWBinaryExporter.ChooseFile=Choose memory export file
|
||||
RAWBinaryExporter.EndAddress=End address:
|
||||
|
|
Loading…
Add table
Reference in a new issue