mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 22:05:44 +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:
parent
629232eae1
commit
975d6f48e2
6 changed files with 89 additions and 48 deletions
|
@ -69,13 +69,17 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
@Override
|
@Override
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
|
||||||
fProperties.put(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText().trim());
|
||||||
fProperties.put(TRANSFER_END, fEndText.getText());
|
fProperties.put(TRANSFER_END, fEndText.getText().trim());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
fEndAddress = getEndAddress();
|
fEndAddress = getEndAddress();
|
||||||
fOutputFile = getFile();
|
fOutputFile = getFile();
|
||||||
|
}
|
||||||
|
catch(Exception e) {}
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
@ -203,7 +207,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
dialog.setText(Messages.getString("PlainTextExporter.ChooseFile")); //$NON-NLS-1$
|
dialog.setText(Messages.getString("PlainTextExporter.ChooseFile")); //$NON-NLS-1$
|
||||||
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
||||||
dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$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();
|
dialog.open();
|
||||||
|
|
||||||
String filename = dialog.getFileName();
|
String filename = dialog.getFileName();
|
||||||
|
@ -419,7 +423,7 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
|
|
||||||
public File getFile()
|
public File getFile()
|
||||||
{
|
{
|
||||||
return new File(fFileText.getText());
|
return new File(fFileText.getText().trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validate()
|
private void validate()
|
||||||
|
@ -436,6 +440,9 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
|
if ( fFileText.getText().trim().length() == 0 )
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
File file = getFile();
|
File file = getFile();
|
||||||
if ( file != null ) {
|
if ( file != null ) {
|
||||||
File parentFile = file.getParentFile();
|
File parentFile = file.getParentFile();
|
||||||
|
|
|
@ -76,13 +76,17 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
@Override
|
@Override
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
|
||||||
fProperties.put(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText().trim());
|
||||||
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
|
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
fInputFile = getFile();
|
fInputFile = getFile();
|
||||||
fScrollToStart = getScrollToStart();
|
fScrollToStart = getScrollToStart();
|
||||||
|
}
|
||||||
|
catch(Exception e) {}
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
@ -157,7 +161,7 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
dialog.setText(Messages.getString("PlainTextImporter.ChooseFile")); //$NON-NLS-1$
|
dialog.setText(Messages.getString("PlainTextImporter.ChooseFile")); //$NON-NLS-1$
|
||||||
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
||||||
dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$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();
|
dialog.open();
|
||||||
|
|
||||||
String filename = dialog.getFileName();
|
String filename = dialog.getFileName();
|
||||||
|
@ -226,6 +230,11 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getStartAddress();
|
getStartAddress();
|
||||||
|
|
||||||
|
|
||||||
|
if ( fFileText.getText().trim().length() == 0 )
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
if(!getFile().exists()) {
|
if(!getFile().exists()) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +265,7 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
|
|
||||||
public File getFile()
|
public File getFile()
|
||||||
{
|
{
|
||||||
return new File(fFileText.getText());
|
return new File(fFileText.getText().trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId()
|
public String getId()
|
||||||
|
|
|
@ -69,13 +69,17 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
@Override
|
@Override
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
|
||||||
fProperties.put(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText().trim());
|
||||||
fProperties.put(TRANSFER_END, fEndText.getText());
|
fProperties.put(TRANSFER_END, fEndText.getText().trim());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
fEndAddress = getEndAddress();
|
fEndAddress = getEndAddress();
|
||||||
fOutputFile = getFile();
|
fOutputFile = getFile();
|
||||||
|
}
|
||||||
|
catch(Exception e) {}
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
@ -204,7 +208,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
dialog.setText(Messages.getString("RAWBinaryExporter.ChooseFile")); //$NON-NLS-1$
|
dialog.setText(Messages.getString("RAWBinaryExporter.ChooseFile")); //$NON-NLS-1$
|
||||||
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
||||||
dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$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();
|
dialog.open();
|
||||||
|
|
||||||
String filename = dialog.getFileName();
|
String filename = dialog.getFileName();
|
||||||
|
@ -421,7 +425,7 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
|
|
||||||
public File getFile()
|
public File getFile()
|
||||||
{
|
{
|
||||||
return new File(fFileText.getText());
|
return new File(fFileText.getText().trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validate()
|
private void validate()
|
||||||
|
@ -438,6 +442,9 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
|
if ( fFileText.getText().trim().length() == 0 )
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
File file = getFile();
|
File file = getFile();
|
||||||
if ( file != null ) {
|
if ( file != null ) {
|
||||||
File parentFile = file.getParentFile();
|
File parentFile = file.getParentFile();
|
||||||
|
|
|
@ -71,13 +71,17 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
@Override
|
@Override
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
|
||||||
fProperties.put(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText().trim());
|
||||||
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
|
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
fInputFile = getFile();
|
fInputFile = getFile();
|
||||||
fScrollToStart = getScrollToStart();
|
fScrollToStart = getScrollToStart();
|
||||||
|
}
|
||||||
|
catch(Exception e) {}
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
@ -137,7 +141,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
dialog.setText(Messages.getString("RAWBinaryImporter.ChooseFile")); //$NON-NLS-1$
|
dialog.setText(Messages.getString("RAWBinaryImporter.ChooseFile")); //$NON-NLS-1$
|
||||||
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
||||||
dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$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();
|
dialog.open();
|
||||||
|
|
||||||
String filename = dialog.getFileName();
|
String filename = dialog.getFileName();
|
||||||
|
@ -206,6 +210,11 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getStartAddress();
|
getStartAddress();
|
||||||
|
|
||||||
|
|
||||||
|
if ( fFileText.getText().trim().length() == 0 )
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
if(!getFile().exists()) {
|
if(!getFile().exists()) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +245,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
|
|
||||||
public File getFile()
|
public File getFile()
|
||||||
{
|
{
|
||||||
return new File(fFileText.getText());
|
return new File(fFileText.getText().trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId()
|
public String getId()
|
||||||
|
|
|
@ -68,9 +68,9 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
{
|
{
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
|
||||||
fProperties.put(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText().trim());
|
||||||
fProperties.put(TRANSFER_END, fEndText.getText());
|
fProperties.put(TRANSFER_END, fEndText.getText().trim());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -227,7 +227,7 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
dialog.setText(Messages.getString("SRecordExporter.ChooseFile")); //$NON-NLS-1$
|
dialog.setText(Messages.getString("SRecordExporter.ChooseFile")); //$NON-NLS-1$
|
||||||
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
||||||
dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$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();
|
dialog.open();
|
||||||
|
|
||||||
String filename = dialog.getFileName();
|
String filename = dialog.getFileName();
|
||||||
|
@ -455,7 +455,7 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
|
|
||||||
public File getFile()
|
public File getFile()
|
||||||
{
|
{
|
||||||
return new File(fFileText.getText());
|
return new File(fFileText.getText().trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validate()
|
private void validate()
|
||||||
|
@ -472,6 +472,9 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
|
if ( fFileText.getText().trim().length() == 0 )
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
File file = getFile();
|
File file = getFile();
|
||||||
if ( file != null ) {
|
if ( file != null ) {
|
||||||
File parentFile = file.getParentFile();
|
File parentFile = file.getParentFile();
|
||||||
|
|
|
@ -77,14 +77,20 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
{
|
{
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText().trim());
|
||||||
fProperties.put(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText().trim());
|
||||||
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
|
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
|
||||||
fProperties.put(TRANSFER_CUSTOM_START_ADDRESS, fComboRestoreToThisAddress.getSelection());
|
fProperties.put(TRANSFER_CUSTOM_START_ADDRESS, fComboRestoreToThisAddress.getSelection());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(fProperties.getBoolean(TRANSFER_CUSTOM_START_ADDRESS)) {
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
|
}
|
||||||
fInputFile = getFile();
|
fInputFile = getFile();
|
||||||
fScrollToStart = getScrollToStart();
|
fScrollToStart = getScrollToStart();
|
||||||
|
}
|
||||||
|
catch(Exception e) {}
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
@ -187,7 +193,7 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
dialog.setText(Messages.getString("SRecordImporter.ChooseFile")); //$NON-NLS-1$
|
dialog.setText(Messages.getString("SRecordImporter.ChooseFile")); //$NON-NLS-1$
|
||||||
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$
|
||||||
dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$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();
|
dialog.open();
|
||||||
|
|
||||||
String filename = dialog.getFileName();
|
String filename = dialog.getFileName();
|
||||||
|
@ -289,13 +295,13 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
getStartAddress();
|
getStartAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean restoreToAddressFromFile = fComboRestoreToFileAddress.getSelection();
|
if ( fFileText.getText().trim().length() == 0 )
|
||||||
if ( restoreToAddressFromFile ) {
|
isValid = false;
|
||||||
|
|
||||||
if(!getFile().exists()) {
|
if(!getFile().exists()) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
@ -327,7 +333,7 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
|
|
||||||
public File getFile()
|
public File getFile()
|
||||||
{
|
{
|
||||||
return new File(fFileText.getText());
|
return new File(fFileText.getText().trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId()
|
public String getId()
|
||||||
|
|
Loading…
Add table
Reference in a new issue