1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 01:45:33 +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

Added more error checking. See comments in the bugzillas for the details.
This commit is contained in:
Randy Rohrbach 2013-01-21 17:20:49 -05:00
parent 629232eae1
commit 975d6f48e2
6 changed files with 89 additions and 48 deletions

View file

@ -69,13 +69,17 @@ public class PlainTextExporter implements IMemoryExporter {
@Override
public void dispose()
{
fProperties.put(TRANSFER_FILE, fFileText.getText());
fProperties.put(TRANSFER_START, fStartText.getText());
fProperties.put(TRANSFER_END, fEndText.getText());
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
fProperties.put(TRANSFER_START, fStartText.getText().trim());
fProperties.put(TRANSFER_END, fEndText.getText().trim());
fStartAddress = getStartAddress();
fEndAddress = getEndAddress();
fOutputFile = getFile();
try
{
fStartAddress = getStartAddress();
fEndAddress = getEndAddress();
fOutputFile = getFile();
}
catch(Exception e) {}
super.dispose();
}
@ -203,7 +207,7 @@ public class PlainTextExporter implements IMemoryExporter {
dialog.setText(Messages.getString("PlainTextExporter.ChooseFile")); //$NON-NLS-1$
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$NON-NLS-1$
dialog.setFileName(fFileText.getText());
dialog.setFileName(fFileText.getText().trim());
dialog.open();
String filename = dialog.getFileName();
@ -419,7 +423,7 @@ public class PlainTextExporter implements IMemoryExporter {
public File getFile()
{
return new File(fFileText.getText());
return new File(fFileText.getText().trim());
}
private void validate()
@ -436,6 +440,9 @@ public class PlainTextExporter implements IMemoryExporter {
if(length.compareTo(BigInteger.ZERO) <= 0)
isValid = false;
if ( fFileText.getText().trim().length() == 0 )
isValid = false;
File file = getFile();
if ( file != null ) {
File parentFile = file.getParentFile();
@ -457,7 +464,7 @@ public class PlainTextExporter implements IMemoryExporter {
fParentDialog.setValid(isValid);
}
public String getId()
{
return "PlainTextExporter"; //$NON-NLS-1$

View file

@ -76,13 +76,17 @@ public class PlainTextImporter implements IMemoryImporter {
@Override
public void dispose()
{
fProperties.put(TRANSFER_FILE, fFileText.getText());
fProperties.put(TRANSFER_START, fStartText.getText());
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
fProperties.put(TRANSFER_START, fStartText.getText().trim());
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
fStartAddress = getStartAddress();
fInputFile = getFile();
fScrollToStart = getScrollToStart();
try
{
fStartAddress = getStartAddress();
fInputFile = getFile();
fScrollToStart = getScrollToStart();
}
catch(Exception e) {}
super.dispose();
}
@ -157,7 +161,7 @@ public class PlainTextImporter implements IMemoryImporter {
dialog.setText(Messages.getString("PlainTextImporter.ChooseFile")); //$NON-NLS-1$
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$NON-NLS-1$
dialog.setFileName(fFileText.getText());
dialog.setFileName(fFileText.getText().trim());
dialog.open();
String filename = dialog.getFileName();
@ -226,6 +230,11 @@ public class PlainTextImporter implements IMemoryImporter {
try
{
getStartAddress();
if ( fFileText.getText().trim().length() == 0 )
isValid = false;
if(!getFile().exists()) {
isValid = false;
}
@ -256,7 +265,7 @@ public class PlainTextImporter implements IMemoryImporter {
public File getFile()
{
return new File(fFileText.getText());
return new File(fFileText.getText().trim());
}
public String getId()

View file

@ -69,13 +69,17 @@ public class RAWBinaryExporter implements IMemoryExporter
@Override
public void dispose()
{
fProperties.put(TRANSFER_FILE, fFileText.getText());
fProperties.put(TRANSFER_START, fStartText.getText());
fProperties.put(TRANSFER_END, fEndText.getText());
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
fProperties.put(TRANSFER_START, fStartText.getText().trim());
fProperties.put(TRANSFER_END, fEndText.getText().trim());
fStartAddress = getStartAddress();
fEndAddress = getEndAddress();
fOutputFile = getFile();
try
{
fStartAddress = getStartAddress();
fEndAddress = getEndAddress();
fOutputFile = getFile();
}
catch(Exception e) {}
super.dispose();
}
@ -204,7 +208,7 @@ public class RAWBinaryExporter implements IMemoryExporter
dialog.setText(Messages.getString("RAWBinaryExporter.ChooseFile")); //$NON-NLS-1$
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$NON-NLS-1$
dialog.setFileName(fFileText.getText());
dialog.setFileName(fFileText.getText().trim());
dialog.open();
String filename = dialog.getFileName();
@ -421,7 +425,7 @@ public class RAWBinaryExporter implements IMemoryExporter
public File getFile()
{
return new File(fFileText.getText());
return new File(fFileText.getText().trim());
}
private void validate()
@ -438,6 +442,9 @@ public class RAWBinaryExporter implements IMemoryExporter
if(length.compareTo(BigInteger.ZERO) <= 0)
isValid = false;
if ( fFileText.getText().trim().length() == 0 )
isValid = false;
File file = getFile();
if ( file != null ) {
File parentFile = file.getParentFile();

View file

@ -71,13 +71,17 @@ public class RAWBinaryImporter implements IMemoryImporter {
@Override
public void dispose()
{
fProperties.put(TRANSFER_FILE, fFileText.getText());
fProperties.put(TRANSFER_START, fStartText.getText());
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
fProperties.put(TRANSFER_START, fStartText.getText().trim());
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
fStartAddress = getStartAddress();
fInputFile = getFile();
fScrollToStart = getScrollToStart();
try
{
fStartAddress = getStartAddress();
fInputFile = getFile();
fScrollToStart = getScrollToStart();
}
catch(Exception e) {}
super.dispose();
}
@ -137,7 +141,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
dialog.setText(Messages.getString("RAWBinaryImporter.ChooseFile")); //$NON-NLS-1$
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$NON-NLS-1$
dialog.setFileName(fFileText.getText());
dialog.setFileName(fFileText.getText().trim());
dialog.open();
String filename = dialog.getFileName();
@ -206,6 +210,11 @@ public class RAWBinaryImporter implements IMemoryImporter {
try
{
getStartAddress();
if ( fFileText.getText().trim().length() == 0 )
isValid = false;
if(!getFile().exists()) {
isValid = false;
}
@ -236,7 +245,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
public File getFile()
{
return new File(fFileText.getText());
return new File(fFileText.getText().trim());
}
public String getId()

View file

@ -68,9 +68,9 @@ public class SRecordExporter implements IMemoryExporter
{
public void dispose()
{
fProperties.put(TRANSFER_FILE, fFileText.getText());
fProperties.put(TRANSFER_START, fStartText.getText());
fProperties.put(TRANSFER_END, fEndText.getText());
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
fProperties.put(TRANSFER_START, fStartText.getText().trim());
fProperties.put(TRANSFER_END, fEndText.getText().trim());
try
{
@ -227,7 +227,7 @@ public class SRecordExporter implements IMemoryExporter
dialog.setText(Messages.getString("SRecordExporter.ChooseFile")); //$NON-NLS-1$
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$NON-NLS-1$
dialog.setFileName(fFileText.getText());
dialog.setFileName(fFileText.getText().trim());
dialog.open();
String filename = dialog.getFileName();
@ -455,7 +455,7 @@ public class SRecordExporter implements IMemoryExporter
public File getFile()
{
return new File(fFileText.getText());
return new File(fFileText.getText().trim());
}
private void validate()
@ -472,6 +472,9 @@ public class SRecordExporter implements IMemoryExporter
if(length.compareTo(BigInteger.ZERO) <= 0)
isValid = false;
if ( fFileText.getText().trim().length() == 0 )
isValid = false;
File file = getFile();
if ( file != null ) {
File parentFile = file.getParentFile();

View file

@ -77,14 +77,20 @@ public class SRecordImporter implements IMemoryImporter {
{
public void dispose()
{
fProperties.put(TRANSFER_FILE, fFileText.getText());
fProperties.put(TRANSFER_START, fStartText.getText());
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
fProperties.put(TRANSFER_START, fStartText.getText().trim());
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
fProperties.put(TRANSFER_CUSTOM_START_ADDRESS, fComboRestoreToThisAddress.getSelection());
fStartAddress = getStartAddress();
fInputFile = getFile();
fScrollToStart = getScrollToStart();
try
{
if(fProperties.getBoolean(TRANSFER_CUSTOM_START_ADDRESS)) {
fStartAddress = getStartAddress();
}
fInputFile = getFile();
fScrollToStart = getScrollToStart();
}
catch(Exception e) {}
super.dispose();
}
@ -187,7 +193,7 @@ public class SRecordImporter implements IMemoryImporter {
dialog.setText(Messages.getString("SRecordImporter.ChooseFile")); //$NON-NLS-1$
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$NON-NLS-1$
dialog.setFileName(fFileText.getText());
dialog.setFileName(fFileText.getText().trim());
dialog.open();
String filename = dialog.getFileName();
@ -289,11 +295,11 @@ public class SRecordImporter implements IMemoryImporter {
getStartAddress();
}
boolean restoreToAddressFromFile = fComboRestoreToFileAddress.getSelection();
if ( restoreToAddressFromFile ) {
if(!getFile().exists()) {
isValid = false;
}
if ( fFileText.getText().trim().length() == 0 )
isValid = false;
if(!getFile().exists()) {
isValid = false;
}
}
catch(Exception e)
@ -327,7 +333,7 @@ public class SRecordImporter implements IMemoryImporter {
public File getFile()
{
return new File(fFileText.getText());
return new File(fFileText.getText().trim());
}
public String getId()