mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Bugzilla 299945.
Since there have been no further comments or objections I am committing this change. I updated the appropriate version numbers as specified by Pawel and Doug. Randy
This commit is contained in:
parent
6621f5653e
commit
be9d6fad05
13 changed files with 238 additions and 202 deletions
|
@ -2,7 +2,7 @@
|
||||||
<feature
|
<feature
|
||||||
id="org.eclipse.cdt.debug.ui.memory"
|
id="org.eclipse.cdt.debug.ui.memory"
|
||||||
label="%featureName"
|
label="%featureName"
|
||||||
version="1.2.0.qualifier"
|
version="2.1.0.qualifier"
|
||||||
provider-name="%providerName">
|
provider-name="%providerName">
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
|
@ -21,12 +21,6 @@
|
||||||
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/galileo"/>
|
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/galileo"/>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<!--
|
|
||||||
<includes
|
|
||||||
id="org.eclipse.cdt.debug.ui.memory.source"
|
|
||||||
version="0.0.0"/>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<requires>
|
<requires>
|
||||||
<import plugin="org.eclipse.debug.core"/>
|
<import plugin="org.eclipse.debug.core"/>
|
||||||
<import plugin="org.eclipse.debug.ui"/>
|
<import plugin="org.eclipse.debug.ui"/>
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.debug.ui.memory.transport;singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.debug.ui.memory.transport;singleton:=true
|
||||||
Bundle-Version: 1.2.0.qualifier
|
Bundle-Version: 2.1.0.qualifier
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Require-Bundle: org.eclipse.debug.core,
|
Require-Bundle: org.eclipse.debug.core,
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
package org.eclipse.cdt.debug.ui.memory.transport;
|
package org.eclipse.cdt.debug.ui.memory.transport;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryExporter;
|
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryExporter;
|
||||||
|
@ -25,9 +24,10 @@ import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
|
||||||
import org.eclipse.swt.layout.FormAttachment;
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
import org.eclipse.swt.layout.FormData;
|
import org.eclipse.swt.layout.FormData;
|
||||||
import org.eclipse.swt.layout.FormLayout;
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
@ -42,6 +42,10 @@ import org.eclipse.ui.dialogs.SelectionDialog;
|
||||||
public class ExportMemoryDialog extends SelectionDialog
|
public class ExportMemoryDialog extends SelectionDialog
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final String EXPORT_SETTINGS = "EXPORT_DIALOG"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final String SELECTED_EXPORTER = "SELECTED_EXPORTER"; //$NON-NLS-1$
|
||||||
|
|
||||||
private Combo fFormatCombo;
|
private Combo fFormatCombo;
|
||||||
|
|
||||||
private IMemoryBlock fMemoryBlock;
|
private IMemoryBlock fMemoryBlock;
|
||||||
|
@ -51,10 +55,10 @@ public class ExportMemoryDialog extends SelectionDialog
|
||||||
private IMemoryExporter fFormatExporters[];
|
private IMemoryExporter fFormatExporters[];
|
||||||
private String fFormatNames[];
|
private String fFormatNames[];
|
||||||
|
|
||||||
private Properties fProperties = new Properties();
|
private IDialogSettings fProperties = MemoryTransportPlugin.getDefault().getDialogSettings(EXPORT_SETTINGS);
|
||||||
|
|
||||||
private BigInteger fInitialStartAddr;
|
|
||||||
|
|
||||||
|
private final String INITIAL_ADDRESS = "Initial address";
|
||||||
|
|
||||||
public ExportMemoryDialog(Shell parent, IMemoryBlock memoryBlock, BigInteger initialStartAddr)
|
public ExportMemoryDialog(Shell parent, IMemoryBlock memoryBlock, BigInteger initialStartAddr)
|
||||||
{
|
{
|
||||||
super(parent);
|
super(parent);
|
||||||
|
@ -62,7 +66,33 @@ public class ExportMemoryDialog extends SelectionDialog
|
||||||
setShellStyle(getShellStyle() | SWT.RESIZE);
|
setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||||
|
|
||||||
fMemoryBlock = memoryBlock;
|
fMemoryBlock = memoryBlock;
|
||||||
fInitialStartAddr = initialStartAddr;
|
|
||||||
|
String addrstr = "0x" + initialStartAddr.toString(16); //$NON-NLS-1$
|
||||||
|
|
||||||
|
String initialAddress = fProperties.get(INITIAL_ADDRESS);
|
||||||
|
|
||||||
|
if ( initialAddress == null ) {
|
||||||
|
fProperties.put(IMemoryExporter.TRANSFER_START, addrstr);
|
||||||
|
fProperties.put(IMemoryExporter.TRANSFER_END, addrstr);
|
||||||
|
fProperties.put(INITIAL_ADDRESS , addrstr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( ! initialAddress.equals(addrstr) ) {
|
||||||
|
fProperties.put(IMemoryExporter.TRANSFER_START, addrstr);
|
||||||
|
fProperties.put(IMemoryExporter.TRANSFER_END, addrstr);
|
||||||
|
fProperties.put(INITIAL_ADDRESS , addrstr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
String startAddr = fProperties.get(IMemoryExporter.TRANSFER_START);
|
||||||
|
String endAddr = fProperties.get(IMemoryExporter.TRANSFER_END);
|
||||||
|
|
||||||
|
if ( startAddr == null || endAddr == null ) {
|
||||||
|
fProperties.put(IMemoryExporter.TRANSFER_START, addrstr);
|
||||||
|
fProperties.put(IMemoryExporter.TRANSFER_END, addrstr);
|
||||||
|
fProperties.put(INITIAL_ADDRESS , addrstr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -102,8 +132,11 @@ public class ExportMemoryDialog extends SelectionDialog
|
||||||
protected void okPressed() {
|
protected void okPressed() {
|
||||||
if(fCurrentControl != null)
|
if(fCurrentControl != null)
|
||||||
fCurrentControl.dispose();
|
fCurrentControl.dispose();
|
||||||
fFormatExporters[fFormatCombo.getSelectionIndex()].exportMemory();
|
IMemoryExporter currentExporter = getCurrentExporter();
|
||||||
|
currentExporter.exportMemory();
|
||||||
|
|
||||||
|
fProperties.put(SELECTED_EXPORTER, currentExporter.getId());
|
||||||
|
|
||||||
super.okPressed();
|
super.okPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,46 +208,45 @@ public class ExportMemoryDialog extends SelectionDialog
|
||||||
|
|
||||||
fFormatCombo.setItems(fFormatNames);
|
fFormatCombo.setItems(fFormatNames);
|
||||||
|
|
||||||
fFormatCombo.addSelectionListener(new SelectionListener(){
|
fFormatCombo.addSelectionListener(new SelectionAdapter(){
|
||||||
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if(fCurrentControl != null)
|
if(fCurrentControl != null) {
|
||||||
fCurrentControl.dispose();
|
fCurrentControl.dispose();
|
||||||
initProperties(fProperties, fInitialStartAddr);
|
}
|
||||||
fCurrentControl = fFormatExporters[fFormatCombo.getSelectionIndex()].createControl(container,
|
fCurrentControl = getCurrentExporter().createControl(container, fMemoryBlock, fProperties, ExportMemoryDialog.this);
|
||||||
fMemoryBlock, fProperties, ExportMemoryDialog.this);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
fFormatCombo.select(0);
|
setCurrentExporter(fProperties.get(SELECTED_EXPORTER));
|
||||||
initProperties(fProperties, fInitialStartAddr);
|
|
||||||
fCurrentControl = fFormatExporters[0].createControl(container,
|
fCurrentControl = getCurrentExporter().createControl(container, fMemoryBlock, fProperties, ExportMemoryDialog.this);
|
||||||
fMemoryBlock, fProperties, ExportMemoryDialog.this);
|
|
||||||
|
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the start and end address properties to a particular value if
|
|
||||||
* and only if we have a fresh/clean properties object.
|
|
||||||
*/
|
|
||||||
static void initProperties(Properties properties, BigInteger addr) {
|
|
||||||
final String addrstr = "0x" + addr.toString(16); //$NON-NLS-1$
|
|
||||||
if (!properties.containsKey(IMemoryExporter.TRANSFER_START)) {
|
|
||||||
properties.setProperty(IMemoryExporter.TRANSFER_START, addrstr);
|
|
||||||
properties.setProperty(IMemoryExporter.TRANSFER_END, addrstr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValid(boolean isValid)
|
public void setValid(boolean isValid)
|
||||||
{
|
{
|
||||||
getButton(IDialogConstants.OK_ID).setEnabled(isValid);
|
getButton(IDialogConstants.OK_ID).setEnabled(isValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IMemoryExporter getCurrentExporter() {
|
||||||
|
return fFormatExporters[fFormatCombo.getSelectionIndex()];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCurrentExporter(String id) {
|
||||||
|
if ( id == null || id.length() == 0 ) {
|
||||||
|
fFormatCombo.select(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int index = 0; index< fFormatExporters.length; ++index) {
|
||||||
|
if (fFormatExporters[index].getId().equals(id)){
|
||||||
|
fFormatCombo.select(index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fFormatCombo.select(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.debug.ui.memory.transport;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryImporter;
|
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryImporter;
|
||||||
|
@ -31,9 +30,10 @@ import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
||||||
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
|
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
|
||||||
import org.eclipse.swt.layout.FormAttachment;
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
import org.eclipse.swt.layout.FormData;
|
import org.eclipse.swt.layout.FormData;
|
||||||
import org.eclipse.swt.layout.FormLayout;
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
@ -50,6 +50,10 @@ import org.eclipse.ui.progress.UIJob;
|
||||||
public class ImportMemoryDialog extends SelectionDialog
|
public class ImportMemoryDialog extends SelectionDialog
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final String IMPORT_SETTINGS = "IMPORT_DIALOG"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final String SELECTED_IMPORTER = "SELECTED_IMPORTER"; //$NON-NLS-1$
|
||||||
|
|
||||||
private Combo fFormatCombo;
|
private Combo fFormatCombo;
|
||||||
|
|
||||||
private IMemoryBlock fMemoryBlock;
|
private IMemoryBlock fMemoryBlock;
|
||||||
|
@ -59,11 +63,11 @@ public class ImportMemoryDialog extends SelectionDialog
|
||||||
private IMemoryImporter fFormatImporters[];
|
private IMemoryImporter fFormatImporters[];
|
||||||
private String fFormatNames[];
|
private String fFormatNames[];
|
||||||
|
|
||||||
private Properties fProperties = new Properties();
|
private IDialogSettings fProperties = MemoryTransportPlugin.getDefault().getDialogSettings(IMPORT_SETTINGS);
|
||||||
|
|
||||||
private IMemoryRenderingSite fMemoryView;
|
private IMemoryRenderingSite fMemoryView;
|
||||||
|
|
||||||
private BigInteger fInitialStartAddr;
|
private final String INITIAL_ADDRESS = "Initial address";
|
||||||
|
|
||||||
public ImportMemoryDialog(Shell parent, IMemoryBlock memoryBlock, BigInteger initialStartAddr, IMemoryRenderingSite renderingSite)
|
public ImportMemoryDialog(Shell parent, IMemoryBlock memoryBlock, BigInteger initialStartAddr, IMemoryRenderingSite renderingSite)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +77,30 @@ public class ImportMemoryDialog extends SelectionDialog
|
||||||
|
|
||||||
fMemoryBlock = memoryBlock;
|
fMemoryBlock = memoryBlock;
|
||||||
fMemoryView = renderingSite;
|
fMemoryView = renderingSite;
|
||||||
fInitialStartAddr = initialStartAddr;
|
|
||||||
|
String initialAddress = fProperties.get(INITIAL_ADDRESS);
|
||||||
|
|
||||||
|
if ( initialAddress == null ) {
|
||||||
|
String addrstr = "0x" + initialStartAddr.toString(16); //$NON-NLS-1$
|
||||||
|
fProperties.put(IMemoryImporter.TRANSFER_START, addrstr);
|
||||||
|
fProperties.put(INITIAL_ADDRESS , addrstr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
String addrstr = "0x" + initialStartAddr.toString(16); //$NON-NLS-1$
|
||||||
|
|
||||||
|
if ( ! initialAddress.equals(addrstr) ) {
|
||||||
|
fProperties.put(IMemoryImporter.TRANSFER_START, addrstr);
|
||||||
|
fProperties.put(INITIAL_ADDRESS , addrstr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
String startAddr = fProperties.get(IMemoryImporter.TRANSFER_START);
|
||||||
|
|
||||||
|
if ( startAddr == null ) {
|
||||||
|
fProperties.put(IMemoryImporter.TRANSFER_START, addrstr);
|
||||||
|
fProperties.put(INITIAL_ADDRESS , addrstr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void scrollRenderings(final BigInteger address)
|
protected void scrollRenderings(final BigInteger address)
|
||||||
|
@ -139,8 +166,10 @@ public class ImportMemoryDialog extends SelectionDialog
|
||||||
protected void okPressed() {
|
protected void okPressed() {
|
||||||
if(fCurrentControl != null)
|
if(fCurrentControl != null)
|
||||||
fCurrentControl.dispose();
|
fCurrentControl.dispose();
|
||||||
fFormatImporters[fFormatCombo.getSelectionIndex()].importMemory();
|
|
||||||
|
|
||||||
|
IMemoryImporter currentImporter = getCurrentImporter();
|
||||||
|
currentImporter.importMemory();
|
||||||
|
fProperties.put(SELECTED_IMPORTER, currentImporter.getId());
|
||||||
super.okPressed();
|
super.okPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,45 +240,44 @@ public class ImportMemoryDialog extends SelectionDialog
|
||||||
|
|
||||||
fFormatCombo.setItems(fFormatNames);
|
fFormatCombo.setItems(fFormatNames);
|
||||||
|
|
||||||
fFormatCombo.addSelectionListener(new SelectionListener(){
|
fFormatCombo.addSelectionListener(new SelectionAdapter(){
|
||||||
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if(fCurrentControl != null)
|
if(fCurrentControl != null) {
|
||||||
fCurrentControl.dispose();
|
fCurrentControl.dispose();
|
||||||
|
}
|
||||||
initProperties(fProperties, fInitialStartAddr); // use utility from export code
|
fCurrentControl = getCurrentImporter().createControl(container, fMemoryBlock, fProperties, ImportMemoryDialog.this);
|
||||||
fCurrentControl = fFormatImporters[fFormatCombo.getSelectionIndex()].createControl(container,
|
|
||||||
fMemoryBlock, fProperties, ImportMemoryDialog.this);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
fFormatCombo.select(0);
|
setCurrentImporter(fProperties.get(SELECTED_IMPORTER));
|
||||||
|
|
||||||
initProperties(fProperties, fInitialStartAddr); // use utility from export code
|
fCurrentControl = getCurrentImporter().createControl(container,fMemoryBlock, fProperties, ImportMemoryDialog.this);
|
||||||
fCurrentControl =
|
|
||||||
fFormatImporters[0].createControl(container,fMemoryBlock, fProperties, ImportMemoryDialog.this);
|
|
||||||
|
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the start address properties to a particular value if
|
|
||||||
* and only if we have a fresh/clean properties object.
|
|
||||||
*/
|
|
||||||
static void initProperties(Properties properties, BigInteger addr) {
|
|
||||||
final String addrstr = "0x" + addr.toString(16); //$NON-NLS-1$
|
|
||||||
if (!properties.containsKey(IMemoryImporter.TRANSFER_START)) {
|
|
||||||
properties.setProperty(IMemoryImporter.TRANSFER_START, addrstr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValid(boolean isValid)
|
public void setValid(boolean isValid)
|
||||||
{
|
{
|
||||||
getButton(IDialogConstants.OK_ID).setEnabled(isValid);
|
getButton(IDialogConstants.OK_ID).setEnabled(isValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IMemoryImporter getCurrentImporter() {
|
||||||
|
return fFormatImporters[fFormatCombo.getSelectionIndex()];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCurrentImporter(String id) {
|
||||||
|
if ( id == null || id.length() == 0 ) {
|
||||||
|
fFormatCombo.select(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int index = 0; index< fFormatImporters.length; ++index) {
|
||||||
|
if (fFormatImporters[index].getId().equals(id)){
|
||||||
|
fFormatCombo.select(index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fFormatCombo.select(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.ui.memory.transport;
|
package org.eclipse.cdt.debug.ui.memory.transport;
|
||||||
|
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
@ -61,4 +62,17 @@ public class MemoryTransportPlugin extends AbstractUIPlugin
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get settings section from plugin dialog settings
|
||||||
|
* @param node - required section. Will create a new one if does not exist
|
||||||
|
* @return dialog settings
|
||||||
|
*/
|
||||||
|
public IDialogSettings getDialogSettings(String node) {
|
||||||
|
IDialogSettings nodeSettings = getDialogSettings().getSection(node);
|
||||||
|
if (nodeSettings == null) {
|
||||||
|
nodeSettings = getDialogSettings().addNewSection(node);
|
||||||
|
}
|
||||||
|
return nodeSettings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@ import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryExporter;
|
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryExporter;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -26,11 +24,12 @@ import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
import org.eclipse.debug.core.model.MemoryByte;
|
import org.eclipse.debug.core.model.MemoryByte;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.KeyEvent;
|
import org.eclipse.swt.events.KeyEvent;
|
||||||
import org.eclipse.swt.events.KeyListener;
|
import org.eclipse.swt.events.KeyListener;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
|
||||||
import org.eclipse.swt.layout.FormAttachment;
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
import org.eclipse.swt.layout.FormData;
|
import org.eclipse.swt.layout.FormData;
|
||||||
import org.eclipse.swt.layout.FormLayout;
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
@ -57,9 +56,9 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
|
|
||||||
private ExportMemoryDialog fParentDialog;
|
private ExportMemoryDialog fParentDialog;
|
||||||
|
|
||||||
private Properties fProperties;
|
private IDialogSettings fProperties;
|
||||||
|
|
||||||
public Control createControl(final Composite parent, IMemoryBlock memBlock, Properties properties, ExportMemoryDialog parentDialog)
|
public Control createControl(final Composite parent, IMemoryBlock memBlock, IDialogSettings properties, ExportMemoryDialog parentDialog)
|
||||||
{
|
{
|
||||||
fMemoryBlock = memBlock;
|
fMemoryBlock = memBlock;
|
||||||
fParentDialog = parentDialog;
|
fParentDialog = parentDialog;
|
||||||
|
@ -69,9 +68,9 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
{
|
{
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.setProperty(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
||||||
fProperties.setProperty(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText());
|
||||||
fProperties.setProperty(TRANSFER_END, fEndText.getText());
|
fProperties.put(TRANSFER_END, fEndText.getText());
|
||||||
|
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
fEndAddress = getEndAddress();
|
fEndAddress = getEndAddress();
|
||||||
|
@ -154,26 +153,18 @@ public class PlainTextExporter implements IMemoryExporter {
|
||||||
data.left = new FormAttachment(fFileText);
|
data.left = new FormAttachment(fFileText);
|
||||||
fileButton.setLayoutData(data);
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
|
String textValue = fProperties.get(TRANSFER_FILE);
|
||||||
|
fFileText.setText(textValue != null ? textValue : ""); //$NON-NLS-1$
|
||||||
|
|
||||||
fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$
|
textValue = fProperties.get(TRANSFER_START);
|
||||||
try
|
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
{
|
|
||||||
fStartText.setText(properties.getProperty(TRANSFER_START));
|
textValue = fProperties.get(TRANSFER_END);
|
||||||
fEndText.setText(properties.getProperty(TRANSFER_END));
|
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
|
||||||
}
|
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
||||||
catch(IllegalArgumentException e)
|
|
||||||
{
|
|
||||||
MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
|
||||||
DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
fileButton.addSelectionListener(new SelectionListener() {
|
fileButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE);
|
FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE);
|
||||||
|
|
|
@ -17,7 +17,6 @@ import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryImporter;
|
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryImporter;
|
||||||
|
@ -28,6 +27,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
@ -59,11 +59,11 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
|
|
||||||
private ImportMemoryDialog fParentDialog;
|
private ImportMemoryDialog fParentDialog;
|
||||||
|
|
||||||
private Properties fProperties;
|
private IDialogSettings fProperties;
|
||||||
|
|
||||||
private static final int BUFFER_LENGTH = 64 * 1024;
|
private static final int BUFFER_LENGTH = 64 * 1024;
|
||||||
|
|
||||||
public Control createControl(final Composite parent, IMemoryBlock memBlock, Properties properties, ImportMemoryDialog parentDialog)
|
public Control createControl(final Composite parent, IMemoryBlock memBlock, IDialogSettings properties, ImportMemoryDialog parentDialog)
|
||||||
{
|
{
|
||||||
fMemoryBlock = memBlock;
|
fMemoryBlock = memBlock;
|
||||||
fParentDialog = parentDialog;
|
fParentDialog = parentDialog;
|
||||||
|
@ -75,9 +75,9 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
{
|
{
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.setProperty(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
||||||
fProperties.setProperty(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText());
|
||||||
fProperties.setProperty(TRANSFER_SCROLL_TO_START, Boolean.toString(fScrollToBeginningOnImportComplete.getSelection()));
|
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
|
||||||
|
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
fInputFile = getFile();
|
fInputFile = getFile();
|
||||||
|
@ -138,16 +138,11 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
data.left = new FormAttachment(fFileText);
|
data.left = new FormAttachment(fFileText);
|
||||||
fileButton.setLayoutData(data);
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$
|
String textValue = fProperties.get(TRANSFER_FILE);
|
||||||
try
|
fFileText.setText(textValue != null ? textValue : ""); //$NON-NLS-1$
|
||||||
{
|
|
||||||
fStartText.setText(properties.getProperty(TRANSFER_START));
|
textValue = fProperties.get(TRANSFER_START);
|
||||||
}
|
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
catch(IllegalArgumentException e)
|
|
||||||
{
|
|
||||||
MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
|
||||||
DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
fileButton.addSelectionListener(new SelectionListener() {
|
fileButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
@ -207,7 +202,7 @@ public class PlainTextImporter implements IMemoryImporter {
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fileButton);
|
data.top = new FormAttachment(fileButton);
|
||||||
fScrollToBeginningOnImportComplete.setLayoutData(data);
|
fScrollToBeginningOnImportComplete.setLayoutData(data);
|
||||||
final boolean scrollToStart = Boolean.valueOf(properties.getProperty(TRANSFER_SCROLL_TO_START, Boolean.TRUE.toString())).booleanValue();
|
final boolean scrollToStart = fProperties.getBoolean(TRANSFER_SCROLL_TO_START);
|
||||||
fScrollToBeginningOnImportComplete.setSelection(scrollToStart);
|
fScrollToBeginningOnImportComplete.setSelection(scrollToStart);
|
||||||
|
|
||||||
composite.pack();
|
composite.pack();
|
||||||
|
|
|
@ -15,8 +15,6 @@ import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryExporter;
|
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryExporter;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -26,6 +24,7 @@ import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
import org.eclipse.debug.core.model.MemoryByte;
|
import org.eclipse.debug.core.model.MemoryByte;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.KeyEvent;
|
import org.eclipse.swt.events.KeyEvent;
|
||||||
import org.eclipse.swt.events.KeyListener;
|
import org.eclipse.swt.events.KeyListener;
|
||||||
|
@ -57,9 +56,9 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
|
|
||||||
private ExportMemoryDialog fParentDialog;
|
private ExportMemoryDialog fParentDialog;
|
||||||
|
|
||||||
private Properties fProperties;
|
private IDialogSettings fProperties;
|
||||||
|
|
||||||
public Control createControl(final Composite parent, IMemoryBlock memBlock, Properties properties, ExportMemoryDialog parentDialog)
|
public Control createControl(final Composite parent, IMemoryBlock memBlock, IDialogSettings properties, ExportMemoryDialog parentDialog)
|
||||||
{
|
{
|
||||||
fMemoryBlock = memBlock;
|
fMemoryBlock = memBlock;
|
||||||
fParentDialog = parentDialog;
|
fParentDialog = parentDialog;
|
||||||
|
@ -69,9 +68,9 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
{
|
{
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.setProperty(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
||||||
fProperties.setProperty(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText());
|
||||||
fProperties.setProperty(TRANSFER_END, fEndText.getText());
|
fProperties.put(TRANSFER_END, fEndText.getText());
|
||||||
|
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
fEndAddress = getEndAddress();
|
fEndAddress = getEndAddress();
|
||||||
|
@ -153,18 +152,16 @@ public class RAWBinaryExporter implements IMemoryExporter
|
||||||
data.left = new FormAttachment(fFileText);
|
data.left = new FormAttachment(fFileText);
|
||||||
fileButton.setLayoutData(data);
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$
|
String textValue = fProperties.get(TRANSFER_FILE);
|
||||||
try
|
fFileText.setText(textValue != null ? textValue : ""); //$NON-NLS-1$
|
||||||
{
|
|
||||||
fStartText.setText(properties.getProperty(TRANSFER_START));
|
textValue = fProperties.get(TRANSFER_START);
|
||||||
fEndText.setText(properties.getProperty(TRANSFER_END));
|
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
|
||||||
}
|
textValue = fProperties.get(TRANSFER_END);
|
||||||
catch(IllegalArgumentException e)
|
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
{
|
|
||||||
MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
||||||
DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
fileButton.addSelectionListener(new SelectionListener() {
|
fileButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryImporter;
|
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryImporter;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
@ -25,6 +24,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
@ -56,11 +56,11 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
|
|
||||||
private ImportMemoryDialog fParentDialog;
|
private ImportMemoryDialog fParentDialog;
|
||||||
|
|
||||||
private Properties fProperties;
|
private IDialogSettings fProperties;
|
||||||
|
|
||||||
private static final int BUFFER_LENGTH = 64 * 1024;
|
private static final int BUFFER_LENGTH = 64 * 1024;
|
||||||
|
|
||||||
public Control createControl(final Composite parent, IMemoryBlock memBlock, Properties properties, ImportMemoryDialog parentDialog)
|
public Control createControl(final Composite parent, IMemoryBlock memBlock, IDialogSettings properties, ImportMemoryDialog parentDialog)
|
||||||
{
|
{
|
||||||
fMemoryBlock = memBlock;
|
fMemoryBlock = memBlock;
|
||||||
fParentDialog = parentDialog;
|
fParentDialog = parentDialog;
|
||||||
|
@ -70,9 +70,9 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
{
|
{
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.setProperty(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
||||||
fProperties.setProperty(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText());
|
||||||
fProperties.setProperty(TRANSFER_SCROLL_TO_START, Boolean.toString(fScrollToBeginningOnImportComplete.getSelection()));
|
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
|
||||||
|
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
fInputFile = getFile();
|
fInputFile = getFile();
|
||||||
|
@ -120,16 +120,11 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
data.left = new FormAttachment(fFileText);
|
data.left = new FormAttachment(fFileText);
|
||||||
fileButton.setLayoutData(data);
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$
|
String textValue = fProperties.get(TRANSFER_FILE);
|
||||||
try
|
fFileText.setText(textValue != null ? textValue : ""); //$NON-NLS-1$
|
||||||
{
|
|
||||||
fStartText.setText(properties.getProperty(TRANSFER_START));
|
textValue = fProperties.get(TRANSFER_START);
|
||||||
}
|
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
catch(IllegalArgumentException e)
|
|
||||||
{
|
|
||||||
MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
|
||||||
DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
fileButton.addSelectionListener(new SelectionListener() {
|
fileButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
@ -187,7 +182,7 @@ public class RAWBinaryImporter implements IMemoryImporter {
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fileButton);
|
data.top = new FormAttachment(fileButton);
|
||||||
fScrollToBeginningOnImportComplete.setLayoutData(data);
|
fScrollToBeginningOnImportComplete.setLayoutData(data);
|
||||||
final boolean scrollToStart = Boolean.valueOf(properties.getProperty(TRANSFER_SCROLL_TO_START, Boolean.TRUE.toString())).booleanValue();
|
final boolean scrollToStart = properties.getBoolean(TRANSFER_SCROLL_TO_START);
|
||||||
fScrollToBeginningOnImportComplete.setSelection(scrollToStart);
|
fScrollToBeginningOnImportComplete.setSelection(scrollToStart);
|
||||||
|
|
||||||
composite.pack();
|
composite.pack();
|
||||||
|
|
|
@ -15,8 +15,6 @@ import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryExporter;
|
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryExporter;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -26,6 +24,7 @@ import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
import org.eclipse.debug.core.model.MemoryByte;
|
import org.eclipse.debug.core.model.MemoryByte;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.KeyEvent;
|
import org.eclipse.swt.events.KeyEvent;
|
||||||
import org.eclipse.swt.events.KeyListener;
|
import org.eclipse.swt.events.KeyListener;
|
||||||
|
@ -57,9 +56,9 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
|
|
||||||
private ExportMemoryDialog fParentDialog;
|
private ExportMemoryDialog fParentDialog;
|
||||||
|
|
||||||
private Properties fProperties;
|
private IDialogSettings fProperties;
|
||||||
|
|
||||||
public Control createControl(final Composite parent, IMemoryBlock memBlock, Properties properties, ExportMemoryDialog parentDialog)
|
public Control createControl(final Composite parent, IMemoryBlock memBlock, IDialogSettings properties, ExportMemoryDialog parentDialog)
|
||||||
{
|
{
|
||||||
fMemoryBlock = memBlock;
|
fMemoryBlock = memBlock;
|
||||||
fParentDialog = parentDialog;
|
fParentDialog = parentDialog;
|
||||||
|
@ -69,9 +68,9 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
{
|
{
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.setProperty(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
||||||
fProperties.setProperty(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText());
|
||||||
fProperties.setProperty(TRANSFER_END, fEndText.getText());
|
fProperties.put(TRANSFER_END, fEndText.getText());
|
||||||
|
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
fEndAddress = getEndAddress();
|
fEndAddress = getEndAddress();
|
||||||
|
@ -153,18 +152,16 @@ public class SRecordExporter implements IMemoryExporter
|
||||||
data.left = new FormAttachment(fFileText);
|
data.left = new FormAttachment(fFileText);
|
||||||
fileButton.setLayoutData(data);
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$
|
String textValue = fProperties.get(TRANSFER_FILE);
|
||||||
try
|
fFileText.setText(textValue != null ? textValue : ""); //$NON-NLS-1$
|
||||||
{
|
|
||||||
fStartText.setText(properties.getProperty(TRANSFER_START));
|
textValue = fProperties.get(TRANSFER_START);
|
||||||
fEndText.setText(properties.getProperty(TRANSFER_END));
|
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
|
||||||
}
|
textValue = fProperties.get(TRANSFER_END);
|
||||||
catch(IllegalArgumentException e)
|
fEndText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
{
|
|
||||||
MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
||||||
DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
fileButton.addSelectionListener(new SelectionListener() {
|
fileButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryImporter;
|
import org.eclipse.cdt.debug.ui.memory.transport.model.IMemoryImporter;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
@ -27,6 +26,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
@ -61,11 +61,11 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
|
|
||||||
private ImportMemoryDialog fParentDialog;
|
private ImportMemoryDialog fParentDialog;
|
||||||
|
|
||||||
private Properties fProperties;
|
private IDialogSettings fProperties;
|
||||||
|
|
||||||
private static final int BUFFER_LENGTH = 64 * 1024;
|
private static final int BUFFER_LENGTH = 64 * 1024;
|
||||||
|
|
||||||
public Control createControl(final Composite parent, IMemoryBlock memBlock, Properties properties, ImportMemoryDialog parentDialog)
|
public Control createControl(final Composite parent, IMemoryBlock memBlock, IDialogSettings properties, ImportMemoryDialog parentDialog)
|
||||||
{
|
{
|
||||||
fMemoryBlock = memBlock;
|
fMemoryBlock = memBlock;
|
||||||
fParentDialog = parentDialog;
|
fParentDialog = parentDialog;
|
||||||
|
@ -75,10 +75,10 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
{
|
{
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
fProperties.setProperty(TRANSFER_FILE, fFileText.getText());
|
fProperties.put(TRANSFER_FILE, fFileText.getText());
|
||||||
fProperties.setProperty(TRANSFER_START, fStartText.getText());
|
fProperties.put(TRANSFER_START, fStartText.getText());
|
||||||
fProperties.setProperty(TRANSFER_SCROLL_TO_START, Boolean.toString(fScrollToBeginningOnImportComplete.getSelection()));
|
fProperties.put(TRANSFER_SCROLL_TO_START, fScrollToBeginningOnImportComplete.getSelection());
|
||||||
fProperties.setProperty(TRANSFER_CUSTOM_START_ADDRESS, "" + fComboRestoreToThisAddress.getSelection()); //$NON-NLS-1$
|
fProperties.put(TRANSFER_CUSTOM_START_ADDRESS, fComboRestoreToThisAddress.getSelection());
|
||||||
|
|
||||||
fStartAddress = getStartAddress();
|
fStartAddress = getStartAddress();
|
||||||
fInputFile = getFile();
|
fInputFile = getFile();
|
||||||
|
@ -97,14 +97,14 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
fComboRestoreToFileAddress = new Button(composite, SWT.RADIO);
|
fComboRestoreToFileAddress = new Button(composite, SWT.RADIO);
|
||||||
fComboRestoreToFileAddress.setSelection(true);
|
fComboRestoreToFileAddress.setSelection(true);
|
||||||
fComboRestoreToFileAddress.setText(Messages.getString("SRecordImporter.FileAddressRestore")); //$NON-NLS-1$
|
fComboRestoreToFileAddress.setText(Messages.getString("SRecordImporter.FileAddressRestore")); //$NON-NLS-1$
|
||||||
fComboRestoreToFileAddress.setSelection(!Boolean.getBoolean(properties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, Boolean.FALSE.toString())));
|
fComboRestoreToFileAddress.setSelection(!fProperties.getBoolean(TRANSFER_CUSTOM_START_ADDRESS));
|
||||||
//comboRestoreToFileAddress.setLayoutData(data);
|
//comboRestoreToFileAddress.setLayoutData(data);
|
||||||
|
|
||||||
// restore to this address
|
// restore to this address
|
||||||
|
|
||||||
fComboRestoreToThisAddress = new Button(composite, SWT.RADIO);
|
fComboRestoreToThisAddress = new Button(composite, SWT.RADIO);
|
||||||
fComboRestoreToThisAddress.setText(Messages.getString("SRecordImporter.CustomAddressRestore")); //$NON-NLS-1$
|
fComboRestoreToThisAddress.setText(Messages.getString("SRecordImporter.CustomAddressRestore")); //$NON-NLS-1$
|
||||||
fComboRestoreToThisAddress.setSelection(Boolean.parseBoolean(properties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, Boolean.FALSE.toString())));
|
fComboRestoreToThisAddress.setSelection(fProperties.getBoolean(TRANSFER_CUSTOM_START_ADDRESS));
|
||||||
FormData data = new FormData();
|
FormData data = new FormData();
|
||||||
data.top = new FormAttachment(fComboRestoreToFileAddress);
|
data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||||
fComboRestoreToThisAddress.setLayoutData(data);
|
fComboRestoreToThisAddress.setLayoutData(data);
|
||||||
|
@ -157,16 +157,11 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
data.left = new FormAttachment(fFileText);
|
data.left = new FormAttachment(fFileText);
|
||||||
fileButton.setLayoutData(data);
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$
|
String textValue = fProperties.get(TRANSFER_FILE);
|
||||||
try
|
fFileText.setText(textValue != null ? textValue : ""); //$NON-NLS-1$
|
||||||
{
|
|
||||||
fStartText.setText(properties.getProperty(TRANSFER_START));
|
textValue = fProperties.get(TRANSFER_START);
|
||||||
}
|
fStartText.setText(textValue != null ? textValue : "0x0"); //$NON-NLS-1$
|
||||||
catch(IllegalArgumentException e)
|
|
||||||
{
|
|
||||||
MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
|
||||||
DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
fileButton.addSelectionListener(new SelectionListener() {
|
fileButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
@ -226,7 +221,7 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(fileButton);
|
data.top = new FormAttachment(fileButton);
|
||||||
fScrollToBeginningOnImportComplete.setLayoutData(data);
|
fScrollToBeginningOnImportComplete.setLayoutData(data);
|
||||||
final boolean scrollToStart = Boolean.valueOf(properties.getProperty(TRANSFER_SCROLL_TO_START, Boolean.TRUE.toString())).booleanValue();
|
final boolean scrollToStart = fProperties.getBoolean(TRANSFER_SCROLL_TO_START);
|
||||||
fScrollToBeginningOnImportComplete.setSelection(scrollToStart);
|
fScrollToBeginningOnImportComplete.setSelection(scrollToStart);
|
||||||
|
|
||||||
composite.pack();
|
composite.pack();
|
||||||
|
@ -314,7 +309,7 @@ public class SRecordImporter implements IMemoryImporter {
|
||||||
BigInteger scrollToAddress = null;
|
BigInteger scrollToAddress = null;
|
||||||
|
|
||||||
BigInteger offset = null;
|
BigInteger offset = null;
|
||||||
if(!Boolean.parseBoolean(fProperties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, Boolean.FALSE.toString())))
|
if(!fProperties.getBoolean(TRANSFER_CUSTOM_START_ADDRESS))
|
||||||
offset = BigInteger.ZERO;
|
offset = BigInteger.ZERO;
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fInputFile)));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fInputFile)));
|
||||||
|
|
|
@ -11,10 +11,9 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.ui.memory.transport.model;
|
package org.eclipse.cdt.debug.ui.memory.transport.model;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.ExportMemoryDialog;
|
import org.eclipse.cdt.debug.ui.memory.transport.ExportMemoryDialog;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ public interface IMemoryExporter
|
||||||
* @param parentDialog
|
* @param parentDialog
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Control createControl(Composite parent, IMemoryBlock memBlock, Properties properties, ExportMemoryDialog parentDialog);
|
public Control createControl(Composite parent, IMemoryBlock memBlock, IDialogSettings properties, ExportMemoryDialog parentDialog);
|
||||||
|
|
||||||
public void exportMemory();
|
public void exportMemory();
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,9 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.ui.memory.transport.model;
|
package org.eclipse.cdt.debug.ui.memory.transport.model;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.ImportMemoryDialog;
|
import org.eclipse.cdt.debug.ui.memory.transport.ImportMemoryDialog;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
|
@ -32,7 +31,7 @@ public interface IMemoryImporter
|
||||||
* @param parentDialog
|
* @param parentDialog
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Control createControl(Composite parent, IMemoryBlock memBlock, Properties properties, ImportMemoryDialog parentDialog);
|
public Control createControl(Composite parent, IMemoryBlock memBlock, IDialogSettings properties, ImportMemoryDialog parentDialog);
|
||||||
|
|
||||||
public void importMemory();
|
public void importMemory();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue