mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[232003] Separate memory transport from traditional rendering plugin; support pluggable importers/exporters.
This commit is contained in:
parent
7312a2b778
commit
62c695fba2
30 changed files with 2826 additions and 1233 deletions
|
@ -30,4 +30,11 @@ Memory Renderings
|
||||||
version="0.0.0"
|
version="0.0.0"
|
||||||
unpack="false"/>
|
unpack="false"/>
|
||||||
|
|
||||||
|
<plugin
|
||||||
|
id="org.eclipse.dd.debug.ui.memory.transport"
|
||||||
|
download-size="0"
|
||||||
|
install-size="0"
|
||||||
|
version="0.0.0"
|
||||||
|
unpack="false"/>
|
||||||
|
|
||||||
</feature>
|
</feature>
|
||||||
|
|
|
@ -1,206 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.dd.debug.memory.renderings.actions;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.math.BigInteger;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
|
||||||
import org.eclipse.core.runtime.Status;
|
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
|
||||||
import org.eclipse.debug.core.model.MemoryByte;
|
|
||||||
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
|
||||||
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
|
||||||
import org.eclipse.debug.internal.ui.views.memory.MemoryViewIdRegistry;
|
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
|
||||||
import org.eclipse.jface.action.IAction;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.ui.IViewActionDelegate;
|
|
||||||
import org.eclipse.ui.IViewPart;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action for exporting memory.
|
|
||||||
*/
|
|
||||||
public class ExportMemoryAction implements IViewActionDelegate {
|
|
||||||
|
|
||||||
private MemoryView fView;
|
|
||||||
|
|
||||||
public void init(IViewPart view) {
|
|
||||||
if (view instanceof MemoryView)
|
|
||||||
fView = (MemoryView) view;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run(IAction action) {
|
|
||||||
|
|
||||||
String secondaryId = MemoryViewIdRegistry
|
|
||||||
.getUniqueSecondaryId(IDebugUIConstants.ID_MEMORY_VIEW);
|
|
||||||
|
|
||||||
ISelection selection = fView.getSite().getSelectionProvider()
|
|
||||||
.getSelection();
|
|
||||||
if (selection instanceof IStructuredSelection) {
|
|
||||||
IStructuredSelection strucSel = (IStructuredSelection) selection;
|
|
||||||
|
|
||||||
// return if current selection is empty
|
|
||||||
if (strucSel.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Object obj = strucSel.getFirstElement();
|
|
||||||
|
|
||||||
if (obj == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
IMemoryBlock memBlock = null;
|
|
||||||
|
|
||||||
if (obj instanceof IMemoryRendering) {
|
|
||||||
memBlock = ((IMemoryRendering) obj).getMemoryBlock();
|
|
||||||
} else if (obj instanceof IMemoryBlock) {
|
|
||||||
memBlock = (IMemoryBlock) obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
Shell shell = DebugUIPlugin.getShell();
|
|
||||||
ExportMemoryDialog dialog = new ExportMemoryDialog(shell, memBlock);
|
|
||||||
dialog.open();
|
|
||||||
|
|
||||||
Object results[] = dialog.getResult();
|
|
||||||
|
|
||||||
if(results != null && results.length == 5)
|
|
||||||
{
|
|
||||||
String format = (String) results[0];
|
|
||||||
BigInteger start = (BigInteger) results[1];
|
|
||||||
BigInteger end = (BigInteger) results[2];
|
|
||||||
File file = (File) results[4];
|
|
||||||
|
|
||||||
if("S-Record".equals(format))
|
|
||||||
{
|
|
||||||
exportSRecord(file, start, end, (IMemoryBlockExtension) memBlock); // FIXME
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void exportSRecord(final File outputFile, final BigInteger startAddress, final BigInteger endAddress, final IMemoryBlockExtension memblock)
|
|
||||||
{
|
|
||||||
Job job = new Job("Memory Export to S-Record File"){ //$NON-NLS-1$
|
|
||||||
public IStatus run(IProgressMonitor monitor) {
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// FIXME 4 byte default
|
|
||||||
|
|
||||||
BigInteger DATA_PER_RECORD = BigInteger.valueOf(16);
|
|
||||||
|
|
||||||
BigInteger transferAddress = startAddress;
|
|
||||||
|
|
||||||
FileWriter writer = new FileWriter(outputFile);
|
|
||||||
|
|
||||||
BigInteger jobs = endAddress.subtract(transferAddress).divide(DATA_PER_RECORD);
|
|
||||||
BigInteger factor = BigInteger.ONE;
|
|
||||||
if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0)
|
|
||||||
{
|
|
||||||
factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF));
|
|
||||||
jobs = jobs.divide(factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
monitor.beginTask("Transferring Data", jobs.intValue());
|
|
||||||
|
|
||||||
BigInteger jobCount = BigInteger.ZERO;
|
|
||||||
while(transferAddress.compareTo(endAddress) < 0 && !monitor.isCanceled())
|
|
||||||
{
|
|
||||||
BigInteger length = DATA_PER_RECORD;
|
|
||||||
if(endAddress.subtract(transferAddress).compareTo(length) < 0)
|
|
||||||
length = endAddress.subtract(transferAddress);
|
|
||||||
|
|
||||||
writer.write("S3"); // FIXME 4 byte address
|
|
||||||
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
|
|
||||||
BigInteger sRecordLength = BigInteger.valueOf(4); // address size
|
|
||||||
sRecordLength = sRecordLength.add(length);
|
|
||||||
sRecordLength = sRecordLength.add(BigInteger.ONE); // checksum
|
|
||||||
|
|
||||||
String transferAddressString = transferAddress.toString(16);
|
|
||||||
|
|
||||||
String lengthString = sRecordLength.toString(16);
|
|
||||||
if(lengthString.length() == 1)
|
|
||||||
buf.append("0");
|
|
||||||
buf.append(lengthString);
|
|
||||||
for(int i = 0; i < 8 - transferAddressString.length(); i++)
|
|
||||||
buf.append("0");
|
|
||||||
buf.append(transferAddressString);
|
|
||||||
|
|
||||||
// data
|
|
||||||
|
|
||||||
MemoryByte bytes[] = memblock.getBytesFromAddress(transferAddress,
|
|
||||||
length.longValue() / memblock.getAddressableSize());
|
|
||||||
for(MemoryByte b : bytes)
|
|
||||||
{
|
|
||||||
String bString = BigInteger.valueOf(0xFF & b.getValue()).toString(16);
|
|
||||||
if(bString.length() == 1)
|
|
||||||
buf.append("0");
|
|
||||||
buf.append(bString);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The least significant byte of the one's complement of the sum of the values
|
|
||||||
* represented by the pairs of characters making up the records length, address,
|
|
||||||
* and the code/data fields.
|
|
||||||
*/
|
|
||||||
byte checksum = 0;
|
|
||||||
|
|
||||||
for(int i = 0; i < buf.length(); i+=2)
|
|
||||||
{
|
|
||||||
BigInteger value = new BigInteger(buf.substring(i, i+2), 16);
|
|
||||||
checksum += value.byteValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
buf.append(BigInteger.valueOf(0xFF - checksum).and(BigInteger.valueOf(0xFF)).toString(16));
|
|
||||||
|
|
||||||
writer.write(buf.toString().toUpperCase());
|
|
||||||
writer.write("\n");
|
|
||||||
|
|
||||||
transferAddress = transferAddress.add(length);
|
|
||||||
|
|
||||||
jobCount = jobCount.add(BigInteger.ONE);
|
|
||||||
if(jobCount.compareTo(factor) == 0)
|
|
||||||
{
|
|
||||||
jobCount = BigInteger.ZERO;
|
|
||||||
monitor.worked(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.close();
|
|
||||||
monitor.done();
|
|
||||||
}
|
|
||||||
catch(Exception e) { e.printStackTrace();}
|
|
||||||
}
|
|
||||||
catch(Exception e) {e.printStackTrace();}
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}};
|
|
||||||
job.setUser(true);
|
|
||||||
job.schedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void selectionChanged(IAction action, ISelection selection) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,400 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2006-2007 Wind River Systems, Inc. and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.dd.debug.memory.renderings.actions;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.math.BigInteger;
|
|
||||||
|
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
|
||||||
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.events.FocusEvent;
|
|
||||||
import org.eclipse.swt.events.FocusListener;
|
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
|
||||||
import org.eclipse.swt.events.VerifyEvent;
|
|
||||||
import org.eclipse.swt.events.VerifyListener;
|
|
||||||
import org.eclipse.swt.layout.FormAttachment;
|
|
||||||
import org.eclipse.swt.layout.FormData;
|
|
||||||
import org.eclipse.swt.layout.FormLayout;
|
|
||||||
import org.eclipse.swt.widgets.Button;
|
|
||||||
import org.eclipse.swt.widgets.Combo;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Display;
|
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
|
||||||
import org.eclipse.ui.PlatformUI;
|
|
||||||
import org.eclipse.ui.dialogs.SelectionDialog;
|
|
||||||
|
|
||||||
public class ExportMemoryDialog extends SelectionDialog
|
|
||||||
{
|
|
||||||
|
|
||||||
private Combo formatCombo;
|
|
||||||
|
|
||||||
private IMemoryBlock fMemoryBlock;
|
|
||||||
|
|
||||||
private Text startText;
|
|
||||||
private Text endText;
|
|
||||||
private Text lengthText;
|
|
||||||
private Text fileText;
|
|
||||||
|
|
||||||
public ExportMemoryDialog(Shell parent, IMemoryBlock memoryBlock)
|
|
||||||
{
|
|
||||||
super(parent);
|
|
||||||
super.setTitle("Export Memory");
|
|
||||||
setShellStyle(getShellStyle() | SWT.RESIZE);
|
|
||||||
|
|
||||||
fMemoryBlock = memoryBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
protected void createButtonsForButtonBar(Composite parent) {
|
|
||||||
super.createButtonsForButtonBar(parent);
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.dialogs.SelectionDialog#getResult()
|
|
||||||
*/
|
|
||||||
public Object[] getResult() {
|
|
||||||
|
|
||||||
Object[] results = super.getResult();
|
|
||||||
|
|
||||||
if (results != null)
|
|
||||||
{
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
return new Object[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
|
|
||||||
*/
|
|
||||||
protected void cancelPressed() {
|
|
||||||
|
|
||||||
setResult(null);
|
|
||||||
|
|
||||||
super.cancelPressed();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
|
|
||||||
*/
|
|
||||||
protected void okPressed() {
|
|
||||||
setSelectionResult(new Object[]{ getFormat(), getStartAddress(), getEndAddress(), getLength(), getFile() });
|
|
||||||
|
|
||||||
super.okPressed();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFormat()
|
|
||||||
{
|
|
||||||
return formatCombo.getItem(formatCombo.getSelectionIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigInteger getEndAddress()
|
|
||||||
{
|
|
||||||
String text = endText.getText();
|
|
||||||
boolean hex = text.startsWith("0x");
|
|
||||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
|
||||||
hex ? 16 : 10);
|
|
||||||
|
|
||||||
return endAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigInteger getStartAddress()
|
|
||||||
{
|
|
||||||
String text = startText.getText();
|
|
||||||
boolean hex = text.startsWith("0x");
|
|
||||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
|
||||||
hex ? 16 : 10);
|
|
||||||
|
|
||||||
return startAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigInteger getLength()
|
|
||||||
{
|
|
||||||
String text = lengthText.getText();
|
|
||||||
boolean hex = text.startsWith("0x");
|
|
||||||
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
|
||||||
hex ? 16 : 10);
|
|
||||||
|
|
||||||
return lengthAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getFile()
|
|
||||||
{
|
|
||||||
return new File(fileText.getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validate()
|
|
||||||
{
|
|
||||||
boolean isValid = true;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
getEndAddress();
|
|
||||||
|
|
||||||
getStartAddress();
|
|
||||||
|
|
||||||
BigInteger length = getLength();
|
|
||||||
|
|
||||||
if(length.compareTo(BigInteger.ZERO) <= 0)
|
|
||||||
isValid = false;
|
|
||||||
|
|
||||||
if(!getFile().getParentFile().exists())
|
|
||||||
isValid = false;
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
isValid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
getButton(IDialogConstants.OK_ID).setEnabled(isValid);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
protected Control createDialogArea(Composite parent) {
|
|
||||||
|
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, DebugUIPlugin.getUniqueIdentifier() + ".AddMemoryRenderingDialog_context"); //$NON-NLS-1$ // FIXME
|
|
||||||
Composite composite = new Composite(parent, SWT.NONE);
|
|
||||||
FormLayout formLayout = new FormLayout();
|
|
||||||
formLayout.spacing = 5;
|
|
||||||
formLayout.marginWidth = formLayout.marginHeight = 9;
|
|
||||||
composite.setLayout(formLayout);
|
|
||||||
|
|
||||||
// format
|
|
||||||
|
|
||||||
Label textLabel = new Label(composite, SWT.NONE);
|
|
||||||
textLabel.setText("Format: ");
|
|
||||||
|
|
||||||
formatCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
|
|
||||||
|
|
||||||
FormData data = new FormData();
|
|
||||||
data.top = new FormAttachment(formatCombo, 0, SWT.CENTER);
|
|
||||||
textLabel.setLayoutData(data);
|
|
||||||
|
|
||||||
data = new FormData();
|
|
||||||
data.left = new FormAttachment(textLabel);
|
|
||||||
formatCombo.setLayoutData(data);
|
|
||||||
formatCombo.setItems( new String[] { "S-Record" }); // TODO offer extension point
|
|
||||||
formatCombo.select(0);
|
|
||||||
|
|
||||||
// start address
|
|
||||||
|
|
||||||
Label startLabel = new Label(composite, SWT.NONE);
|
|
||||||
startLabel.setText("Start address: ");
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(formatCombo);
|
|
||||||
startLabel.setLayoutData(data);
|
|
||||||
|
|
||||||
startText = new Text(composite, SWT.NONE);
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(formatCombo);
|
|
||||||
data.left = new FormAttachment(startLabel);
|
|
||||||
data.width = 100;
|
|
||||||
startText.setLayoutData(data);
|
|
||||||
|
|
||||||
// end address
|
|
||||||
|
|
||||||
Label endLabel = new Label(composite, SWT.NONE);
|
|
||||||
endLabel.setText("End address: ");
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(startText, 0, SWT.CENTER);
|
|
||||||
data.left = new FormAttachment(startText);
|
|
||||||
endLabel.setLayoutData(data);
|
|
||||||
|
|
||||||
endText = new Text(composite, SWT.NONE);
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(startText, 0, SWT.CENTER);
|
|
||||||
data.left = new FormAttachment(endLabel);
|
|
||||||
data.width = 100;
|
|
||||||
endText.setLayoutData(data);
|
|
||||||
|
|
||||||
// length
|
|
||||||
|
|
||||||
Label lengthLabel = new Label(composite, SWT.NONE);
|
|
||||||
lengthLabel.setText("Length: ");
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(startText, 0, SWT.CENTER);
|
|
||||||
data.left = new FormAttachment(endText);
|
|
||||||
lengthLabel.setLayoutData(data);
|
|
||||||
|
|
||||||
lengthText = new Text(composite, SWT.NONE);
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(startText, 0, SWT.CENTER);
|
|
||||||
data.left = new FormAttachment(lengthLabel);
|
|
||||||
data.width = 100;
|
|
||||||
lengthText.setLayoutData(data);
|
|
||||||
|
|
||||||
// file
|
|
||||||
|
|
||||||
Label fileLabel = new Label(composite, SWT.NONE);
|
|
||||||
fileText = new Text(composite, SWT.NONE);
|
|
||||||
Button fileButton = new Button(composite, SWT.PUSH);
|
|
||||||
|
|
||||||
fileLabel.setText("File name: ");
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
|
||||||
fileLabel.setLayoutData(data);
|
|
||||||
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
|
||||||
data.left = new FormAttachment(fileLabel);
|
|
||||||
data.width = 300;
|
|
||||||
fileText.setLayoutData(data);
|
|
||||||
|
|
||||||
fileButton.setText("Browse...");
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(lengthText);
|
|
||||||
data.left = new FormAttachment(fileText);
|
|
||||||
fileButton.setLayoutData(data);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
BigInteger startAddress = null;
|
|
||||||
if(fMemoryBlock instanceof IMemoryBlockExtension)
|
|
||||||
startAddress = ((IMemoryBlockExtension) fMemoryBlock)
|
|
||||||
.getBigBaseAddress(); // FIXME use selection/caret address?
|
|
||||||
else
|
|
||||||
startAddress = BigInteger.valueOf(fMemoryBlock.getStartAddress());
|
|
||||||
|
|
||||||
startText.setText("0x" + startAddress.toString(16));
|
|
||||||
endText.setText("0x" + startAddress.toString(16));
|
|
||||||
lengthText.setText("0");
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
fileButton.addSelectionListener(new SelectionListener() {
|
|
||||||
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
FileDialog dialog = new FileDialog(ExportMemoryDialog.this.getShell(), SWT.SAVE);
|
|
||||||
dialog.setText("Choose memory export file");
|
|
||||||
dialog.setFilterExtensions(new String[] { "*.*" } );
|
|
||||||
dialog.setFilterNames(new String[] { "All Files (*.*)" } );
|
|
||||||
dialog.setFileName(fileText.getText());
|
|
||||||
dialog.open();
|
|
||||||
|
|
||||||
if(dialog.getFileName() != null)
|
|
||||||
{
|
|
||||||
fileText.setText(dialog.getFilterPath() + File.separator + dialog.getFileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
startText.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
boolean valid = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
getStartAddress();
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
valid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
startText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK) :
|
|
||||||
Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
BigInteger endAddress = getEndAddress();
|
|
||||||
BigInteger startAddress = getStartAddress();
|
|
||||||
|
|
||||||
lengthText.setText(endAddress.subtract(startAddress).toString());
|
|
||||||
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
endText.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
try
|
|
||||||
{
|
|
||||||
getEndAddress();
|
|
||||||
endText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
|
||||||
|
|
||||||
BigInteger endAddress = getEndAddress();
|
|
||||||
BigInteger startAddress = getStartAddress();
|
|
||||||
|
|
||||||
String lengthString = endAddress.subtract(startAddress).toString();
|
|
||||||
|
|
||||||
if(!lengthText.getText().equals(lengthString))
|
|
||||||
lengthText.setText(lengthString);
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
endText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
|
||||||
}
|
|
||||||
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
lengthText.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
try
|
|
||||||
{
|
|
||||||
BigInteger length = getLength();
|
|
||||||
lengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
|
||||||
BigInteger startAddress = getStartAddress();
|
|
||||||
String endString = "0x" + startAddress.add(length).toString(16);
|
|
||||||
if(!endText.getText().equals(endString))
|
|
||||||
endText.setText(endString);
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
lengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
|
||||||
}
|
|
||||||
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
fileText.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return composite;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -58,30 +58,30 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
final static int preFetchSize = 10 * 1024;
|
final static int preFetchSize = 10 * 1024;
|
||||||
|
|
||||||
private Text findText;
|
private Text fFindText;
|
||||||
private Text replaceText;
|
private Text fReplaceText;
|
||||||
|
|
||||||
private Combo startText;
|
private Combo fStartText;
|
||||||
private Combo endText;
|
private Combo fEndText;
|
||||||
|
|
||||||
private Button findButton;
|
private Button fFindButton;
|
||||||
private Button replaceButton;
|
private Button fReplaceButton;
|
||||||
private Button replaceFindButton;
|
private Button fReplaceFindButton;
|
||||||
private Button replaceAllButton;
|
private Button fReplaceAllButton;
|
||||||
private Button closeButton;
|
private Button fCloseButton;
|
||||||
|
|
||||||
private MemoryView fMemoryView;
|
private MemoryView fMemoryView;
|
||||||
|
|
||||||
Button formatAsciiButton;
|
Button fFormatAsciiButton;
|
||||||
Button formatHexButton;
|
Button fFormatHexButton;
|
||||||
Button formatOctalButton;
|
Button fFormatOctalButton;
|
||||||
Button formatBinaryButton;
|
Button fFormatBinaryButton;
|
||||||
Button formatDecimalButton;
|
Button fFormatDecimalButton;
|
||||||
Button formatByteSequenceButton;
|
Button fFormatByteSequenceButton;
|
||||||
|
|
||||||
Button caseInSensitiveCheckbox;
|
Button fCaseInSensitiveCheckbox;
|
||||||
|
|
||||||
Button forwardButton;
|
Button fForwardButton;
|
||||||
|
|
||||||
public FindReplaceDialog(Shell parent, IMemoryBlockExtension memoryBlock, MemoryView memoryView)
|
public FindReplaceDialog(Shell parent, IMemoryBlockExtension memoryBlock, MemoryView memoryView)
|
||||||
{
|
{
|
||||||
|
@ -96,7 +96,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
private BigInteger getUserStart()
|
private BigInteger getUserStart()
|
||||||
{
|
{
|
||||||
String start = startText.getText();
|
String start = fStartText.getText();
|
||||||
if(start.toUpperCase().startsWith("0X")) //$NON-NLS-1$
|
if(start.toUpperCase().startsWith("0X")) //$NON-NLS-1$
|
||||||
start = start.substring(2);
|
start = start.substring(2);
|
||||||
return new BigInteger(start, 16);
|
return new BigInteger(start, 16);
|
||||||
|
@ -104,7 +104,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
private BigInteger getUserEnd()
|
private BigInteger getUserEnd()
|
||||||
{
|
{
|
||||||
String end = endText.getText();
|
String end = fEndText.getText();
|
||||||
if(end.toUpperCase().startsWith("0X")) //$NON-NLS-1$
|
if(end.toUpperCase().startsWith("0X")) //$NON-NLS-1$
|
||||||
end = end.substring(2);
|
end = end.substring(2);
|
||||||
return new BigInteger(end, 16);
|
return new BigInteger(end, 16);
|
||||||
|
@ -112,39 +112,39 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
private boolean getIsDirectionForward()
|
private boolean getIsDirectionForward()
|
||||||
{
|
{
|
||||||
return forwardButton.getSelection();
|
return fForwardButton.getSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SearchPhrase getSearchPhrase()
|
private SearchPhrase getSearchPhrase()
|
||||||
{
|
{
|
||||||
SearchPhrase phrase = null;
|
SearchPhrase phrase = null;
|
||||||
|
|
||||||
if(formatAsciiButton.getSelection())
|
if(fFormatAsciiButton.getSelection())
|
||||||
{
|
{
|
||||||
phrase = new AsciiSearchPhrase(findText.getText(), caseInSensitiveCheckbox.getSelection());
|
phrase = new AsciiSearchPhrase(fFindText.getText(), fCaseInSensitiveCheckbox.getSelection());
|
||||||
}
|
}
|
||||||
else if(formatHexButton.getSelection())
|
else if(fFormatHexButton.getSelection())
|
||||||
{
|
{
|
||||||
phrase = new BigIntegerSearchPhrase(new BigInteger(findText.getText().toUpperCase().startsWith("0X")
|
phrase = new BigIntegerSearchPhrase(new BigInteger(fFindText.getText().toUpperCase().startsWith("0X")
|
||||||
? findText.getText().substring(2) : findText.getText(), 16), 16);
|
? fFindText.getText().substring(2) : fFindText.getText(), 16), 16);
|
||||||
}
|
}
|
||||||
else if(formatOctalButton.getSelection())
|
else if(fFormatOctalButton.getSelection())
|
||||||
{
|
{
|
||||||
phrase = new BigIntegerSearchPhrase(new BigInteger(findText.getText().startsWith("0")
|
phrase = new BigIntegerSearchPhrase(new BigInteger(fFindText.getText().startsWith("0")
|
||||||
? findText.getText().substring(1) : findText.getText(), 8), 8);
|
? fFindText.getText().substring(1) : fFindText.getText(), 8), 8);
|
||||||
}
|
}
|
||||||
else if(formatBinaryButton.getSelection())
|
else if(fFormatBinaryButton.getSelection())
|
||||||
{
|
{
|
||||||
phrase = new BigIntegerSearchPhrase(new BigInteger(findText.getText().toUpperCase().startsWith("0B")
|
phrase = new BigIntegerSearchPhrase(new BigInteger(fFindText.getText().toUpperCase().startsWith("0B")
|
||||||
? findText.getText().substring(2) : findText.getText(), 2), 2);
|
? fFindText.getText().substring(2) : fFindText.getText(), 2), 2);
|
||||||
}
|
}
|
||||||
else if(formatDecimalButton.getSelection())
|
else if(fFormatDecimalButton.getSelection())
|
||||||
{
|
{
|
||||||
phrase = new BigIntegerSearchPhrase(new BigInteger(findText.getText(), 10), 10);
|
phrase = new BigIntegerSearchPhrase(new BigInteger(fFindText.getText(), 10), 10);
|
||||||
}
|
}
|
||||||
else if(formatByteSequenceButton.getSelection())
|
else if(fFormatByteSequenceButton.getSelection())
|
||||||
{
|
{
|
||||||
phrase = new ByteSequenceSearchPhrase(findText.getText());
|
phrase = new ByteSequenceSearchPhrase(fFindText.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
return phrase;
|
return phrase;
|
||||||
|
@ -181,18 +181,18 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
private byte[] getReplaceData()
|
private byte[] getReplaceData()
|
||||||
{
|
{
|
||||||
if(formatAsciiButton.getSelection())
|
if(fFormatAsciiButton.getSelection())
|
||||||
return replaceText.getText().getBytes();
|
return fReplaceText.getText().getBytes();
|
||||||
else if(formatHexButton.getSelection())
|
else if(fFormatHexButton.getSelection())
|
||||||
return removeZeroPrefixByte(new BigInteger(replaceText.getText().toUpperCase().startsWith("0X") ? replaceText.getText().substring(2) : replaceText.getText(), 16).toByteArray());
|
return removeZeroPrefixByte(new BigInteger(fReplaceText.getText().toUpperCase().startsWith("0X") ? fReplaceText.getText().substring(2) : fReplaceText.getText(), 16).toByteArray());
|
||||||
else if(formatOctalButton.getSelection())
|
else if(fFormatOctalButton.getSelection())
|
||||||
return removeZeroPrefixByte(new BigInteger(replaceText.getText().startsWith("0") ? replaceText.getText().substring(1) : replaceText.getText(), 8).toByteArray());
|
return removeZeroPrefixByte(new BigInteger(fReplaceText.getText().startsWith("0") ? fReplaceText.getText().substring(1) : fReplaceText.getText(), 8).toByteArray());
|
||||||
else if(formatBinaryButton.getSelection())
|
else if(fFormatBinaryButton.getSelection())
|
||||||
return removeZeroPrefixByte(new BigInteger(replaceText.getText().toUpperCase().startsWith("0B") ? replaceText.getText().substring(2) : replaceText.getText(), 2).toByteArray());
|
return removeZeroPrefixByte(new BigInteger(fReplaceText.getText().toUpperCase().startsWith("0B") ? fReplaceText.getText().substring(2) : fReplaceText.getText(), 2).toByteArray());
|
||||||
else if(formatDecimalButton.getSelection())
|
else if(fFormatDecimalButton.getSelection())
|
||||||
return removeZeroPrefixByte(new BigInteger(replaceText.getText(), 10).toByteArray());
|
return removeZeroPrefixByte(new BigInteger(fReplaceText.getText(), 10).toByteArray());
|
||||||
else if(formatByteSequenceButton.getSelection())
|
else if(fFormatByteSequenceButton.getSelection())
|
||||||
return parseByteSequence(replaceText.getText());
|
return parseByteSequence(fReplaceText.getText());
|
||||||
|
|
||||||
return new byte[0];
|
return new byte[0];
|
||||||
}
|
}
|
||||||
|
@ -201,8 +201,8 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
||||||
*/
|
*/
|
||||||
protected void createButtonsForButtonBar(Composite parent) {
|
protected void createButtonsForButtonBar(Composite parent) {
|
||||||
findButton = createButton(parent, 10, Messages.getString("FindReplaceDialog.ButtonFind"), true); //$NON-NLS-1$
|
fFindButton = createButton(parent, 10, Messages.getString("FindReplaceDialog.ButtonFind"), true); //$NON-NLS-1$
|
||||||
findButton.addSelectionListener(new SelectionListener()
|
fFindButton.addSelectionListener(new SelectionListener()
|
||||||
{
|
{
|
||||||
public void widgetDefaultSelected(SelectionEvent e) { }
|
public void widgetDefaultSelected(SelectionEvent e) { }
|
||||||
|
|
||||||
|
@ -212,8 +212,8 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
replaceFindButton = createButton(parent, 11, Messages.getString("FindReplaceDialog.ButtonReplaceFind"), false); //$NON-NLS-1$
|
fReplaceFindButton = createButton(parent, 11, Messages.getString("FindReplaceDialog.ButtonReplaceFind"), false); //$NON-NLS-1$
|
||||||
replaceFindButton.addSelectionListener(new SelectionListener()
|
fReplaceFindButton.addSelectionListener(new SelectionListener()
|
||||||
{
|
{
|
||||||
public void widgetDefaultSelected(SelectionEvent e) { }
|
public void widgetDefaultSelected(SelectionEvent e) { }
|
||||||
|
|
||||||
|
@ -223,8 +223,8 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
replaceButton = createButton(parent, 12, Messages.getString("FindReplaceDialog.ButtonReplace"), false); //$NON-NLS-1$
|
fReplaceButton = createButton(parent, 12, Messages.getString("FindReplaceDialog.ButtonReplace"), false); //$NON-NLS-1$
|
||||||
replaceButton.addSelectionListener(new SelectionListener()
|
fReplaceButton.addSelectionListener(new SelectionListener()
|
||||||
{
|
{
|
||||||
public void widgetDefaultSelected(SelectionEvent e) { }
|
public void widgetDefaultSelected(SelectionEvent e) { }
|
||||||
|
|
||||||
|
@ -234,8 +234,8 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
replaceAllButton = createButton(parent, 13, Messages.getString("FindReplaceDialog.ButtonReplaceAll"), false); //$NON-NLS-1$
|
fReplaceAllButton = createButton(parent, 13, Messages.getString("FindReplaceDialog.ButtonReplaceAll"), false); //$NON-NLS-1$
|
||||||
replaceAllButton.addSelectionListener(new SelectionListener()
|
fReplaceAllButton.addSelectionListener(new SelectionListener()
|
||||||
{
|
{
|
||||||
public void widgetDefaultSelected(SelectionEvent e) { }
|
public void widgetDefaultSelected(SelectionEvent e) { }
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
closeButton = createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("FindReplaceDialog.Close"), false); //$NON-NLS-1$
|
fCloseButton = createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("FindReplaceDialog.Close"), false); //$NON-NLS-1$
|
||||||
|
|
||||||
((GridLayout) parent.getLayout()).numColumns = 2;
|
((GridLayout) parent.getLayout()).numColumns = 2;
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
public BigInteger getEndAddress()
|
public BigInteger getEndAddress()
|
||||||
{
|
{
|
||||||
String text = endText.getText();
|
String text = fEndText.getText();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -297,7 +297,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
public BigInteger getStartAddress()
|
public BigInteger getStartAddress()
|
||||||
{
|
{
|
||||||
String text = startText.getText();
|
String text = fStartText.getText();
|
||||||
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
boolean hex = text.startsWith("0x"); //$NON-NLS-1$
|
||||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
hex ? 16 : 10);
|
hex ? 16 : 10);
|
||||||
|
@ -325,10 +325,10 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
findButton.setEnabled(valid);
|
fFindButton.setEnabled(valid);
|
||||||
replaceButton.setEnabled(replaceValid);
|
fReplaceButton.setEnabled(replaceValid);
|
||||||
replaceFindButton.setEnabled(replaceValid);
|
fReplaceFindButton.setEnabled(replaceValid);
|
||||||
replaceAllButton.setEnabled(replaceValid);
|
fReplaceAllButton.setEnabled(replaceValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String pad(int characterCount, String value)
|
private String pad(int characterCount, String value)
|
||||||
|
@ -451,32 +451,32 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
Label findLabel = new Label(composite, SWT.NONE);
|
Label findLabel = new Label(composite, SWT.NONE);
|
||||||
Label replaceLabel = new Label(composite, SWT.NONE);
|
Label replaceLabel = new Label(composite, SWT.NONE);
|
||||||
replaceText = new Text(composite, SWT.BORDER);
|
fReplaceText = new Text(composite, SWT.BORDER);
|
||||||
|
|
||||||
findLabel.setText(Messages.getString("FindReplaceDialog.LabelFind")); //$NON-NLS-1$
|
findLabel.setText(Messages.getString("FindReplaceDialog.LabelFind")); //$NON-NLS-1$
|
||||||
|
|
||||||
findText = new Text(composite, SWT.BORDER);
|
fFindText = new Text(composite, SWT.BORDER);
|
||||||
FormData data = new FormData();
|
FormData data = new FormData();
|
||||||
data.left = new FormAttachment(replaceText, 0, SWT.LEFT);
|
data.left = new FormAttachment(fReplaceText, 0, SWT.LEFT);
|
||||||
data.width = 260;
|
data.width = 260;
|
||||||
findText.setLayoutData(data);
|
fFindText.setLayoutData(data);
|
||||||
|
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(findText, 0, SWT.CENTER);
|
data.top = new FormAttachment(fFindText, 0, SWT.CENTER);
|
||||||
findLabel.setLayoutData(data);
|
findLabel.setLayoutData(data);
|
||||||
|
|
||||||
// replace
|
// replace
|
||||||
|
|
||||||
replaceLabel.setText(Messages.getString("FindReplaceDialog.LabelReplaceWith")); //$NON-NLS-1$
|
replaceLabel.setText(Messages.getString("FindReplaceDialog.LabelReplaceWith")); //$NON-NLS-1$
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(findText);
|
data.top = new FormAttachment(fFindText);
|
||||||
replaceLabel.setLayoutData(data);
|
replaceLabel.setLayoutData(data);
|
||||||
|
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(replaceLabel, 0, SWT.CENTER);
|
data.top = new FormAttachment(replaceLabel, 0, SWT.CENTER);
|
||||||
data.left = new FormAttachment(replaceLabel);
|
data.left = new FormAttachment(replaceLabel);
|
||||||
data.width = 260;
|
data.width = 260;
|
||||||
replaceText.setLayoutData(data);
|
fReplaceText.setLayoutData(data);
|
||||||
|
|
||||||
// group direction
|
// group direction
|
||||||
|
|
||||||
|
@ -489,13 +489,13 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
layout.numColumns = 1;
|
layout.numColumns = 1;
|
||||||
directionGroup.setLayout(layout);
|
directionGroup.setLayout(layout);
|
||||||
|
|
||||||
forwardButton = new Button(directionGroup, SWT.RADIO);
|
fForwardButton = new Button(directionGroup, SWT.RADIO);
|
||||||
forwardButton.setText(Messages.getString("FindReplaceDialog.ButtonForward")); //$NON-NLS-1$
|
fForwardButton.setText(Messages.getString("FindReplaceDialog.ButtonForward")); //$NON-NLS-1$
|
||||||
Button backwardButton = new Button(directionGroup, SWT.RADIO);
|
Button backwardButton = new Button(directionGroup, SWT.RADIO);
|
||||||
backwardButton.setText(Messages.getString("FindReplaceDialog.ButtonBackward")); //$NON-NLS-1$
|
backwardButton.setText(Messages.getString("FindReplaceDialog.ButtonBackward")); //$NON-NLS-1$
|
||||||
|
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(replaceText);
|
data.top = new FormAttachment(fReplaceText);
|
||||||
data.right = new FormAttachment(formatGroup, 0, SWT.RIGHT);
|
data.right = new FormAttachment(formatGroup, 0, SWT.RIGHT);
|
||||||
data.left = new FormAttachment(formatGroup, 0, SWT.LEFT);
|
data.left = new FormAttachment(formatGroup, 0, SWT.LEFT);
|
||||||
data.bottom = new FormAttachment(rangeGroup, 0, SWT.BOTTOM);
|
data.bottom = new FormAttachment(rangeGroup, 0, SWT.BOTTOM);
|
||||||
|
@ -515,32 +515,32 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
Label startLabel = new Label(rangeGroup, SWT.NONE);
|
Label startLabel = new Label(rangeGroup, SWT.NONE);
|
||||||
startLabel.setText(Messages.getString("FindReplaceDialog.LabelStartAddress")); //$NON-NLS-1$
|
startLabel.setText(Messages.getString("FindReplaceDialog.LabelStartAddress")); //$NON-NLS-1$
|
||||||
|
|
||||||
startText = new Combo(rangeGroup, SWT.BORDER);
|
fStartText = new Combo(rangeGroup, SWT.BORDER);
|
||||||
GridData gridData = new GridData();
|
GridData gridData = new GridData();
|
||||||
gridData.widthHint = 200;
|
gridData.widthHint = 200;
|
||||||
gridData.grabExcessHorizontalSpace = true;
|
gridData.grabExcessHorizontalSpace = true;
|
||||||
startText.setLayoutData(gridData);
|
fStartText.setLayoutData(gridData);
|
||||||
|
|
||||||
// group range - end address
|
// group range - end address
|
||||||
|
|
||||||
Label endLabel = new Label(rangeGroup, SWT.NONE);
|
Label endLabel = new Label(rangeGroup, SWT.NONE);
|
||||||
endLabel.setText(Messages.getString("FindReplaceDialog.LabelEndAddress")); //$NON-NLS-1$
|
endLabel.setText(Messages.getString("FindReplaceDialog.LabelEndAddress")); //$NON-NLS-1$
|
||||||
endText = new Combo(rangeGroup, SWT.BORDER);
|
fEndText = new Combo(rangeGroup, SWT.BORDER);
|
||||||
gridData = new GridData();
|
gridData = new GridData();
|
||||||
gridData.widthHint = 200;
|
gridData.widthHint = 200;
|
||||||
gridData.grabExcessHorizontalSpace = true;
|
gridData.grabExcessHorizontalSpace = true;
|
||||||
endText.setLayoutData(gridData);
|
fEndText.setLayoutData(gridData);
|
||||||
|
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.left = new FormAttachment(directionGroup);
|
data.left = new FormAttachment(directionGroup);
|
||||||
data.top = new FormAttachment(directionGroup, 0, SWT.TOP);
|
data.top = new FormAttachment(directionGroup, 0, SWT.TOP);
|
||||||
data.right = new FormAttachment(findText, 0, SWT.RIGHT);
|
data.right = new FormAttachment(fFindText, 0, SWT.RIGHT);
|
||||||
rangeGroup.setLayoutData(data);
|
rangeGroup.setLayoutData(data);
|
||||||
|
|
||||||
startText.setItems(removeNullElements(new String[] { getViewportStart(), getStart(), getEnd(), getMemoryBlockBaseAddress() }));
|
fStartText.setItems(removeNullElements(new String[] { getViewportStart(), getStart(), getEnd(), getMemoryBlockBaseAddress() }));
|
||||||
endText.setItems(removeNullElements(new String[] { getEnd(), getStart(), getMemoryBlockBaseAddress(), getViewportStart() }));
|
fEndText.setItems(removeNullElements(new String[] { getEnd(), getStart(), getMemoryBlockBaseAddress(), getViewportStart() }));
|
||||||
startText.select(0);
|
fStartText.select(0);
|
||||||
endText.select(0);
|
fEndText.select(0);
|
||||||
|
|
||||||
// format group
|
// format group
|
||||||
|
|
||||||
|
@ -549,23 +549,23 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
layout.numColumns = 1;
|
layout.numColumns = 1;
|
||||||
formatGroup.setLayout(layout);
|
formatGroup.setLayout(layout);
|
||||||
|
|
||||||
formatAsciiButton = new Button(formatGroup, SWT.RADIO);
|
fFormatAsciiButton = new Button(formatGroup, SWT.RADIO);
|
||||||
formatAsciiButton.setText(Messages.getString("FindReplaceDialog.ButtonASCII")); //$NON-NLS-1$
|
fFormatAsciiButton.setText(Messages.getString("FindReplaceDialog.ButtonASCII")); //$NON-NLS-1$
|
||||||
|
|
||||||
formatHexButton = new Button(formatGroup, SWT.RADIO);
|
fFormatHexButton = new Button(formatGroup, SWT.RADIO);
|
||||||
formatHexButton.setText(Messages.getString("FindReplaceDialog.ButtonHexadecimal")); //$NON-NLS-1$
|
fFormatHexButton.setText(Messages.getString("FindReplaceDialog.ButtonHexadecimal")); //$NON-NLS-1$
|
||||||
|
|
||||||
formatOctalButton = new Button(formatGroup, SWT.RADIO);
|
fFormatOctalButton = new Button(formatGroup, SWT.RADIO);
|
||||||
formatOctalButton.setText(Messages.getString("FindReplaceDialog.ButtonOctal")); //$NON-NLS-1$
|
fFormatOctalButton.setText(Messages.getString("FindReplaceDialog.ButtonOctal")); //$NON-NLS-1$
|
||||||
|
|
||||||
formatBinaryButton = new Button(formatGroup, SWT.RADIO);
|
fFormatBinaryButton = new Button(formatGroup, SWT.RADIO);
|
||||||
formatBinaryButton.setText(Messages.getString("FindReplaceDialog.ButtonBinary")); //$NON-NLS-1$
|
fFormatBinaryButton.setText(Messages.getString("FindReplaceDialog.ButtonBinary")); //$NON-NLS-1$
|
||||||
|
|
||||||
formatDecimalButton = new Button(formatGroup, SWT.RADIO);
|
fFormatDecimalButton = new Button(formatGroup, SWT.RADIO);
|
||||||
formatDecimalButton.setText(Messages.getString("FindReplaceDialog.ButtonDecimal")); //$NON-NLS-1$
|
fFormatDecimalButton.setText(Messages.getString("FindReplaceDialog.ButtonDecimal")); //$NON-NLS-1$
|
||||||
|
|
||||||
formatByteSequenceButton = new Button(formatGroup, SWT.RADIO);
|
fFormatByteSequenceButton = new Button(formatGroup, SWT.RADIO);
|
||||||
formatByteSequenceButton.setText(Messages.getString("FindReplaceDialog.ButtonByteSequence")); //$NON-NLS-1$
|
fFormatByteSequenceButton.setText(Messages.getString("FindReplaceDialog.ButtonByteSequence")); //$NON-NLS-1$
|
||||||
|
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
data.top = new FormAttachment(rangeGroup);
|
data.top = new FormAttachment(rangeGroup);
|
||||||
|
@ -594,15 +594,15 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
wrapCheckbox.setText(Messages.getString("FindReplaceDialog.ButtonWrapSearch")); //$NON-NLS-1$
|
wrapCheckbox.setText(Messages.getString("FindReplaceDialog.ButtonWrapSearch")); //$NON-NLS-1$
|
||||||
wrapCheckbox.setEnabled(false); // TODO implement wrap
|
wrapCheckbox.setEnabled(false); // TODO implement wrap
|
||||||
|
|
||||||
caseInSensitiveCheckbox = new Button(optionsGroup, SWT.CHECK);
|
fCaseInSensitiveCheckbox = new Button(optionsGroup, SWT.CHECK);
|
||||||
caseInSensitiveCheckbox.setText(Messages.getString("FindReplaceDialog.ButtonCaseInsensitive")); //$NON-NLS-1$
|
fCaseInSensitiveCheckbox.setText(Messages.getString("FindReplaceDialog.ButtonCaseInsensitive")); //$NON-NLS-1$
|
||||||
|
|
||||||
formatAsciiButton.addSelectionListener(new SelectionListener()
|
fFormatAsciiButton.addSelectionListener(new SelectionListener()
|
||||||
{
|
{
|
||||||
public void widgetDefaultSelected(SelectionEvent e) { }
|
public void widgetDefaultSelected(SelectionEvent e) { }
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
caseInSensitiveCheckbox.setEnabled(true);
|
fCaseInSensitiveCheckbox.setEnabled(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -611,16 +611,16 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
public void widgetDefaultSelected(SelectionEvent e) { }
|
public void widgetDefaultSelected(SelectionEvent e) { }
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
caseInSensitiveCheckbox.setEnabled(false);
|
fCaseInSensitiveCheckbox.setEnabled(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
formatHexButton.addSelectionListener(nonAsciiListener);
|
fFormatHexButton.addSelectionListener(nonAsciiListener);
|
||||||
formatOctalButton.addSelectionListener(nonAsciiListener);
|
fFormatOctalButton.addSelectionListener(nonAsciiListener);
|
||||||
formatBinaryButton.addSelectionListener(nonAsciiListener);
|
fFormatBinaryButton.addSelectionListener(nonAsciiListener);
|
||||||
formatDecimalButton.addSelectionListener(nonAsciiListener);
|
fFormatDecimalButton.addSelectionListener(nonAsciiListener);
|
||||||
formatByteSequenceButton.addSelectionListener(nonAsciiListener);
|
fFormatByteSequenceButton.addSelectionListener(nonAsciiListener);
|
||||||
|
|
||||||
startText.addModifyListener(new ModifyListener() {
|
fStartText.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
boolean valid = true;
|
boolean valid = true;
|
||||||
try
|
try
|
||||||
|
@ -632,7 +632,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
startText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK) :
|
fStartText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK) :
|
||||||
Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
|
@ -640,16 +640,16 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
endText.addModifyListener(new ModifyListener() {
|
fEndText.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getEndAddress();
|
getEndAddress();
|
||||||
endText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
endText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
|
@ -657,33 +657,33 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
findText.addModifyListener(new ModifyListener() {
|
fFindText.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent e)
|
public void modifyText(ModifyEvent e)
|
||||||
{
|
{
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
replaceText.addModifyListener(new ModifyListener() {
|
fReplaceText.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent e)
|
public void modifyText(ModifyEvent e)
|
||||||
{
|
{
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
forwardButton.setSelection(true);
|
fForwardButton.setSelection(true);
|
||||||
formatAsciiButton.setSelection(true);
|
fFormatAsciiButton.setSelection(true);
|
||||||
|
|
||||||
composite.setTabList(new Control[] {
|
composite.setTabList(new Control[] {
|
||||||
findText,
|
fFindText,
|
||||||
replaceText,
|
fReplaceText,
|
||||||
directionGroup,
|
directionGroup,
|
||||||
rangeGroup,
|
rangeGroup,
|
||||||
formatGroup,
|
formatGroup,
|
||||||
optionsGroup,
|
optionsGroup,
|
||||||
});
|
});
|
||||||
|
|
||||||
findText.setFocus();
|
fFindText.setFocus();
|
||||||
|
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,220 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.dd.debug.memory.renderings.actions;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.math.BigInteger;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
|
||||||
import org.eclipse.core.runtime.Status;
|
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
|
||||||
import org.eclipse.dd.debug.memory.renderings.traditional.TraditionalRenderingPlugin;
|
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
|
||||||
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
|
||||||
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
|
||||||
import org.eclipse.debug.internal.ui.views.memory.MemoryViewIdRegistry;
|
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
|
||||||
import org.eclipse.jface.action.IAction;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.ui.IViewActionDelegate;
|
|
||||||
import org.eclipse.ui.IViewPart;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action for downloading memory.
|
|
||||||
*/
|
|
||||||
public class ImportMemoryAction implements IViewActionDelegate {
|
|
||||||
|
|
||||||
|
|
||||||
private MemoryView fView;
|
|
||||||
|
|
||||||
public void init(IViewPart view) {
|
|
||||||
if (view instanceof MemoryView)
|
|
||||||
fView = (MemoryView) view;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run(IAction action) {
|
|
||||||
|
|
||||||
String secondaryId = MemoryViewIdRegistry
|
|
||||||
.getUniqueSecondaryId(IDebugUIConstants.ID_MEMORY_VIEW);
|
|
||||||
|
|
||||||
ISelection selection = fView.getSite().getSelectionProvider()
|
|
||||||
.getSelection();
|
|
||||||
if (selection instanceof IStructuredSelection) {
|
|
||||||
IStructuredSelection strucSel = (IStructuredSelection) selection;
|
|
||||||
|
|
||||||
// return if current selection is empty
|
|
||||||
if (strucSel.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Object obj = strucSel.getFirstElement();
|
|
||||||
|
|
||||||
if (obj == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
IMemoryBlock memBlock = null;
|
|
||||||
|
|
||||||
if (obj instanceof IMemoryRendering) {
|
|
||||||
memBlock = ((IMemoryRendering) obj).getMemoryBlock();
|
|
||||||
} else if (obj instanceof IMemoryBlock) {
|
|
||||||
memBlock = (IMemoryBlock) obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
Shell shell = DebugUIPlugin.getShell();
|
|
||||||
ImportMemoryDialog dialog = new ImportMemoryDialog(shell, memBlock);
|
|
||||||
dialog.open();
|
|
||||||
|
|
||||||
Object results[] = dialog.getResult();
|
|
||||||
|
|
||||||
if(results != null && results.length == 4)
|
|
||||||
{
|
|
||||||
String format = (String) results[0];
|
|
||||||
Boolean useCustomAddress = (Boolean) results[1];
|
|
||||||
BigInteger start = (BigInteger) results[2];
|
|
||||||
File file = (File) results[3];
|
|
||||||
|
|
||||||
if("S-Record".equals(format)) //$NON-NLS-1$
|
|
||||||
{
|
|
||||||
downloadSRecord(file, start, useCustomAddress.booleanValue(), (IMemoryBlockExtension) memBlock); // FIXME
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void downloadSRecord(final File inputFile, final BigInteger startAddress, final boolean useCustomAddress, final IMemoryBlockExtension memblock)
|
|
||||||
{
|
|
||||||
Job job = new Job("Memory Download from S-Record File"){ //$NON-NLS-1$
|
|
||||||
@Override
|
|
||||||
public IStatus run(IProgressMonitor monitor) {
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// FIXME 4 byte default
|
|
||||||
|
|
||||||
final int CHECKSUM_LENGTH = 1;
|
|
||||||
|
|
||||||
BigInteger offset = null;
|
|
||||||
if(!useCustomAddress)
|
|
||||||
offset = BigInteger.ZERO;
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile)));
|
|
||||||
|
|
||||||
BigInteger jobs = BigInteger.valueOf(inputFile.length());
|
|
||||||
BigInteger factor = BigInteger.ONE;
|
|
||||||
if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0)
|
|
||||||
{
|
|
||||||
factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF));
|
|
||||||
jobs = jobs.divide(factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$
|
|
||||||
|
|
||||||
BigInteger jobCount = BigInteger.ZERO;
|
|
||||||
String line = reader.readLine();
|
|
||||||
while(line != null && !monitor.isCanceled())
|
|
||||||
{
|
|
||||||
String recordType = line.substring(0, 2);
|
|
||||||
int recordCount = Integer.parseInt(line.substring(2, 4), 16);
|
|
||||||
int bytesRead = 4 + recordCount;
|
|
||||||
int position = 4;
|
|
||||||
int addressSize = 0;
|
|
||||||
|
|
||||||
BigInteger recordAddress = null;
|
|
||||||
|
|
||||||
if("S3".equals(recordType)) //$NON-NLS-1$
|
|
||||||
addressSize = 4;
|
|
||||||
else if("S1".equals(recordType)) //$NON-NLS-1$
|
|
||||||
addressSize = 2;
|
|
||||||
else if("S2".equals(recordType)) //$NON-NLS-1$
|
|
||||||
addressSize = 3;
|
|
||||||
|
|
||||||
recordAddress = new BigInteger(line.substring(position, position + addressSize * 2), 16);
|
|
||||||
recordCount -= addressSize;
|
|
||||||
position += addressSize * 2;
|
|
||||||
|
|
||||||
if(offset == null)
|
|
||||||
offset = startAddress.subtract(recordAddress);
|
|
||||||
|
|
||||||
recordAddress = recordAddress.add(offset);
|
|
||||||
|
|
||||||
byte data[] = new byte[recordCount - CHECKSUM_LENGTH];
|
|
||||||
for(int i = 0; i < data.length; i++)
|
|
||||||
{
|
|
||||||
data[i] = new BigInteger(line.substring(position++, position++ + 1), 16).byteValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The least significant byte of the one's complement of the sum of the values
|
|
||||||
* represented by the pairs of characters making up the records length, address,
|
|
||||||
* and the code/data fields.
|
|
||||||
*/
|
|
||||||
StringBuffer buf = new StringBuffer(line.substring(2));
|
|
||||||
byte checksum = 0;
|
|
||||||
|
|
||||||
for(int i = 0; i < buf.length(); i+=2)
|
|
||||||
{
|
|
||||||
BigInteger value = new BigInteger(buf.substring(i, i+2), 16);
|
|
||||||
checksum += value.byteValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Since we included the checksum in the checksum calculation the checksum
|
|
||||||
* ( if correct ) will always be 0xFF which is -1 using the signed byte size
|
|
||||||
* calculation here.
|
|
||||||
*/
|
|
||||||
if ( checksum != (byte) -1 ) {
|
|
||||||
reader.close();
|
|
||||||
monitor.done();
|
|
||||||
return new Status( IStatus.ERROR, TraditionalRenderingPlugin.getUniqueIdentifier(), "Checksum failure of line = " + line); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME error on incorrect checksum
|
|
||||||
|
|
||||||
memblock.setValue(recordAddress.subtract(memblock.getBigBaseAddress()), data);
|
|
||||||
|
|
||||||
jobCount = jobCount.add(BigInteger.valueOf(bytesRead));
|
|
||||||
while(jobCount.compareTo(factor) >= 0)
|
|
||||||
{
|
|
||||||
jobCount = jobCount.subtract(factor);
|
|
||||||
monitor.worked(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
line = reader.readLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
reader.close();
|
|
||||||
monitor.done();
|
|
||||||
}
|
|
||||||
catch(Exception e) { e.printStackTrace();}
|
|
||||||
}
|
|
||||||
catch(Exception e) {e.printStackTrace();}
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}};
|
|
||||||
job.setUser(true);
|
|
||||||
job.schedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void selectionChanged(IAction action, ISelection selection) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,292 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2006-2007 Wind River Systems, Inc. and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.dd.debug.memory.renderings.actions;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.math.BigInteger;
|
|
||||||
|
|
||||||
import javax.swing.ButtonGroup;
|
|
||||||
|
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
|
||||||
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
|
||||||
import org.eclipse.swt.layout.FormAttachment;
|
|
||||||
import org.eclipse.swt.layout.FormData;
|
|
||||||
import org.eclipse.swt.layout.FormLayout;
|
|
||||||
import org.eclipse.swt.widgets.Button;
|
|
||||||
import org.eclipse.swt.widgets.Combo;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Display;
|
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
|
||||||
import org.eclipse.ui.PlatformUI;
|
|
||||||
import org.eclipse.ui.dialogs.SelectionDialog;
|
|
||||||
|
|
||||||
public class ImportMemoryDialog extends SelectionDialog
|
|
||||||
{
|
|
||||||
|
|
||||||
private Combo formatCombo;
|
|
||||||
|
|
||||||
private IMemoryBlock fMemoryBlock;
|
|
||||||
|
|
||||||
private Text startText;
|
|
||||||
private Text fileText;
|
|
||||||
|
|
||||||
private Button comboRestoreToThisAddress;
|
|
||||||
private Button comboRestoreToFileAddress;
|
|
||||||
|
|
||||||
public ImportMemoryDialog(Shell parent, IMemoryBlock memoryBlock)
|
|
||||||
{
|
|
||||||
super(parent);
|
|
||||||
super.setTitle("Download to Memory");
|
|
||||||
setShellStyle(getShellStyle() | SWT.RESIZE);
|
|
||||||
|
|
||||||
fMemoryBlock = memoryBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
protected void createButtonsForButtonBar(Composite parent) {
|
|
||||||
super.createButtonsForButtonBar(parent);
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.dialogs.SelectionDialog#getResult()
|
|
||||||
*/
|
|
||||||
public Object[] getResult() {
|
|
||||||
|
|
||||||
Object[] results = super.getResult();
|
|
||||||
|
|
||||||
if (results != null)
|
|
||||||
{
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
return new Object[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
|
|
||||||
*/
|
|
||||||
protected void cancelPressed() {
|
|
||||||
|
|
||||||
setResult(null);
|
|
||||||
|
|
||||||
super.cancelPressed();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
|
|
||||||
*/
|
|
||||||
protected void okPressed() {
|
|
||||||
setSelectionResult(new Object[]{ getFormat(), new Boolean(comboRestoreToThisAddress.getSelection()),
|
|
||||||
getStartAddress(), getFile() });
|
|
||||||
|
|
||||||
super.okPressed();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFormat()
|
|
||||||
{
|
|
||||||
return formatCombo.getItem(formatCombo.getSelectionIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigInteger getStartAddress()
|
|
||||||
{
|
|
||||||
String text = startText.getText();
|
|
||||||
boolean hex = text.startsWith("0x");
|
|
||||||
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
|
||||||
hex ? 16 : 10);
|
|
||||||
|
|
||||||
return startAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getFile()
|
|
||||||
{
|
|
||||||
return new File(fileText.getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validate()
|
|
||||||
{
|
|
||||||
boolean isValid = true;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
getStartAddress();
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
isValid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
getButton(IDialogConstants.OK_ID).setEnabled(isValid);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
protected Control createDialogArea(Composite parent) {
|
|
||||||
|
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, DebugUIPlugin.getUniqueIdentifier() + ".AddMemoryRenderingDialog_context"); //$NON-NLS-1$ // FIXME
|
|
||||||
Composite composite = new Composite(parent, SWT.NONE);
|
|
||||||
FormLayout formLayout = new FormLayout();
|
|
||||||
formLayout.spacing = 5;
|
|
||||||
formLayout.marginWidth = formLayout.marginHeight = 9;
|
|
||||||
composite.setLayout(formLayout);
|
|
||||||
|
|
||||||
// format
|
|
||||||
|
|
||||||
Label textLabel = new Label(composite, SWT.NONE);
|
|
||||||
textLabel.setText("Format: ");
|
|
||||||
|
|
||||||
formatCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
|
|
||||||
|
|
||||||
FormData data = new FormData();
|
|
||||||
data.top = new FormAttachment(formatCombo, 0, SWT.CENTER);
|
|
||||||
textLabel.setLayoutData(data);
|
|
||||||
|
|
||||||
data = new FormData();
|
|
||||||
data.left = new FormAttachment(textLabel);
|
|
||||||
formatCombo.setLayoutData(data);
|
|
||||||
formatCombo.setItems( new String[] { "S-Record" }); // TODO offer extension point
|
|
||||||
formatCombo.select(0);
|
|
||||||
|
|
||||||
// restore to file address
|
|
||||||
|
|
||||||
comboRestoreToFileAddress = new Button(composite, SWT.RADIO);
|
|
||||||
comboRestoreToFileAddress.setText("Restore to address specified in the file");
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(formatCombo);
|
|
||||||
comboRestoreToFileAddress.setLayoutData(data);
|
|
||||||
|
|
||||||
// restore to this address
|
|
||||||
|
|
||||||
comboRestoreToThisAddress = new Button(composite, SWT.RADIO);
|
|
||||||
comboRestoreToThisAddress.setText("Restore to this address: ");
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(comboRestoreToFileAddress);
|
|
||||||
comboRestoreToThisAddress.setLayoutData(data);
|
|
||||||
|
|
||||||
startText = new Text(composite, SWT.NONE);
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(comboRestoreToFileAddress);
|
|
||||||
data.left = new FormAttachment(comboRestoreToThisAddress);
|
|
||||||
data.width = 100;
|
|
||||||
startText.setLayoutData(data);
|
|
||||||
|
|
||||||
// file
|
|
||||||
|
|
||||||
Label fileLabel = new Label(composite, SWT.NONE);
|
|
||||||
fileText = new Text(composite, SWT.NONE);
|
|
||||||
Button fileButton = new Button(composite, SWT.PUSH);
|
|
||||||
|
|
||||||
fileLabel.setText("File name: ");
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
|
||||||
fileLabel.setLayoutData(data);
|
|
||||||
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
|
||||||
data.left = new FormAttachment(fileLabel);
|
|
||||||
data.width = 300;
|
|
||||||
fileText.setLayoutData(data);
|
|
||||||
|
|
||||||
fileButton.setText("Browse...");
|
|
||||||
data = new FormData();
|
|
||||||
data.top = new FormAttachment(startText);
|
|
||||||
data.left = new FormAttachment(fileText);
|
|
||||||
fileButton.setLayoutData(data);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
BigInteger startAddress = null;
|
|
||||||
if(fMemoryBlock instanceof IMemoryBlockExtension)
|
|
||||||
startAddress = ((IMemoryBlockExtension) fMemoryBlock)
|
|
||||||
.getBigBaseAddress(); // FIXME use selection/caret address?
|
|
||||||
else
|
|
||||||
startAddress = BigInteger.valueOf(fMemoryBlock.getStartAddress());
|
|
||||||
|
|
||||||
startText.setText("0x" + startAddress.toString(16));
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
fileButton.addSelectionListener(new SelectionListener() {
|
|
||||||
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
FileDialog dialog = new FileDialog(ImportMemoryDialog.this.getShell(), SWT.SAVE);
|
|
||||||
dialog.setText("Choose memory export file");
|
|
||||||
dialog.setFilterExtensions(new String[] { "*.*" } );
|
|
||||||
dialog.setFilterNames(new String[] { "All Files (*.*)" } );
|
|
||||||
dialog.setFileName(fileText.getText());
|
|
||||||
dialog.open();
|
|
||||||
|
|
||||||
if(dialog.getFileName() != null)
|
|
||||||
{
|
|
||||||
fileText.setText(dialog.getFilterPath() + File.separator + dialog.getFileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
startText.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
boolean valid = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
getStartAddress();
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
valid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
startText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK) :
|
|
||||||
Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
fileText.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return composite;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
28
plugins/org.eclipse.dd.debug.ui.memory.transport/.project
Normal file
28
plugins/org.eclipse.dd.debug.ui.memory.transport/.project
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>org.eclipse.dd.debug.ui.memory.transport</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,7 @@
|
||||||
|
#Fri May 09 21:44:48 PDT 2008
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.3
|
|
@ -0,0 +1,16 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: Memory Transport Plug-in
|
||||||
|
Bundle-SymbolicName: org.eclipse.dd.debug.ui.memory.transport;singleton:=true
|
||||||
|
Bundle-Version: 1.0.0.qualifier
|
||||||
|
Bundle-Localization: plugin
|
||||||
|
Bundle-Vendor: Eclipse.org
|
||||||
|
Require-Bundle: org.eclipse.debug.core,
|
||||||
|
org.eclipse.debug.ui,
|
||||||
|
org.eclipse.core.runtime,
|
||||||
|
org.eclipse.swt,
|
||||||
|
org.eclipse.jface,
|
||||||
|
org.eclipse.ui
|
||||||
|
Bundle-RequiredExecutionEnvironment: J2SE-1.4
|
||||||
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Bundle-Activator: org.eclipse.dd.debug.ui.memory.transport.MemoryTransportPlugin
|
24
plugins/org.eclipse.dd.debug.ui.memory.transport/about.html
Normal file
24
plugins/org.eclipse.dd.debug.ui.memory.transport/about.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||||
|
|
||||||
|
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head><body lang="EN-US">
|
||||||
|
<h2>About This Content</h2>
|
||||||
|
|
||||||
|
<p>June 5, 2007</p>
|
||||||
|
<h3>License</h3>
|
||||||
|
|
||||||
|
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||||
|
indicated below, the Content is provided to you under the terms and conditions of the
|
||||||
|
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
||||||
|
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||||
|
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||||
|
|
||||||
|
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||||
|
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||||
|
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||||
|
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||||
|
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||||
|
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
|
||||||
|
|
||||||
|
</body></html>
|
|
@ -0,0 +1,8 @@
|
||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
|
bin.includes = META-INF/,\
|
||||||
|
.,\
|
||||||
|
schema/,\
|
||||||
|
plugin.xml,\
|
||||||
|
build.properties,\
|
||||||
|
plugin.properties
|
Binary file not shown.
After Width: | Height: | Size: 227 B |
Binary file not shown.
After Width: | Height: | Size: 236 B |
|
@ -0,0 +1,2 @@
|
||||||
|
ExportMemoryAction.label=Export
|
||||||
|
ImportMemoryAction.label=Import
|
60
plugins/org.eclipse.dd.debug.ui.memory.transport/plugin.xml
Normal file
60
plugins/org.eclipse.dd.debug.ui.memory.transport/plugin.xml
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?eclipse version="3.0"?>
|
||||||
|
<plugin>
|
||||||
|
<extension-point id="memoryTransport" name="memoryTransport" schema="schema/MemoryTransport.exsd"/>
|
||||||
|
|
||||||
|
<extension
|
||||||
|
id="org.eclipse.dd.debug.ui.memory.transport.dd"
|
||||||
|
name="org.eclipse.dd.debug.ui.memory.transport.dd"
|
||||||
|
point="org.eclipse.dd.debug.ui.memory.transport.memoryTransport">
|
||||||
|
<importer
|
||||||
|
name="SRecordImporter"
|
||||||
|
id="org.eclipse.dd.debug.ui.memory.transport.SRecordImporter"
|
||||||
|
class="org.eclipse.dd.debug.ui.memory.transport.SRecordImporter">
|
||||||
|
</importer>
|
||||||
|
|
||||||
|
<exporter
|
||||||
|
name="SRecordExporter"
|
||||||
|
id="org.eclipse.dd.debug.ui.memory.transport.SRecordExporter"
|
||||||
|
class="org.eclipse.dd.debug.ui.memory.transport.SRecordExporter">
|
||||||
|
</exporter>
|
||||||
|
|
||||||
|
<exporter
|
||||||
|
name="PlainTextExporter"
|
||||||
|
id="org.eclipse.dd.debug.ui.memory.transport.PlainTextExporter"
|
||||||
|
class="org.eclipse.dd.debug.ui.memory.transport.PlainTextExporter">
|
||||||
|
</exporter>
|
||||||
|
|
||||||
|
<importer
|
||||||
|
name="SRecordImporter"
|
||||||
|
id="org.eclipse.dd.debug.ui.memory.transport.PlainTextImporter"
|
||||||
|
class="org.eclipse.dd.debug.ui.memory.transport.PlainTextImporter">
|
||||||
|
</importer>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<extension point="org.eclipse.ui.viewActions">
|
||||||
|
<viewContribution
|
||||||
|
targetID="org.eclipse.debug.ui.MemoryView"
|
||||||
|
id="org.eclipse.debug.ui.memoryView.toolbar">
|
||||||
|
<action
|
||||||
|
class="org.eclipse.dd.debug.ui.memory.transport.actions.ExportMemoryAction"
|
||||||
|
helpContextId="ExportMemoryAction_context"
|
||||||
|
icon="icons/export.png"
|
||||||
|
id="org.eclipse.dd.debug.ui.memory.transport.actions.ExportMemoryAction"
|
||||||
|
label="%ExportMemoryAction.label"
|
||||||
|
state="false"
|
||||||
|
style="push"
|
||||||
|
toolbarPath="additions"
|
||||||
|
tooltip="%ExportMemoryAction.label"/>
|
||||||
|
<action
|
||||||
|
class="org.eclipse.dd.debug.ui.memory.transport.actions.ImportMemoryAction"
|
||||||
|
helpContextId="ExportMemoryAction_context"
|
||||||
|
icon="icons/import.png"
|
||||||
|
id="org.eclipse.dd.debug.ui.memory.transport.actions.ImportMemoryAction"
|
||||||
|
label="%ImportMemoryAction.label"
|
||||||
|
state="false"
|
||||||
|
style="push"
|
||||||
|
toolbarPath="additions"
|
||||||
|
tooltip="%ImportMemoryAction.label"/>
|
||||||
|
</viewContribution>
|
||||||
|
</extension>
|
||||||
|
</plugin>
|
|
@ -0,0 +1,160 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!-- Schema file written by PDE -->
|
||||||
|
<schema targetNamespace="org.eclipse.dd.debug.ui.memory.transport" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.schema plugin="org.eclipse.dd.debug.ui.memory.transport" id="memoryTransport" name="memoryTransport"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
Allows plug-ins to contribute arbitrary memory importers and exporters.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<element name="extension">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="point" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="exporter">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="class" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.dd.debug.memory.renderings.actions.IMemoryExporter"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="importer">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="class" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.dd.debug.memory.renderings.actions.IMemoryImporter"/>
|
||||||
|
</appinfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="since"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
1.0.0
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="examples"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="apiinfo"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="implementation"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appinfo>
|
||||||
|
<meta.section type="copyright"/>
|
||||||
|
</appinfo>
|
||||||
|
<documentation>
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
</schema>
|
|
@ -0,0 +1,204 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.model.IMemoryExporter;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
|
import org.eclipse.swt.layout.FormData;
|
||||||
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.dialogs.SelectionDialog;
|
||||||
|
|
||||||
|
public class ExportMemoryDialog extends SelectionDialog
|
||||||
|
{
|
||||||
|
|
||||||
|
private Combo fFormatCombo;
|
||||||
|
|
||||||
|
private IMemoryBlock fMemoryBlock;
|
||||||
|
|
||||||
|
private Control fCurrentControl = null;
|
||||||
|
|
||||||
|
private IMemoryExporter fFormatExporters[];
|
||||||
|
private String fFormatNames[];
|
||||||
|
|
||||||
|
private Properties fProperties = new Properties();
|
||||||
|
|
||||||
|
public ExportMemoryDialog(Shell parent, IMemoryBlock memoryBlock)
|
||||||
|
{
|
||||||
|
super(parent);
|
||||||
|
super.setTitle("Export Memory");
|
||||||
|
setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||||
|
|
||||||
|
fMemoryBlock = memoryBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
protected void createButtonsForButtonBar(Composite parent) {
|
||||||
|
super.createButtonsForButtonBar(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.dialogs.SelectionDialog#getResult()
|
||||||
|
*/
|
||||||
|
public Object[] getResult() {
|
||||||
|
|
||||||
|
Object[] results = super.getResult();
|
||||||
|
|
||||||
|
if (results != null)
|
||||||
|
{
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
return new Object[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
|
||||||
|
*/
|
||||||
|
protected void cancelPressed() {
|
||||||
|
|
||||||
|
setResult(null);
|
||||||
|
|
||||||
|
super.cancelPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
|
||||||
|
*/
|
||||||
|
protected void okPressed() {
|
||||||
|
if(fCurrentControl != null)
|
||||||
|
fCurrentControl.dispose();
|
||||||
|
fFormatExporters[fFormatCombo.getSelectionIndex()].exportMemory();
|
||||||
|
|
||||||
|
super.okPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
protected Control createDialogArea(Composite parent) {
|
||||||
|
|
||||||
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, DebugUIPlugin.getUniqueIdentifier() + ".AddMemoryRenderingDialog_context"); //$NON-NLS-1$ // FIXME
|
||||||
|
Composite composite = new Composite(parent, SWT.NONE);
|
||||||
|
FormLayout formLayout = new FormLayout();
|
||||||
|
formLayout.spacing = 5;
|
||||||
|
formLayout.marginWidth = formLayout.marginHeight = 9;
|
||||||
|
composite.setLayout(formLayout);
|
||||||
|
|
||||||
|
// format
|
||||||
|
|
||||||
|
Label textLabel = new Label(composite, SWT.NONE);
|
||||||
|
textLabel.setText("Format: ");
|
||||||
|
|
||||||
|
fFormatCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
|
||||||
|
|
||||||
|
FormData data = new FormData();
|
||||||
|
data.top = new FormAttachment(fFormatCombo, 0, SWT.CENTER);
|
||||||
|
textLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
data = new FormData();
|
||||||
|
data.left = new FormAttachment(textLabel);
|
||||||
|
fFormatCombo.setLayoutData(data);
|
||||||
|
|
||||||
|
Vector exporters = new Vector();
|
||||||
|
|
||||||
|
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||||
|
IExtensionPoint extensionPoint =
|
||||||
|
registry.getExtensionPoint("org.eclipse.dd.debug.ui.memory.transport.memoryTransport");
|
||||||
|
IConfigurationElement points[] =
|
||||||
|
extensionPoint.getConfigurationElements();
|
||||||
|
|
||||||
|
for (int i = 0; i < points.length; i++)
|
||||||
|
{
|
||||||
|
IConfigurationElement element = points[i];
|
||||||
|
if("exporter".equals(element.getName()))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
exporters.addElement((IMemoryExporter) element.createExecutableExtension("class"));
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fFormatExporters = new IMemoryExporter[exporters.size()];
|
||||||
|
fFormatNames = new String[exporters.size()];
|
||||||
|
for(int i = 0; i < fFormatExporters.length; i++)
|
||||||
|
{
|
||||||
|
fFormatExporters[i] = (IMemoryExporter) exporters.elementAt(i);
|
||||||
|
fFormatNames[i] = ((IMemoryExporter) exporters.elementAt(i)).getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
final Composite container = new Composite(composite, SWT.NONE);
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fFormatCombo);
|
||||||
|
data.left = new FormAttachment(0);
|
||||||
|
container.setLayoutData(data);
|
||||||
|
|
||||||
|
fFormatCombo.setItems(fFormatNames);
|
||||||
|
|
||||||
|
fFormatCombo.addSelectionListener(new SelectionListener(){
|
||||||
|
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
if(fCurrentControl != null)
|
||||||
|
fCurrentControl.dispose();
|
||||||
|
fCurrentControl = fFormatExporters[fFormatCombo.getSelectionIndex()].createControl(container,
|
||||||
|
fMemoryBlock, fProperties, ExportMemoryDialog.this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
fFormatCombo.select(0);
|
||||||
|
fCurrentControl = fFormatExporters[0].createControl(container,
|
||||||
|
fMemoryBlock, fProperties, ExportMemoryDialog.this);
|
||||||
|
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValid(boolean isValid)
|
||||||
|
{
|
||||||
|
getButton(IDialogConstants.OK_ID).setEnabled(isValid);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,205 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.model.IMemoryExporter;
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.model.IMemoryImporter;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
|
import org.eclipse.swt.layout.FormData;
|
||||||
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.dialogs.SelectionDialog;
|
||||||
|
|
||||||
|
public class ImportMemoryDialog extends SelectionDialog
|
||||||
|
{
|
||||||
|
|
||||||
|
private Combo fFormatCombo;
|
||||||
|
|
||||||
|
private IMemoryBlock fMemoryBlock;
|
||||||
|
|
||||||
|
private Control fCurrentControl = null;
|
||||||
|
|
||||||
|
private IMemoryImporter fFormatImporters[];
|
||||||
|
private String fFormatNames[];
|
||||||
|
|
||||||
|
private Properties fProperties = new Properties();
|
||||||
|
|
||||||
|
public ImportMemoryDialog(Shell parent, IMemoryBlock memoryBlock)
|
||||||
|
{
|
||||||
|
super(parent);
|
||||||
|
super.setTitle("Download to Memory");
|
||||||
|
setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||||
|
|
||||||
|
fMemoryBlock = memoryBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
protected void createButtonsForButtonBar(Composite parent) {
|
||||||
|
super.createButtonsForButtonBar(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.dialogs.SelectionDialog#getResult()
|
||||||
|
*/
|
||||||
|
public Object[] getResult() {
|
||||||
|
|
||||||
|
Object[] results = super.getResult();
|
||||||
|
|
||||||
|
if (results != null)
|
||||||
|
{
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
return new Object[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
|
||||||
|
*/
|
||||||
|
protected void cancelPressed() {
|
||||||
|
|
||||||
|
setResult(null);
|
||||||
|
|
||||||
|
super.cancelPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
|
||||||
|
*/
|
||||||
|
protected void okPressed() {
|
||||||
|
if(fCurrentControl != null)
|
||||||
|
fCurrentControl.dispose();
|
||||||
|
fFormatImporters[fFormatCombo.getSelectionIndex()].importMemory();
|
||||||
|
|
||||||
|
super.okPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
protected Control createDialogArea(Composite parent) {
|
||||||
|
|
||||||
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, DebugUIPlugin.getUniqueIdentifier() + ".AddMemoryRenderingDialog_context"); //$NON-NLS-1$ // FIXME
|
||||||
|
Composite composite = new Composite(parent, SWT.NONE);
|
||||||
|
FormLayout formLayout = new FormLayout();
|
||||||
|
formLayout.spacing = 5;
|
||||||
|
formLayout.marginWidth = formLayout.marginHeight = 9;
|
||||||
|
composite.setLayout(formLayout);
|
||||||
|
|
||||||
|
// format
|
||||||
|
|
||||||
|
Label textLabel = new Label(composite, SWT.NONE);
|
||||||
|
textLabel.setText("Format: ");
|
||||||
|
|
||||||
|
fFormatCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
|
||||||
|
|
||||||
|
FormData data = new FormData();
|
||||||
|
data.top = new FormAttachment(fFormatCombo, 0, SWT.CENTER);
|
||||||
|
textLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
data = new FormData();
|
||||||
|
data.left = new FormAttachment(textLabel);
|
||||||
|
fFormatCombo.setLayoutData(data);
|
||||||
|
|
||||||
|
Vector importers = new Vector();
|
||||||
|
|
||||||
|
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||||
|
IExtensionPoint extensionPoint =
|
||||||
|
registry.getExtensionPoint("org.eclipse.dd.debug.ui.memory.transport.memoryTransport");
|
||||||
|
IConfigurationElement points[] =
|
||||||
|
extensionPoint.getConfigurationElements();
|
||||||
|
|
||||||
|
for (int i = 0; i < points.length; i++)
|
||||||
|
{
|
||||||
|
IConfigurationElement element = points[i];
|
||||||
|
if("importer".equals(element.getName()))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
importers.addElement((IMemoryImporter) element.createExecutableExtension("class"));
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fFormatImporters = new IMemoryImporter[importers.size()];
|
||||||
|
fFormatNames = new String[importers.size()];
|
||||||
|
for(int i = 0; i < fFormatImporters.length; i++)
|
||||||
|
{
|
||||||
|
fFormatImporters[i] = (IMemoryImporter) importers.elementAt(i);
|
||||||
|
fFormatNames[i] = ((IMemoryImporter) importers.elementAt(i)).getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
final Composite container = new Composite(composite, SWT.NONE);
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fFormatCombo);
|
||||||
|
data.left = new FormAttachment(0);
|
||||||
|
container.setLayoutData(data);
|
||||||
|
|
||||||
|
fFormatCombo.setItems(fFormatNames);
|
||||||
|
|
||||||
|
fFormatCombo.addSelectionListener(new SelectionListener(){
|
||||||
|
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
if(fCurrentControl != null)
|
||||||
|
fCurrentControl.dispose();
|
||||||
|
fCurrentControl = fFormatImporters[fFormatCombo.getSelectionIndex()].createControl(container,
|
||||||
|
fMemoryBlock, fProperties, ImportMemoryDialog.this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
fFormatCombo.select(0);
|
||||||
|
fCurrentControl = fFormatImporters[0].createControl(container,
|
||||||
|
fMemoryBlock, fProperties, ImportMemoryDialog.this);
|
||||||
|
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValid(boolean isValid)
|
||||||
|
{
|
||||||
|
getButton(IDialogConstants.OK_ID).setEnabled(isValid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport;
|
||||||
|
|
||||||
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
|
|
||||||
|
public class MemoryTransportPlugin extends AbstractUIPlugin
|
||||||
|
{
|
||||||
|
private static final String PLUGIN_ID = "org.eclipse.dd.debug.ui.memory.transport"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static MemoryTransportPlugin plugin;
|
||||||
|
|
||||||
|
public MemoryTransportPlugin()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
plugin = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the shared instance.
|
||||||
|
*/
|
||||||
|
public static MemoryTransportPlugin getDefault() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the unique identifier for this plugin.
|
||||||
|
*/
|
||||||
|
public static String getUniqueIdentifier() {
|
||||||
|
return PLUGIN_ID;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport;
|
||||||
|
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
public class Messages {
|
||||||
|
private static final String BUNDLE_NAME = "org.eclipse.dd.debug.ui.memory.transport.messages"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
|
||||||
|
.getBundle(BUNDLE_NAME);
|
||||||
|
|
||||||
|
private Messages() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getString(String key) {
|
||||||
|
try {
|
||||||
|
return RESOURCE_BUNDLE.getString(key);
|
||||||
|
} catch (MissingResourceException e) {
|
||||||
|
return '!' + key + '!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,467 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.model.IMemoryExporter;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
|
import org.eclipse.debug.core.model.MemoryByte;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
|
import org.eclipse.swt.layout.FormData;
|
||||||
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
public class PlainTextExporter implements IMemoryExporter {
|
||||||
|
|
||||||
|
File fOutputFile;
|
||||||
|
BigInteger fStartAddress;
|
||||||
|
BigInteger fEndAddress;
|
||||||
|
|
||||||
|
private Text fStartText;
|
||||||
|
private Text fEndText;
|
||||||
|
private Text fLengthText;
|
||||||
|
private Text fFileText;
|
||||||
|
|
||||||
|
private IMemoryBlock fMemoryBlock;
|
||||||
|
|
||||||
|
private ExportMemoryDialog fParentDialog;
|
||||||
|
|
||||||
|
private Properties fProperties;
|
||||||
|
|
||||||
|
public Control createControl(final Composite parent, IMemoryBlock memBlock, Properties properties, ExportMemoryDialog parentDialog)
|
||||||
|
{
|
||||||
|
fMemoryBlock = memBlock;
|
||||||
|
fParentDialog = parentDialog;
|
||||||
|
fProperties = properties;
|
||||||
|
|
||||||
|
Composite composite = new Composite(parent, SWT.NONE)
|
||||||
|
{
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
fProperties.setProperty(TRANSFER_FILE, fFileText.getText());
|
||||||
|
fProperties.setProperty(TRANSFER_START, fStartText.getText());
|
||||||
|
fProperties.setProperty(TRANSFER_END, fEndText.getText());
|
||||||
|
|
||||||
|
fStartAddress = getStartAddress();
|
||||||
|
fEndAddress = getEndAddress();
|
||||||
|
fOutputFile = getFile();
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
FormLayout formLayout = new FormLayout();
|
||||||
|
formLayout.spacing = 5;
|
||||||
|
formLayout.marginWidth = formLayout.marginHeight = 9;
|
||||||
|
composite.setLayout(formLayout);
|
||||||
|
|
||||||
|
// start address
|
||||||
|
|
||||||
|
Label startLabel = new Label(composite, SWT.NONE);
|
||||||
|
startLabel.setText("Start address: ");
|
||||||
|
FormData data = new FormData();
|
||||||
|
startLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
fStartText = new Text(composite, SWT.NONE);
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(startLabel);
|
||||||
|
data.left = new FormAttachment(startLabel);
|
||||||
|
data.width = 100;
|
||||||
|
fStartText.setLayoutData(data);
|
||||||
|
|
||||||
|
// end address
|
||||||
|
|
||||||
|
Label endLabel = new Label(composite, SWT.NONE);
|
||||||
|
endLabel.setText("End address: ");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(fStartText);
|
||||||
|
endLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
fEndText = new Text(composite, SWT.NONE);
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(endLabel);
|
||||||
|
data.width = 100;
|
||||||
|
fEndText.setLayoutData(data);
|
||||||
|
|
||||||
|
// length
|
||||||
|
|
||||||
|
Label lengthLabel = new Label(composite, SWT.NONE);
|
||||||
|
lengthLabel.setText("Length: ");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(fEndText);
|
||||||
|
lengthLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
fLengthText = new Text(composite, SWT.NONE);
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(lengthLabel);
|
||||||
|
data.width = 100;
|
||||||
|
fLengthText.setLayoutData(data);
|
||||||
|
|
||||||
|
// file
|
||||||
|
|
||||||
|
Label fileLabel = new Label(composite, SWT.NONE);
|
||||||
|
fFileText = new Text(composite, SWT.NONE);
|
||||||
|
Button fileButton = new Button(composite, SWT.PUSH);
|
||||||
|
|
||||||
|
fileLabel.setText("File name: ");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
|
fileLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(fileLabel);
|
||||||
|
data.width = 300;
|
||||||
|
fFileText.setLayoutData(data);
|
||||||
|
|
||||||
|
fileButton.setText("Browse...");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fLengthText);
|
||||||
|
data.left = new FormAttachment(fFileText);
|
||||||
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
|
|
||||||
|
fFileText.setText(properties.getProperty(TRANSFER_FILE, ""));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BigInteger startAddress = null;
|
||||||
|
if(fMemoryBlock instanceof IMemoryBlockExtension)
|
||||||
|
startAddress = ((IMemoryBlockExtension) fMemoryBlock)
|
||||||
|
.getBigBaseAddress(); // FIXME use selection/caret address?
|
||||||
|
else
|
||||||
|
startAddress = BigInteger.valueOf(fMemoryBlock.getStartAddress());
|
||||||
|
|
||||||
|
if(properties.getProperty(TRANSFER_START) != null)
|
||||||
|
fStartText.setText(properties.getProperty(TRANSFER_START));
|
||||||
|
else
|
||||||
|
fStartText.setText("0x" + startAddress.toString(16));
|
||||||
|
|
||||||
|
if(properties.getProperty(TRANSFER_END) != null)
|
||||||
|
fEndText.setText(properties.getProperty(TRANSFER_END));
|
||||||
|
else
|
||||||
|
fEndText.setText("0x" + startAddress.toString(16));
|
||||||
|
|
||||||
|
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
|
||||||
|
fileButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE);
|
||||||
|
dialog.setText("Choose memory export file");
|
||||||
|
dialog.setFilterExtensions(new String[] { "*.*" } );
|
||||||
|
dialog.setFilterNames(new String[] { "All Files (*.*)" } );
|
||||||
|
dialog.setFileName(fFileText.getText());
|
||||||
|
dialog.open();
|
||||||
|
|
||||||
|
if(dialog.getFileName() != null)
|
||||||
|
{
|
||||||
|
fFileText.setText(dialog.getFilterPath() + File.separator + dialog.getFileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
fStartText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
boolean valid = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getStartAddress();
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
fEndText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getEndAddress();
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
|
||||||
|
BigInteger endAddress = getEndAddress();
|
||||||
|
BigInteger startAddress = getStartAddress();
|
||||||
|
|
||||||
|
String lengthString = endAddress.subtract(startAddress).toString();
|
||||||
|
|
||||||
|
if(!fLengthText.getText().equals(lengthString))
|
||||||
|
fLengthText.setText(lengthString);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
fLengthText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BigInteger length = getLength();
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
BigInteger startAddress = getStartAddress();
|
||||||
|
String endString = "0x" + startAddress.add(length).toString(16);
|
||||||
|
if(!fEndText.getText().equals(endString))
|
||||||
|
fEndText.setText(endString);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
fFileText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
composite.pack();
|
||||||
|
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getEndAddress()
|
||||||
|
{
|
||||||
|
String text = fEndText.getText();
|
||||||
|
boolean hex = text.startsWith("0x");
|
||||||
|
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
|
hex ? 16 : 10);
|
||||||
|
|
||||||
|
return endAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getStartAddress()
|
||||||
|
{
|
||||||
|
String text = fStartText.getText();
|
||||||
|
boolean hex = text.startsWith("0x");
|
||||||
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
|
hex ? 16 : 10);
|
||||||
|
|
||||||
|
return startAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getLength()
|
||||||
|
{
|
||||||
|
String text = fLengthText.getText();
|
||||||
|
boolean hex = text.startsWith("0x");
|
||||||
|
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
|
hex ? 16 : 10);
|
||||||
|
|
||||||
|
return lengthAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getFile()
|
||||||
|
{
|
||||||
|
return new File(fFileText.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validate()
|
||||||
|
{
|
||||||
|
boolean isValid = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getEndAddress();
|
||||||
|
|
||||||
|
getStartAddress();
|
||||||
|
|
||||||
|
BigInteger length = getLength();
|
||||||
|
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
|
if(!getFile().getParentFile().exists())
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fParentDialog.setValid(isValid);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return "PlainTextExporter";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "Plain Text";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void exportMemory() {
|
||||||
|
Job job = new Job("Memory Export to S-Record File"){ //$NON-NLS-1$
|
||||||
|
public IStatus run(IProgressMonitor monitor) {
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// FIXME 4 byte default
|
||||||
|
|
||||||
|
BigInteger CELLSIZE = BigInteger.valueOf(4);
|
||||||
|
|
||||||
|
BigInteger COLUMNS = BigInteger.valueOf(5); // FIXME
|
||||||
|
|
||||||
|
BigInteger DATA_PER_LINE = CELLSIZE.multiply(COLUMNS);
|
||||||
|
|
||||||
|
BigInteger transferAddress = fStartAddress;
|
||||||
|
|
||||||
|
FileWriter writer = new FileWriter(fOutputFile);
|
||||||
|
|
||||||
|
BigInteger jobs = fEndAddress.subtract(transferAddress).divide(DATA_PER_LINE);
|
||||||
|
BigInteger factor = BigInteger.ONE;
|
||||||
|
if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0)
|
||||||
|
{
|
||||||
|
factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF));
|
||||||
|
jobs = jobs.divide(factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
monitor.beginTask("Transferring Data", jobs.intValue());
|
||||||
|
|
||||||
|
BigInteger jobCount = BigInteger.ZERO;
|
||||||
|
while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled())
|
||||||
|
{
|
||||||
|
BigInteger length = DATA_PER_LINE;
|
||||||
|
if(fEndAddress.subtract(transferAddress).compareTo(length) < 0)
|
||||||
|
length = fEndAddress.subtract(transferAddress);
|
||||||
|
|
||||||
|
StringBuffer buf = new StringBuffer();
|
||||||
|
|
||||||
|
// String transferAddressString = transferAddress.toString(16);
|
||||||
|
|
||||||
|
// future option
|
||||||
|
// for(int i = 0; i < 8 - transferAddressString.length(); i++)
|
||||||
|
// buf.append("0");
|
||||||
|
// buf.append(transferAddressString);
|
||||||
|
// buf.append(" "); // TODO tab?
|
||||||
|
|
||||||
|
// data
|
||||||
|
|
||||||
|
for(int i = 0; i < length.divide(CELLSIZE).intValue(); i++)
|
||||||
|
{
|
||||||
|
if(i != 0)
|
||||||
|
buf.append(" ");
|
||||||
|
MemoryByte bytes[] = ((IMemoryBlockExtension) fMemoryBlock).getBytesFromAddress(
|
||||||
|
transferAddress.add(CELLSIZE.multiply(BigInteger.valueOf(i))),
|
||||||
|
CELLSIZE.longValue() / ((IMemoryBlockExtension) fMemoryBlock).getAddressableSize());
|
||||||
|
for(int byteIndex = 0; byteIndex < bytes.length; byteIndex++)
|
||||||
|
{
|
||||||
|
String bString = BigInteger.valueOf(0xFF & bytes[byteIndex].getValue()).toString(16);
|
||||||
|
if(bString.length() == 1)
|
||||||
|
buf.append("0");
|
||||||
|
buf.append(bString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.write(buf.toString().toUpperCase());
|
||||||
|
writer.write("\n");
|
||||||
|
|
||||||
|
transferAddress = transferAddress.add(length);
|
||||||
|
|
||||||
|
jobCount = jobCount.add(BigInteger.ONE);
|
||||||
|
if(jobCount.compareTo(factor) == 0)
|
||||||
|
{
|
||||||
|
jobCount = BigInteger.ZERO;
|
||||||
|
monitor.worked(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.close();
|
||||||
|
monitor.done();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}};
|
||||||
|
job.setUser(true);
|
||||||
|
job.schedule();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,347 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.model.IMemoryImporter;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
|
import org.eclipse.swt.layout.FormData;
|
||||||
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
public class PlainTextImporter implements IMemoryImporter {
|
||||||
|
|
||||||
|
File fInputFile;
|
||||||
|
BigInteger fStartAddress;
|
||||||
|
boolean fUseCustomAddress;
|
||||||
|
Boolean fScrollToStart;
|
||||||
|
|
||||||
|
private Text fStartText;
|
||||||
|
private Text fFileText;
|
||||||
|
|
||||||
|
// private Button fComboRestoreToThisAddress;
|
||||||
|
// private Button fComboRestoreToFileAddress;
|
||||||
|
|
||||||
|
private Button fScrollToBeginningOnImportComplete;
|
||||||
|
|
||||||
|
private IMemoryBlock fMemoryBlock;
|
||||||
|
|
||||||
|
private ImportMemoryDialog fParentDialog;
|
||||||
|
|
||||||
|
private Properties fProperties;
|
||||||
|
|
||||||
|
public Control createControl(final Composite parent, IMemoryBlock memBlock, Properties properties, ImportMemoryDialog parentDialog)
|
||||||
|
{
|
||||||
|
fMemoryBlock = memBlock;
|
||||||
|
fParentDialog = parentDialog;
|
||||||
|
fProperties = properties;
|
||||||
|
|
||||||
|
fUseCustomAddress = true;
|
||||||
|
|
||||||
|
Composite composite = new Composite(parent, SWT.NONE)
|
||||||
|
{
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
fProperties.setProperty(TRANSFER_FILE, fFileText.getText());
|
||||||
|
fProperties.setProperty(TRANSFER_START, fStartText.getText());
|
||||||
|
fProperties.setProperty(TRANSFER_SCROLL_TO_START, fScrollToStart.toString());
|
||||||
|
|
||||||
|
fStartAddress = getStartAddress();
|
||||||
|
fInputFile = getFile();
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FormLayout formLayout = new FormLayout();
|
||||||
|
formLayout.spacing = 5;
|
||||||
|
formLayout.marginWidth = formLayout.marginHeight = 9;
|
||||||
|
composite.setLayout(formLayout);
|
||||||
|
|
||||||
|
// // restore to file address
|
||||||
|
//
|
||||||
|
// fComboRestoreToFileAddress = new Button(composite, SWT.RADIO);
|
||||||
|
// fComboRestoreToFileAddress.setText("Restore to address specified in the file");
|
||||||
|
// //comboRestoreToFileAddress.setLayoutData(data);
|
||||||
|
//
|
||||||
|
// // restore to this address
|
||||||
|
//
|
||||||
|
// fComboRestoreToThisAddress = new Button(composite, SWT.RADIO);
|
||||||
|
// fComboRestoreToThisAddress.setText("Restore to this address: ");
|
||||||
|
FormData data = new FormData();
|
||||||
|
// data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||||
|
// fComboRestoreToThisAddress.setLayoutData(data);
|
||||||
|
|
||||||
|
fStartText = new Text(composite, SWT.NONE);
|
||||||
|
data = new FormData();
|
||||||
|
// data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||||
|
// data.left = new FormAttachment(fComboRestoreToThisAddress);
|
||||||
|
data.width = 100;
|
||||||
|
fStartText.setLayoutData(data);
|
||||||
|
|
||||||
|
// file
|
||||||
|
|
||||||
|
Label fileLabel = new Label(composite, SWT.NONE);
|
||||||
|
fFileText = new Text(composite, SWT.NONE);
|
||||||
|
Button fileButton = new Button(composite, SWT.PUSH);
|
||||||
|
|
||||||
|
fileLabel.setText("File name: ");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
|
fileLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(fileLabel);
|
||||||
|
data.width = 300;
|
||||||
|
fFileText.setLayoutData(data);
|
||||||
|
|
||||||
|
fileButton.setText("Browse...");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fStartText);
|
||||||
|
data.left = new FormAttachment(fFileText);
|
||||||
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
|
fFileText.setText(properties.getProperty(TRANSFER_FILE, ""));
|
||||||
|
fScrollToStart = new Boolean(properties.getProperty(TRANSFER_SCROLL_TO_START, "true"));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BigInteger startAddress = null;
|
||||||
|
if(fMemoryBlock instanceof IMemoryBlockExtension)
|
||||||
|
startAddress = ((IMemoryBlockExtension) fMemoryBlock)
|
||||||
|
.getBigBaseAddress(); // FIXME use selection/caret address?
|
||||||
|
else
|
||||||
|
startAddress = BigInteger.valueOf(fMemoryBlock.getStartAddress());
|
||||||
|
|
||||||
|
if(properties.getProperty(TRANSFER_START) != null)
|
||||||
|
fStartText.setText(properties.getProperty(TRANSFER_START));
|
||||||
|
else
|
||||||
|
fStartText.setText("0x" + startAddress.toString(16));
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
|
||||||
|
fileButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE);
|
||||||
|
dialog.setText("Choose memory export file");
|
||||||
|
dialog.setFilterExtensions(new String[] { "*.*" } );
|
||||||
|
dialog.setFilterNames(new String[] { "All Files (*.*)" } );
|
||||||
|
dialog.setFileName(fFileText.getText());
|
||||||
|
dialog.open();
|
||||||
|
|
||||||
|
if(dialog.getFileName() != null)
|
||||||
|
{
|
||||||
|
fFileText.setText(dialog.getFilterPath() + File.separator + dialog.getFileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
fStartText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
boolean valid = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getStartAddress();
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fStartText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK) :
|
||||||
|
Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
fFileText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
fScrollToBeginningOnImportComplete = new Button(composite, SWT.CHECK);
|
||||||
|
fScrollToBeginningOnImportComplete.setText("Scroll to File Start Address");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fileButton);
|
||||||
|
fScrollToBeginningOnImportComplete.setLayoutData(data);
|
||||||
|
|
||||||
|
composite.pack();
|
||||||
|
parent.pack();
|
||||||
|
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validate()
|
||||||
|
{
|
||||||
|
boolean isValid = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getStartAddress();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fParentDialog.setValid(isValid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getScrollToStart()
|
||||||
|
{
|
||||||
|
return fScrollToBeginningOnImportComplete.getSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getStartAddress()
|
||||||
|
{
|
||||||
|
String text = fStartText.getText();
|
||||||
|
boolean hex = text.startsWith("0x");
|
||||||
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
|
hex ? 16 : 10);
|
||||||
|
|
||||||
|
return startAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getFile()
|
||||||
|
{
|
||||||
|
return new File(fFileText.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return "PlainTextImporter";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "Plain Text";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void importMemory() {
|
||||||
|
Job job = new Job("Memory Download from Plain Text File"){ //$NON-NLS-1$
|
||||||
|
|
||||||
|
public IStatus run(IProgressMonitor monitor) {
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BigInteger offset = null;
|
||||||
|
if(!fUseCustomAddress)
|
||||||
|
offset = BigInteger.ZERO;
|
||||||
|
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fInputFile)));
|
||||||
|
|
||||||
|
BigInteger jobs = BigInteger.valueOf(fInputFile.length());
|
||||||
|
BigInteger factor = BigInteger.ONE;
|
||||||
|
if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0)
|
||||||
|
{
|
||||||
|
factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF));
|
||||||
|
jobs = jobs.divide(factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$
|
||||||
|
|
||||||
|
BigInteger jobCount = BigInteger.ZERO;
|
||||||
|
BigInteger recordAddress = fStartAddress;
|
||||||
|
String line = reader.readLine();
|
||||||
|
while(line != null && !monitor.isCanceled())
|
||||||
|
{
|
||||||
|
StringTokenizer st = new StringTokenizer(line, " ");
|
||||||
|
int bytesRead = 0;
|
||||||
|
while(st.hasMoreElements())
|
||||||
|
{
|
||||||
|
String valueString = (String) st.nextElement();
|
||||||
|
int position = 0;
|
||||||
|
byte data[] = new byte[valueString.length() / 2];
|
||||||
|
for(int i = 0; i < data.length; i++)
|
||||||
|
{
|
||||||
|
data[i] = new BigInteger(valueString.substring(position++, position++ + 1), 16).byteValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
((IMemoryBlockExtension) fMemoryBlock).setValue(recordAddress.subtract(((IMemoryBlockExtension)
|
||||||
|
fMemoryBlock).getBigBaseAddress()).add(BigInteger.valueOf(bytesRead)), data);
|
||||||
|
|
||||||
|
bytesRead += data.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
recordAddress = recordAddress.and(BigInteger.valueOf(bytesRead));
|
||||||
|
|
||||||
|
jobCount = jobCount.add(BigInteger.valueOf(bytesRead));
|
||||||
|
while(jobCount.compareTo(factor) >= 0)
|
||||||
|
{
|
||||||
|
jobCount = jobCount.subtract(factor);
|
||||||
|
monitor.worked(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
line = reader.readLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
reader.close();
|
||||||
|
monitor.done();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e) {e.printStackTrace();}
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}};
|
||||||
|
job.setUser(true);
|
||||||
|
job.schedule();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,479 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.model.IMemoryExporter;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
|
import org.eclipse.debug.core.model.MemoryByte;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
|
import org.eclipse.swt.layout.FormData;
|
||||||
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
public class SRecordExporter implements IMemoryExporter
|
||||||
|
{
|
||||||
|
File fOutputFile;
|
||||||
|
BigInteger fStartAddress;
|
||||||
|
BigInteger fEndAddress;
|
||||||
|
|
||||||
|
private Text fStartText;
|
||||||
|
private Text fEndText;
|
||||||
|
private Text fLengthText;
|
||||||
|
private Text fFileText;
|
||||||
|
|
||||||
|
private IMemoryBlock fMemoryBlock;
|
||||||
|
|
||||||
|
private ExportMemoryDialog fParentDialog;
|
||||||
|
|
||||||
|
private Properties fProperties;
|
||||||
|
|
||||||
|
public Control createControl(final Composite parent, IMemoryBlock memBlock, Properties properties, ExportMemoryDialog parentDialog)
|
||||||
|
{
|
||||||
|
fMemoryBlock = memBlock;
|
||||||
|
fParentDialog = parentDialog;
|
||||||
|
fProperties = properties;
|
||||||
|
|
||||||
|
Composite composite = new Composite(parent, SWT.NONE)
|
||||||
|
{
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
fProperties.setProperty(TRANSFER_FILE, fFileText.getText());
|
||||||
|
fProperties.setProperty(TRANSFER_START, fStartText.getText());
|
||||||
|
fProperties.setProperty(TRANSFER_END, fEndText.getText());
|
||||||
|
|
||||||
|
fStartAddress = getStartAddress();
|
||||||
|
fEndAddress = getEndAddress();
|
||||||
|
fOutputFile = getFile();
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FormLayout formLayout = new FormLayout();
|
||||||
|
formLayout.spacing = 5;
|
||||||
|
formLayout.marginWidth = formLayout.marginHeight = 9;
|
||||||
|
composite.setLayout(formLayout);
|
||||||
|
|
||||||
|
// start address
|
||||||
|
|
||||||
|
Label startLabel = new Label(composite, SWT.NONE);
|
||||||
|
startLabel.setText("Start address: ");
|
||||||
|
FormData data = new FormData();
|
||||||
|
startLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
fStartText = new Text(composite, SWT.NONE);
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(startLabel);
|
||||||
|
data.left = new FormAttachment(startLabel);
|
||||||
|
data.width = 100;
|
||||||
|
fStartText.setLayoutData(data);
|
||||||
|
|
||||||
|
// end address
|
||||||
|
|
||||||
|
Label endLabel = new Label(composite, SWT.NONE);
|
||||||
|
endLabel.setText("End address: ");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(fStartText);
|
||||||
|
endLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
fEndText = new Text(composite, SWT.NONE);
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(endLabel);
|
||||||
|
data.width = 100;
|
||||||
|
fEndText.setLayoutData(data);
|
||||||
|
|
||||||
|
// length
|
||||||
|
|
||||||
|
Label lengthLabel = new Label(composite, SWT.NONE);
|
||||||
|
lengthLabel.setText("Length: ");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(fEndText);
|
||||||
|
lengthLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
fLengthText = new Text(composite, SWT.NONE);
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fStartText, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(lengthLabel);
|
||||||
|
data.width = 100;
|
||||||
|
fLengthText.setLayoutData(data);
|
||||||
|
|
||||||
|
// file
|
||||||
|
|
||||||
|
Label fileLabel = new Label(composite, SWT.NONE);
|
||||||
|
fFileText = new Text(composite, SWT.NONE);
|
||||||
|
Button fileButton = new Button(composite, SWT.PUSH);
|
||||||
|
|
||||||
|
fileLabel.setText("File name: ");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
|
fileLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(fileLabel);
|
||||||
|
data.width = 300;
|
||||||
|
fFileText.setLayoutData(data);
|
||||||
|
|
||||||
|
fileButton.setText("Browse...");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fLengthText);
|
||||||
|
data.left = new FormAttachment(fFileText);
|
||||||
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
|
fFileText.setText(properties.getProperty(TRANSFER_FILE, ""));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BigInteger startAddress = null;
|
||||||
|
if(fMemoryBlock instanceof IMemoryBlockExtension)
|
||||||
|
startAddress = ((IMemoryBlockExtension) fMemoryBlock)
|
||||||
|
.getBigBaseAddress(); // FIXME use selection/caret address?
|
||||||
|
else
|
||||||
|
startAddress = BigInteger.valueOf(fMemoryBlock.getStartAddress());
|
||||||
|
|
||||||
|
if(properties.getProperty(TRANSFER_START) != null)
|
||||||
|
fStartText.setText(properties.getProperty(TRANSFER_START));
|
||||||
|
else
|
||||||
|
fStartText.setText("0x" + startAddress.toString(16));
|
||||||
|
|
||||||
|
if(properties.getProperty(TRANSFER_END) != null)
|
||||||
|
fEndText.setText(properties.getProperty(TRANSFER_END));
|
||||||
|
else
|
||||||
|
fEndText.setText("0x" + startAddress.toString(16));
|
||||||
|
|
||||||
|
fLengthText.setText(getEndAddress().subtract(getStartAddress()).toString());
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
|
||||||
|
fileButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE);
|
||||||
|
dialog.setText("Choose memory export file");
|
||||||
|
dialog.setFilterExtensions(new String[] { "*.*" } );
|
||||||
|
dialog.setFilterNames(new String[] { "All Files (*.*)" } );
|
||||||
|
dialog.setFileName(fFileText.getText());
|
||||||
|
dialog.open();
|
||||||
|
|
||||||
|
if(dialog.getFileName() != null)
|
||||||
|
{
|
||||||
|
fFileText.setText(dialog.getFilterPath() + File.separator + dialog.getFileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
fStartText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
boolean valid = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getStartAddress();
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
fEndText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getEndAddress();
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
|
||||||
|
BigInteger endAddress = getEndAddress();
|
||||||
|
BigInteger startAddress = getStartAddress();
|
||||||
|
|
||||||
|
String lengthString = endAddress.subtract(startAddress).toString();
|
||||||
|
|
||||||
|
if(!fLengthText.getText().equals(lengthString))
|
||||||
|
fLengthText.setText(lengthString);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
fLengthText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BigInteger length = getLength();
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
BigInteger startAddress = getStartAddress();
|
||||||
|
String endString = "0x" + startAddress.add(length).toString(16);
|
||||||
|
if(!fEndText.getText().equals(endString))
|
||||||
|
fEndText.setText(endString);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
fFileText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
composite.pack();
|
||||||
|
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getEndAddress()
|
||||||
|
{
|
||||||
|
String text = fEndText.getText();
|
||||||
|
boolean hex = text.startsWith("0x");
|
||||||
|
BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
|
hex ? 16 : 10);
|
||||||
|
|
||||||
|
return endAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getStartAddress()
|
||||||
|
{
|
||||||
|
String text = fStartText.getText();
|
||||||
|
boolean hex = text.startsWith("0x");
|
||||||
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
|
hex ? 16 : 10);
|
||||||
|
|
||||||
|
return startAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getLength()
|
||||||
|
{
|
||||||
|
String text = fLengthText.getText();
|
||||||
|
boolean hex = text.startsWith("0x");
|
||||||
|
BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
|
hex ? 16 : 10);
|
||||||
|
|
||||||
|
return lengthAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getFile()
|
||||||
|
{
|
||||||
|
return new File(fFileText.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validate()
|
||||||
|
{
|
||||||
|
boolean isValid = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getEndAddress();
|
||||||
|
|
||||||
|
getStartAddress();
|
||||||
|
|
||||||
|
BigInteger length = getLength();
|
||||||
|
|
||||||
|
if(length.compareTo(BigInteger.ZERO) <= 0)
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
|
if(!getFile().getParentFile().exists())
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fParentDialog.setValid(isValid);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return "srecord";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "SRecord";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void exportMemory()
|
||||||
|
{
|
||||||
|
Job job = new Job("Memory Export to S-Record File"){ //$NON-NLS-1$
|
||||||
|
public IStatus run(IProgressMonitor monitor) {
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// FIXME 4 byte default
|
||||||
|
|
||||||
|
BigInteger DATA_PER_RECORD = BigInteger.valueOf(16);
|
||||||
|
|
||||||
|
BigInteger transferAddress = fStartAddress;
|
||||||
|
|
||||||
|
FileWriter writer = new FileWriter(fOutputFile);
|
||||||
|
|
||||||
|
BigInteger jobs = fEndAddress.subtract(transferAddress).divide(DATA_PER_RECORD);
|
||||||
|
BigInteger factor = BigInteger.ONE;
|
||||||
|
if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0)
|
||||||
|
{
|
||||||
|
factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF));
|
||||||
|
jobs = jobs.divide(factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
monitor.beginTask("Transferring Data", jobs.intValue());
|
||||||
|
|
||||||
|
BigInteger jobCount = BigInteger.ZERO;
|
||||||
|
while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled())
|
||||||
|
{
|
||||||
|
BigInteger length = DATA_PER_RECORD;
|
||||||
|
if(fEndAddress.subtract(transferAddress).compareTo(length) < 0)
|
||||||
|
length = fEndAddress.subtract(transferAddress);
|
||||||
|
|
||||||
|
writer.write("S3"); // FIXME 4 byte address
|
||||||
|
|
||||||
|
StringBuffer buf = new StringBuffer();
|
||||||
|
|
||||||
|
BigInteger sRecordLength = BigInteger.valueOf(4); // address size
|
||||||
|
sRecordLength = sRecordLength.add(length);
|
||||||
|
sRecordLength = sRecordLength.add(BigInteger.ONE); // checksum
|
||||||
|
|
||||||
|
String transferAddressString = transferAddress.toString(16);
|
||||||
|
|
||||||
|
String lengthString = sRecordLength.toString(16);
|
||||||
|
if(lengthString.length() == 1)
|
||||||
|
buf.append("0");
|
||||||
|
buf.append(lengthString);
|
||||||
|
for(int i = 0; i < 8 - transferAddressString.length(); i++)
|
||||||
|
buf.append("0");
|
||||||
|
buf.append(transferAddressString);
|
||||||
|
|
||||||
|
// data
|
||||||
|
|
||||||
|
MemoryByte bytes[] = ((IMemoryBlockExtension) fMemoryBlock).getBytesFromAddress(transferAddress,
|
||||||
|
length.longValue() / ((IMemoryBlockExtension) fMemoryBlock).getAddressableSize());
|
||||||
|
for(int byteIndex = 0; byteIndex < bytes.length; byteIndex++)
|
||||||
|
{
|
||||||
|
String bString = BigInteger.valueOf(0xFF & bytes[byteIndex].getValue()).toString(16);
|
||||||
|
if(bString.length() == 1)
|
||||||
|
buf.append("0");
|
||||||
|
buf.append(bString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The least significant byte of the one's complement of the sum of the values
|
||||||
|
* represented by the pairs of characters making up the records length, address,
|
||||||
|
* and the code/data fields.
|
||||||
|
*/
|
||||||
|
byte checksum = 0;
|
||||||
|
|
||||||
|
for(int i = 0; i < buf.length(); i+=2)
|
||||||
|
{
|
||||||
|
BigInteger value = new BigInteger(buf.substring(i, i+2), 16);
|
||||||
|
checksum += value.byteValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
buf.append(BigInteger.valueOf(0xFF - checksum).and(BigInteger.valueOf(0xFF)).toString(16));
|
||||||
|
|
||||||
|
writer.write(buf.toString().toUpperCase());
|
||||||
|
writer.write("\n");
|
||||||
|
|
||||||
|
transferAddress = transferAddress.add(length);
|
||||||
|
|
||||||
|
jobCount = jobCount.add(BigInteger.ONE);
|
||||||
|
if(jobCount.compareTo(factor) == 0)
|
||||||
|
{
|
||||||
|
jobCount = BigInteger.ZERO;
|
||||||
|
monitor.worked(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.close();
|
||||||
|
monitor.done();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}};
|
||||||
|
job.setUser(true);
|
||||||
|
job.schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,390 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.model.IMemoryImporter;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
|
import org.eclipse.swt.layout.FormData;
|
||||||
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
public class SRecordImporter implements IMemoryImporter {
|
||||||
|
|
||||||
|
File fInputFile;
|
||||||
|
BigInteger fStartAddress;
|
||||||
|
boolean fUseCustomAddress;
|
||||||
|
Boolean fScrollToStart;
|
||||||
|
|
||||||
|
private Text fStartText;
|
||||||
|
private Text fFileText;
|
||||||
|
|
||||||
|
private Button fComboRestoreToThisAddress;
|
||||||
|
private Button fComboRestoreToFileAddress;
|
||||||
|
|
||||||
|
private Button fScrollToBeginningOnImportComplete;
|
||||||
|
|
||||||
|
private IMemoryBlock fMemoryBlock;
|
||||||
|
|
||||||
|
private ImportMemoryDialog fParentDialog;
|
||||||
|
|
||||||
|
private Properties fProperties;
|
||||||
|
|
||||||
|
public Control createControl(final Composite parent, IMemoryBlock memBlock, Properties properties, ImportMemoryDialog parentDialog)
|
||||||
|
{
|
||||||
|
fMemoryBlock = memBlock;
|
||||||
|
fParentDialog = parentDialog;
|
||||||
|
fProperties = properties;
|
||||||
|
|
||||||
|
Composite composite = new Composite(parent, SWT.NONE)
|
||||||
|
{
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
fProperties.setProperty(TRANSFER_FILE, fFileText.getText());
|
||||||
|
fProperties.setProperty(TRANSFER_START, fStartText.getText());
|
||||||
|
fProperties.setProperty(TRANSFER_SCROLL_TO_START, fScrollToStart.toString());
|
||||||
|
|
||||||
|
fStartAddress = getStartAddress();
|
||||||
|
fInputFile = getFile();
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FormLayout formLayout = new FormLayout();
|
||||||
|
formLayout.spacing = 5;
|
||||||
|
formLayout.marginWidth = formLayout.marginHeight = 9;
|
||||||
|
composite.setLayout(formLayout);
|
||||||
|
|
||||||
|
// restore to file address
|
||||||
|
|
||||||
|
fComboRestoreToFileAddress = new Button(composite, SWT.RADIO);
|
||||||
|
fComboRestoreToFileAddress.setText("Restore to address specified in the file");
|
||||||
|
//comboRestoreToFileAddress.setLayoutData(data);
|
||||||
|
|
||||||
|
// restore to this address
|
||||||
|
|
||||||
|
fComboRestoreToThisAddress = new Button(composite, SWT.RADIO);
|
||||||
|
fComboRestoreToThisAddress.setText("Restore to this address: ");
|
||||||
|
FormData data = new FormData();
|
||||||
|
data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||||
|
fComboRestoreToThisAddress.setLayoutData(data);
|
||||||
|
|
||||||
|
fStartText = new Text(composite, SWT.NONE);
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fComboRestoreToFileAddress);
|
||||||
|
data.left = new FormAttachment(fComboRestoreToThisAddress);
|
||||||
|
data.width = 100;
|
||||||
|
fStartText.setLayoutData(data);
|
||||||
|
|
||||||
|
// file
|
||||||
|
|
||||||
|
Label fileLabel = new Label(composite, SWT.NONE);
|
||||||
|
fFileText = new Text(composite, SWT.NONE);
|
||||||
|
Button fileButton = new Button(composite, SWT.PUSH);
|
||||||
|
|
||||||
|
fileLabel.setText("File name: ");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
|
fileLabel.setLayoutData(data);
|
||||||
|
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fileButton, 0, SWT.CENTER);
|
||||||
|
data.left = new FormAttachment(fileLabel);
|
||||||
|
data.width = 300;
|
||||||
|
fFileText.setLayoutData(data);
|
||||||
|
|
||||||
|
fileButton.setText("Browse...");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fStartText);
|
||||||
|
data.left = new FormAttachment(fFileText);
|
||||||
|
fileButton.setLayoutData(data);
|
||||||
|
|
||||||
|
fFileText.setText(properties.getProperty(TRANSFER_FILE, ""));
|
||||||
|
fScrollToStart = new Boolean(properties.getProperty(TRANSFER_SCROLL_TO_START, "true"));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BigInteger startAddress = null;
|
||||||
|
if(fMemoryBlock instanceof IMemoryBlockExtension)
|
||||||
|
startAddress = ((IMemoryBlockExtension) fMemoryBlock)
|
||||||
|
.getBigBaseAddress(); // FIXME use selection/caret address?
|
||||||
|
else
|
||||||
|
startAddress = BigInteger.valueOf(fMemoryBlock.getStartAddress());
|
||||||
|
|
||||||
|
if(properties.getProperty(TRANSFER_START) != null)
|
||||||
|
fStartText.setText(properties.getProperty(TRANSFER_START));
|
||||||
|
else
|
||||||
|
fStartText.setText("0x" + startAddress.toString(16));
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
|
||||||
|
fileButton.addSelectionListener(new SelectionListener() {
|
||||||
|
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE);
|
||||||
|
dialog.setText("Choose memory export file");
|
||||||
|
dialog.setFilterExtensions(new String[] { "*.*" } );
|
||||||
|
dialog.setFilterNames(new String[] { "All Files (*.*)" } );
|
||||||
|
dialog.setFileName(fFileText.getText());
|
||||||
|
dialog.open();
|
||||||
|
|
||||||
|
if(dialog.getFileName() != null)
|
||||||
|
{
|
||||||
|
fFileText.setText(dialog.getFilterPath() + File.separator + dialog.getFileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
fStartText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
boolean valid = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getStartAddress();
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fStartText.setForeground(valid ? Display.getDefault().getSystemColor(SWT.COLOR_BLACK) :
|
||||||
|
Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
fFileText.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
fScrollToBeginningOnImportComplete = new Button(composite, SWT.CHECK);
|
||||||
|
fScrollToBeginningOnImportComplete.setText("Scroll to File Start Address");
|
||||||
|
data = new FormData();
|
||||||
|
data.top = new FormAttachment(fileButton);
|
||||||
|
fScrollToBeginningOnImportComplete.setLayoutData(data);
|
||||||
|
|
||||||
|
composite.pack();
|
||||||
|
parent.pack();
|
||||||
|
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validate()
|
||||||
|
{
|
||||||
|
boolean isValid = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getStartAddress();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fParentDialog.setValid(isValid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getScrollToStart()
|
||||||
|
{
|
||||||
|
return fScrollToBeginningOnImportComplete.getSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigInteger getStartAddress()
|
||||||
|
{
|
||||||
|
String text = fStartText.getText();
|
||||||
|
boolean hex = text.startsWith("0x");
|
||||||
|
BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text,
|
||||||
|
hex ? 16 : 10);
|
||||||
|
|
||||||
|
return startAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getFile()
|
||||||
|
{
|
||||||
|
return new File(fFileText.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return "snfimporter";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "SRecord";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void importMemory() {
|
||||||
|
Job job = new Job("Memory Download from S-Record File"){ //$NON-NLS-1$
|
||||||
|
|
||||||
|
public IStatus run(IProgressMonitor monitor) {
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// FIXME 4 byte default
|
||||||
|
|
||||||
|
final int CHECKSUM_LENGTH = 1;
|
||||||
|
|
||||||
|
BigInteger offset = null;
|
||||||
|
if(!fUseCustomAddress)
|
||||||
|
offset = BigInteger.ZERO;
|
||||||
|
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fInputFile)));
|
||||||
|
|
||||||
|
BigInteger jobs = BigInteger.valueOf(fInputFile.length());
|
||||||
|
BigInteger factor = BigInteger.ONE;
|
||||||
|
if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0)
|
||||||
|
{
|
||||||
|
factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF));
|
||||||
|
jobs = jobs.divide(factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$
|
||||||
|
|
||||||
|
BigInteger jobCount = BigInteger.ZERO;
|
||||||
|
String line = reader.readLine();
|
||||||
|
while(line != null && !monitor.isCanceled())
|
||||||
|
{
|
||||||
|
String recordType = line.substring(0, 2);
|
||||||
|
int recordCount = Integer.parseInt(line.substring(2, 4), 16);
|
||||||
|
int bytesRead = 4 + recordCount;
|
||||||
|
int position = 4;
|
||||||
|
int addressSize = 0;
|
||||||
|
|
||||||
|
BigInteger recordAddress = null;
|
||||||
|
|
||||||
|
if("S3".equals(recordType)) //$NON-NLS-1$
|
||||||
|
addressSize = 4;
|
||||||
|
else if("S1".equals(recordType)) //$NON-NLS-1$
|
||||||
|
addressSize = 2;
|
||||||
|
else if("S2".equals(recordType)) //$NON-NLS-1$
|
||||||
|
addressSize = 3;
|
||||||
|
|
||||||
|
recordAddress = new BigInteger(line.substring(position, position + addressSize * 2), 16);
|
||||||
|
recordCount -= addressSize;
|
||||||
|
position += addressSize * 2;
|
||||||
|
|
||||||
|
if(offset == null)
|
||||||
|
offset = fStartAddress.subtract(recordAddress);
|
||||||
|
|
||||||
|
recordAddress = recordAddress.add(offset);
|
||||||
|
|
||||||
|
byte data[] = new byte[recordCount - CHECKSUM_LENGTH];
|
||||||
|
for(int i = 0; i < data.length; i++)
|
||||||
|
{
|
||||||
|
data[i] = new BigInteger(line.substring(position++, position++ + 1), 16).byteValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The least significant byte of the one's complement of the sum of the values
|
||||||
|
* represented by the pairs of characters making up the records length, address,
|
||||||
|
* and the code/data fields.
|
||||||
|
*/
|
||||||
|
StringBuffer buf = new StringBuffer(line.substring(2));
|
||||||
|
byte checksum = 0;
|
||||||
|
|
||||||
|
for(int i = 0; i < buf.length(); i+=2)
|
||||||
|
{
|
||||||
|
BigInteger value = new BigInteger(buf.substring(i, i+2), 16);
|
||||||
|
checksum += value.byteValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Since we included the checksum in the checksum calculation the checksum
|
||||||
|
* ( if correct ) will always be 0xFF which is -1 using the signed byte size
|
||||||
|
* calculation here.
|
||||||
|
*/
|
||||||
|
if ( checksum != (byte) -1 ) {
|
||||||
|
reader.close();
|
||||||
|
monitor.done();
|
||||||
|
return new Status( IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), "Checksum failure of line = " + line); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME error on incorrect checksum
|
||||||
|
|
||||||
|
((IMemoryBlockExtension) fMemoryBlock).setValue(recordAddress.subtract(((IMemoryBlockExtension) fMemoryBlock).getBigBaseAddress()), data);
|
||||||
|
|
||||||
|
jobCount = jobCount.add(BigInteger.valueOf(bytesRead));
|
||||||
|
while(jobCount.compareTo(factor) >= 0)
|
||||||
|
{
|
||||||
|
jobCount = jobCount.subtract(factor);
|
||||||
|
monitor.worked(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
line = reader.readLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
reader.close();
|
||||||
|
monitor.done();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
DebugUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.INTERNAL_ERROR, "Failure", e));
|
||||||
|
}
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}};
|
||||||
|
job.setUser(true);
|
||||||
|
job.schedule();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport.actions;
|
||||||
|
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.ExportMemoryDialog;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
||||||
|
import org.eclipse.debug.internal.ui.views.memory.MemoryViewIdRegistry;
|
||||||
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
|
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
||||||
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.IViewActionDelegate;
|
||||||
|
import org.eclipse.ui.IViewPart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action for exporting memory.
|
||||||
|
*/
|
||||||
|
public class ExportMemoryAction implements IViewActionDelegate {
|
||||||
|
|
||||||
|
private MemoryView fView;
|
||||||
|
|
||||||
|
public void init(IViewPart view) {
|
||||||
|
if (view instanceof MemoryView)
|
||||||
|
fView = (MemoryView) view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run(IAction action) {
|
||||||
|
|
||||||
|
ISelection selection = fView.getSite().getSelectionProvider()
|
||||||
|
.getSelection();
|
||||||
|
if (selection instanceof IStructuredSelection) {
|
||||||
|
IStructuredSelection strucSel = (IStructuredSelection) selection;
|
||||||
|
|
||||||
|
// return if current selection is empty
|
||||||
|
if (strucSel.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Object obj = strucSel.getFirstElement();
|
||||||
|
|
||||||
|
if (obj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IMemoryBlock memBlock = null;
|
||||||
|
|
||||||
|
if (obj instanceof IMemoryRendering) {
|
||||||
|
memBlock = ((IMemoryRendering) obj).getMemoryBlock();
|
||||||
|
} else if (obj instanceof IMemoryBlock) {
|
||||||
|
memBlock = (IMemoryBlock) obj;
|
||||||
|
}
|
||||||
|
if(memBlock == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ExportMemoryDialog dialog = new ExportMemoryDialog(DebugUIPlugin.getShell(), memBlock);
|
||||||
|
dialog.open();
|
||||||
|
|
||||||
|
dialog.getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectionChanged(IAction action, ISelection selection) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport.actions;
|
||||||
|
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.ImportMemoryDialog;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
||||||
|
import org.eclipse.debug.internal.ui.views.memory.MemoryViewIdRegistry;
|
||||||
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
|
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
||||||
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.IViewActionDelegate;
|
||||||
|
import org.eclipse.ui.IViewPart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action for downloading memory.
|
||||||
|
*/
|
||||||
|
public class ImportMemoryAction implements IViewActionDelegate {
|
||||||
|
|
||||||
|
|
||||||
|
private MemoryView fView;
|
||||||
|
|
||||||
|
public void init(IViewPart view) {
|
||||||
|
if (view instanceof MemoryView)
|
||||||
|
fView = (MemoryView) view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run(IAction action) {
|
||||||
|
|
||||||
|
ISelection selection = fView.getSite().getSelectionProvider()
|
||||||
|
.getSelection();
|
||||||
|
if (selection instanceof IStructuredSelection) {
|
||||||
|
IStructuredSelection strucSel = (IStructuredSelection) selection;
|
||||||
|
|
||||||
|
// return if current selection is empty
|
||||||
|
if (strucSel.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Object obj = strucSel.getFirstElement();
|
||||||
|
|
||||||
|
if (obj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IMemoryBlock memBlock = null;
|
||||||
|
|
||||||
|
if (obj instanceof IMemoryRendering) {
|
||||||
|
memBlock = ((IMemoryRendering) obj).getMemoryBlock();
|
||||||
|
} else if (obj instanceof IMemoryBlock) {
|
||||||
|
memBlock = (IMemoryBlock) obj;
|
||||||
|
}
|
||||||
|
if(memBlock == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ImportMemoryDialog dialog = new ImportMemoryDialog(DebugUIPlugin.getShell(), memBlock);
|
||||||
|
dialog.open();
|
||||||
|
|
||||||
|
dialog.getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectionChanged(IAction action, ISelection selection) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport.model;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.ExportMemoryDialog;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
|
public interface IMemoryExporter
|
||||||
|
{
|
||||||
|
public static final String TRANSFER_FILE = "File";
|
||||||
|
public static final String TRANSFER_START = "Start";
|
||||||
|
public static final String TRANSFER_END = "End";
|
||||||
|
|
||||||
|
public Control createControl(Composite parent, IMemoryBlock memBlock, Properties properties, ExportMemoryDialog parentDialog);
|
||||||
|
|
||||||
|
public void exportMemory();
|
||||||
|
|
||||||
|
public String getId();
|
||||||
|
|
||||||
|
public String getName();
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006-2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.dd.debug.ui.memory.transport.model;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.eclipse.dd.debug.ui.memory.transport.ImportMemoryDialog;
|
||||||
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
|
public interface IMemoryImporter
|
||||||
|
{
|
||||||
|
public static final String TRANSFER_FILE = "File";
|
||||||
|
public static final String TRANSFER_START = "Start";
|
||||||
|
public static final String TRANSFER_END = "End";
|
||||||
|
public static final String TRANSFER_SCROLL_TO_START = "ScrollToStart";
|
||||||
|
|
||||||
|
public Control createControl(Composite parent, IMemoryBlock memBlock, Properties properties, ImportMemoryDialog parentDialog);
|
||||||
|
|
||||||
|
public void importMemory();
|
||||||
|
|
||||||
|
public String getId();
|
||||||
|
|
||||||
|
public String getName();
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue