From 3abb81f9e4bd3bd6488ac73d3eea8e9a065ad047 Mon Sep 17 00:00:00 2001 From: Randy Rohrbach Date: Mon, 19 Oct 2009 13:41:19 +0000 Subject: [PATCH] Bugzilla 292660. --- .../memorybrowser/GoToAddressBarWidget.java | 4 +- .../memory/memorybrowser/MemoryBrowser.java | 6 +- .../memorybrowser/MemoryBrowserPlugin.java | 2 +- .../memory/memorybrowser/messages.properties | 2 + .../plugin.xml | 4 +- .../debug/ui/memory/search/FindAction.java | 11 +-- .../ui/memory/search/FindReplaceDialog.java | 28 +++---- .../memory/transport/ExportMemoryDialog.java | 16 ++-- .../memory/transport/ImportMemoryDialog.java | 14 ++-- .../memory/transport/PlainTextExporter.java | 54 +++++++------- .../memory/transport/PlainTextImporter.java | 46 ++++++------ .../memory/transport/RAWBinaryExporter.java | 50 ++++++------- .../memory/transport/RAWBinaryImporter.java | 45 +++++------ .../ui/memory/transport/SRecordExporter.java | 60 +++++++-------- .../ui/memory/transport/SRecordImporter.java | 69 ++++++++--------- .../ui/memory/transport/messages.properties | 74 +++++++++++++++++++ .../transport/model/IMemoryExporter.java | 6 +- .../transport/model/IMemoryImporter.java | 8 +- 18 files changed, 289 insertions(+), 210 deletions(-) diff --git a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/GoToAddressBarWidget.java b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/GoToAddressBarWidget.java index 82401b828f0..7e7282cf347 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/GoToAddressBarWidget.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/GoToAddressBarWidget.java @@ -51,10 +51,10 @@ public class GoToAddressBarWidget { fExpression.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fOKButton = new Button(fComposite, SWT.NONE); - fOKButton.setText("Go"); + fOKButton.setText(Messages.getString("GoToAddressBarWidget.Go")); //$NON-NLS-1$ fOKNewTabButton = new Button(fComposite, SWT.NONE); - fOKNewTabButton.setText("New Tab"); + fOKNewTabButton.setText(Messages.getString("GoToAddressBarWidget.NewTab")); //$NON-NLS-1$ return fComposite; } diff --git a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java index 21423835b56..ecf6aa1723d 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java @@ -235,7 +235,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL for (int i = 0; i < managerTypes.length; i++) { if (managerTypes[i] instanceof Class) { Class clazz = (Class)managerTypes[i]; - if ("org.eclipse.debug.ui.contexts.IBug145635Marker".equals(clazz.getName()) ) { + if ("org.eclipse.debug.ui.contexts.IBug145635Marker".equals(clazz.getName()) ) { //$NON-NLS-1$ return true; } } @@ -251,7 +251,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL */ private String getPresentationContextId() { IViewSite site = (IViewSite)getSite(); - return site.getId() + (site.getSecondaryId() != null ? (":" + site.getSecondaryId()) : ""); + return site.getId() + (site.getSecondaryId() != null ? (":" + site.getSecondaryId()) : ""); //$NON-NLS-1$ //$NON-NLS-2$ } public void dispose() { @@ -615,7 +615,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL }; - IMemoryBlock block = createMemoryBlock(retrieval, "0", context); + IMemoryBlock block = createMemoryBlock(retrieval, "0", context); //$NON-NLS-1$ fCurrentContainers.add(container); rendering.init(container, block); diff --git a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowserPlugin.java b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowserPlugin.java index 87b989699d6..eac2bc52272 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowserPlugin.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowserPlugin.java @@ -21,7 +21,7 @@ import org.osgi.framework.BundleContext; public class MemoryBrowserPlugin extends AbstractUIPlugin { // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.cdt.debug.ui.memory.memorybrowser"; + public static final String PLUGIN_ID = "org.eclipse.cdt.debug.ui.memory.memorybrowser"; //$NON-NLS-1$ // The shared instance private static MemoryBrowserPlugin plugin; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/messages.properties b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/messages.properties index 998b245faf1..27252677376 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/messages.properties +++ b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/messages.properties @@ -10,5 +10,7 @@ ############################################################################### GoToAddressBarWidget.Go=Go +GoToAddressBarWidget.Go=Go +GoToAddressBarWidget.NewTab=New Tab GoToAddressBarWidget.NewTab=New Tab MemoryBrowser.DefaultRendering=Default Rendering diff --git a/memory/org.eclipse.cdt.debug.ui.memory.search/plugin.xml b/memory/org.eclipse.cdt.debug.ui.memory.search/plugin.xml index 06164320fd5..7114869a804 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.search/plugin.xml +++ b/memory/org.eclipse.cdt.debug.ui.memory.search/plugin.xml @@ -8,7 +8,7 @@ @@ -33,7 +33,7 @@ diff --git a/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindAction.java b/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindAction.java index 829bbe93051..8f24632c30d 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindAction.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindAction.java @@ -27,6 +27,8 @@ import org.eclipse.ui.IViewPart; public class FindAction implements IViewActionDelegate { + private static String FIND_NEXT_ID = "org.eclipse.cdt.debug.ui.memory.search.FindNextAction"; //$NON-NLS-1$ + private IMemoryRenderingSite fView; private static Properties fSearchDialogProperties = new Properties(); @@ -63,9 +65,9 @@ public class FindAction implements IViewActionDelegate { Shell shell = CDebugUIPlugin.getActiveWorkbenchShell(); FindReplaceDialog dialog = new FindReplaceDialog(shell, (IMemoryBlockExtension) memBlock, fView, (Properties) fSearchDialogProperties); - if(action.getText().equalsIgnoreCase("Find Next")) + if(action.getId().equals(FIND_NEXT_ID)) { - if(fSearchDialogProperties.getProperty(FindReplaceDialog.SEARCH_ENABLE_FIND_NEXT, "false").equals("true")) + if(Boolean.valueOf(fSearchDialogProperties.getProperty(FindReplaceDialog.SEARCH_ENABLE_FIND_NEXT, Boolean.FALSE.toString()))) { dialog.performFindNext(); } @@ -83,10 +85,9 @@ public class FindAction implements IViewActionDelegate { } public void selectionChanged(IAction action, ISelection selection) { - if(action.getText().equalsIgnoreCase("Find Next")) + if(action.getId().equals(FIND_NEXT_ID)) { - action.setEnabled(fSearchDialogProperties.getProperty(FindReplaceDialog.SEARCH_ENABLE_FIND_NEXT, "false") - .equals("true")); + action.setEnabled(Boolean.valueOf(fSearchDialogProperties.getProperty(FindReplaceDialog.SEARCH_ENABLE_FIND_NEXT, Boolean.FALSE.toString()))); } } diff --git a/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceDialog.java b/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceDialog.java index 23e38d66898..7fc35ef095b 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceDialog.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.search/src/org/eclipse/cdt/debug/ui/memory/search/FindReplaceDialog.java @@ -332,13 +332,13 @@ public class FindReplaceDialog extends SelectionDialog else if(fFormatOctalButton.getSelection()) fProperties.setProperty(SEARCH_FORMAT, SEARCH_FORMAT_OCTAL); - fProperties.setProperty(SEARCH_FORMAT_FORWARD, "" + fForwardButton.getSelection()); + fProperties.setProperty(SEARCH_FORMAT_FORWARD, Boolean.toString(fForwardButton.getSelection())); - fProperties.setProperty(SEARCH_FORMAT_CASEINSENSTIVE, "" + fCaseInSensitiveCheckbox.getSelection()); + fProperties.setProperty(SEARCH_FORMAT_CASEINSENSTIVE, Boolean.toString(fCaseInSensitiveCheckbox.getSelection())); - fProperties.setProperty(SEARCH_FORMAT_WRAP, "" + fWrapCheckbox.getSelection()); + fProperties.setProperty(SEARCH_FORMAT_WRAP, Boolean.toString(fWrapCheckbox.getSelection())); - fProperties.setProperty(SEARCH_ENABLE_FIND_NEXT, "false"); + fProperties.setProperty(SEARCH_ENABLE_FIND_NEXT, Boolean.FALSE.toString()); setResult(null); @@ -547,7 +547,7 @@ public class FindReplaceDialog extends SelectionDialog data.left = new FormAttachment(fReplaceText, 0, SWT.LEFT); data.width = 260; fFindText.setLayoutData(data); - fFindText.setText(fProperties.getProperty(SEARCH_FIND, "")); + fFindText.setText(fProperties.getProperty(SEARCH_FIND, "")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fFindText, 0, SWT.CENTER); @@ -565,7 +565,7 @@ public class FindReplaceDialog extends SelectionDialog data.left = new FormAttachment(replaceLabel); data.width = 260; fReplaceText.setLayoutData(data); - fReplaceText.setText(fProperties.getProperty(SEARCH_REPLACE, "")); + fReplaceText.setText(fProperties.getProperty(SEARCH_REPLACE, "")); //$NON-NLS-1$ // group direction @@ -582,7 +582,7 @@ public class FindReplaceDialog extends SelectionDialog fForwardButton.setText(Messages.getString("FindReplaceDialog.ButtonForward")); //$NON-NLS-1$ final Button backwardButton = new Button(directionGroup, SWT.RADIO); backwardButton.setText(Messages.getString("FindReplaceDialog.ButtonBackward")); //$NON-NLS-1$ - final boolean isForward = fProperties.getProperty(SEARCH_FORMAT_FORWARD, "true").equalsIgnoreCase("true"); + final boolean isForward = Boolean.parseBoolean(fProperties.getProperty(SEARCH_FORMAT_FORWARD, Boolean.TRUE.toString())); fForwardButton.setSelection(isForward); backwardButton.setSelection(!isForward); @@ -824,7 +824,7 @@ public class FindReplaceDialog extends SelectionDialog private BigInteger parseHexBigInteger(String s) { - if(s.toUpperCase().startsWith("0X")) + if(s.toUpperCase().startsWith("0X")) //$NON-NLS-1$ return new BigInteger(s.substring(2), 16); else return new BigInteger(s, 16); @@ -836,8 +836,8 @@ public class FindReplaceDialog extends SelectionDialog { BigInteger start = parseHexBigInteger(fProperties.getProperty(SEARCH_LAST_FOUND)); BigInteger end = parseHexBigInteger(fProperties.getProperty(SEARCH_END)); - boolean searchForward = fProperties.getProperty(SEARCH_FORMAT_FORWARD, "false").equals("true"); - boolean caseInSensitive = fProperties.getProperty(SEARCH_FORMAT_CASEINSENSTIVE, "false").equals("true"); + boolean searchForward = Boolean.parseBoolean(fProperties.getProperty(SEARCH_FORMAT_FORWARD, Boolean.FALSE.toString())); + boolean caseInSensitive = Boolean.parseBoolean(fProperties.getProperty(SEARCH_FORMAT_CASEINSENSTIVE, Boolean.FALSE.toString())); if(searchForward) start = start.add(BigInteger.ONE); else @@ -866,7 +866,7 @@ public class FindReplaceDialog extends SelectionDialog } catch(Exception e) { - MemorySearchPlugin.logError(Messages.getString("FindReplaceDialog.MemorySearchFailure"), e); + MemorySearchPlugin.logError(Messages.getString("FindReplaceDialog.MemorySearchFailure"), e); //$NON-NLS-1$ } } @@ -979,7 +979,7 @@ public class FindReplaceDialog extends SelectionDialog { // Temporary, until platform accepts/adds new interface for setting the selection try { - Method m = rendering.getClass().getMethod("setSelection", new Class[] { BigInteger.class, BigInteger.class } ); + Method m = rendering.getClass().getMethod("setSelection", new Class[] { BigInteger.class, BigInteger.class } ); //$NON-NLS-1$ if(m != null) m.invoke(rendering, finalCurrentPosition, finalCurrentPosition.add(searchPhraseLength)); } catch (Exception e) { @@ -991,8 +991,8 @@ public class FindReplaceDialog extends SelectionDialog }); - fProperties.setProperty(SEARCH_ENABLE_FIND_NEXT, "true"); - fProperties.setProperty(SEARCH_LAST_FOUND, "0x" + finalCurrentPosition.toString(16)); + fProperties.setProperty(SEARCH_ENABLE_FIND_NEXT, Boolean.TRUE.toString()); + fProperties.setProperty(SEARCH_LAST_FOUND, "0x" + finalCurrentPosition.toString(16)); //$NON-NLS-1$ return Status.OK_STATUS; } } diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ExportMemoryDialog.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ExportMemoryDialog.java index 942965a971a..02e80cdf6a2 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ExportMemoryDialog.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ExportMemoryDialog.java @@ -58,7 +58,7 @@ public class ExportMemoryDialog extends SelectionDialog public ExportMemoryDialog(Shell parent, IMemoryBlock memoryBlock, BigInteger initialStartAddr) { super(parent); - super.setTitle("Export Memory"); + super.setTitle(Messages.getString("ExportMemoryDialog.Title")); //$NON-NLS-1$ setShellStyle(getShellStyle() | SWT.RESIZE); fMemoryBlock = memoryBlock; @@ -123,7 +123,7 @@ public class ExportMemoryDialog extends SelectionDialog // format Label textLabel = new Label(composite, SWT.NONE); - textLabel.setText("Format: "); + textLabel.setText(Messages.getString("ExportMemoryDialog.Format")); //$NON-NLS-1$ fFormatCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); @@ -135,26 +135,26 @@ public class ExportMemoryDialog extends SelectionDialog data.left = new FormAttachment(textLabel); fFormatCombo.setLayoutData(data); - Vector exporters = new Vector(); + Vector exporters = new Vector(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = - registry.getExtensionPoint("org.eclipse.cdt.debug.ui.memory.transport.memoryTransport"); + registry.getExtensionPoint("org.eclipse.cdt.debug.ui.memory.transport.memoryTransport"); //$NON-NLS-1$ IConfigurationElement points[] = extensionPoint.getConfigurationElements(); for (int i = 0; i < points.length; i++) { IConfigurationElement element = points[i]; - if("exporter".equals(element.getName())) + if("exporter".equals(element.getName())) //$NON-NLS-1$ { try { - exporters.addElement((IMemoryExporter) element.createExecutableExtension("class")); + exporters.addElement((IMemoryExporter) element.createExecutableExtension("class")); //$NON-NLS-1$ } catch(Exception e) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$ } } } @@ -205,7 +205,7 @@ public class ExportMemoryDialog extends SelectionDialog * and only if we have a fresh/clean properties object. */ static void initProperties(Properties properties, BigInteger addr) { - final String addrstr = "0x" + addr.toString(16); + final String addrstr = "0x" + addr.toString(16); //$NON-NLS-1$ if (!properties.containsKey(IMemoryExporter.TRANSFER_START)) { properties.setProperty(IMemoryExporter.TRANSFER_START, addrstr); properties.setProperty(IMemoryExporter.TRANSFER_END, addrstr); diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java index 7ad1306e5f1..e99d6360b8f 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java @@ -69,7 +69,7 @@ public class ImportMemoryDialog extends SelectionDialog public ImportMemoryDialog(Shell parent, IMemoryBlock memoryBlock, BigInteger initialStartAddr, IMemoryRenderingSite renderingSite) { super(parent); - super.setTitle("Download to Memory"); + super.setTitle(Messages.getString("ImportMemoryDialog.Title")); //$NON-NLS-1$ setShellStyle(getShellStyle() | SWT.RESIZE); fMemoryBlock = memoryBlock; @@ -168,7 +168,7 @@ public class ImportMemoryDialog extends SelectionDialog // format Label textLabel = new Label(composite, SWT.NONE); - textLabel.setText("Format: "); + textLabel.setText(Messages.getString("ImportMemoryDialog.Format")); //$NON-NLS-1$ fFormatCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); @@ -184,22 +184,22 @@ public class ImportMemoryDialog extends SelectionDialog IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = - registry.getExtensionPoint("org.eclipse.cdt.debug.ui.memory.transport.memoryTransport"); + registry.getExtensionPoint("org.eclipse.cdt.debug.ui.memory.transport.memoryTransport"); //$NON-NLS-1$ IConfigurationElement points[] = extensionPoint.getConfigurationElements(); for (int i = 0; i < points.length; i++) { IConfigurationElement element = points[i]; - if("importer".equals(element.getName())) + if("importer".equals(element.getName())) //$NON-NLS-1$ { try { - importers.addElement(element.createExecutableExtension("class")); + importers.addElement(element.createExecutableExtension("class")); //$NON-NLS-1$ } catch(Exception e) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$ } } } @@ -251,7 +251,7 @@ public class ImportMemoryDialog extends SelectionDialog * and only if we have a fresh/clean properties object. */ static void initProperties(Properties properties, BigInteger addr) { - final String addrstr = "0x" + addr.toString(16); + final String addrstr = "0x" + addr.toString(16); //$NON-NLS-1$ if (!properties.containsKey(IMemoryImporter.TRANSFER_START)) { properties.setProperty(IMemoryImporter.TRANSFER_START, addrstr); } diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java index d376d9821ca..cc984ce4676 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java @@ -89,7 +89,7 @@ public class PlainTextExporter implements IMemoryExporter { // start address Label startLabel = new Label(composite, SWT.NONE); - startLabel.setText("Start address: "); + startLabel.setText(Messages.getString("PlainTextExporter.StartAddress")); //$NON-NLS-1$ FormData data = new FormData(); startLabel.setLayoutData(data); @@ -102,7 +102,7 @@ public class PlainTextExporter implements IMemoryExporter { // end address Label endLabel = new Label(composite, SWT.NONE); - endLabel.setText("End address: "); + endLabel.setText(Messages.getString("PlainTextExporter.EndAddress")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fStartText, 0, SWT.CENTER); data.left = new FormAttachment(fStartText); @@ -118,7 +118,7 @@ public class PlainTextExporter implements IMemoryExporter { // length Label lengthLabel = new Label(composite, SWT.NONE); - lengthLabel.setText("Length: "); + lengthLabel.setText(Messages.getString("PlainTextExporter.Length")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fStartText, 0, SWT.CENTER); data.left = new FormAttachment(fEndText); @@ -137,7 +137,7 @@ public class PlainTextExporter implements IMemoryExporter { fFileText = new Text(composite, SWT.NONE); Button fileButton = new Button(composite, SWT.PUSH); - fileLabel.setText("File name: "); + fileLabel.setText(Messages.getString("Exporter.FileName")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fileButton, 0, SWT.CENTER); fileLabel.setLayoutData(data); @@ -148,14 +148,14 @@ public class PlainTextExporter implements IMemoryExporter { data.width = 300; fFileText.setLayoutData(data); - fileButton.setText("Browse..."); + fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fLengthText); data.left = new FormAttachment(fFileText); fileButton.setLayoutData(data); - fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); + fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$ try { fStartText.setText(properties.getProperty(TRANSFER_START)); @@ -165,7 +165,7 @@ public class PlainTextExporter implements IMemoryExporter { catch(IllegalArgumentException e) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$ } fileButton.addSelectionListener(new SelectionListener() { @@ -177,9 +177,9 @@ public class PlainTextExporter implements IMemoryExporter { 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.setText(Messages.getString("PlainTextExporter.ChooseFile")); //$NON-NLS-1$ + dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ + dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$NON-NLS-1$ dialog.setFileName(fFileText.getText()); dialog.open(); @@ -256,7 +256,7 @@ public class PlainTextExporter implements IMemoryExporter { BigInteger length = getLength(); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); BigInteger startAddress = getStartAddress(); - String endString = "0x" + startAddress.add(length).toString(16); + String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$ if(!fEndText.getText().equals(endString)) fEndText.setText(endString); } @@ -293,7 +293,7 @@ public class PlainTextExporter implements IMemoryExporter { public BigInteger getEndAddress() { String text = fEndText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -303,7 +303,7 @@ public class PlainTextExporter implements IMemoryExporter { public BigInteger getStartAddress() { String text = fStartText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -313,7 +313,7 @@ public class PlainTextExporter implements IMemoryExporter { public BigInteger getLength() { String text = fLengthText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -354,12 +354,12 @@ public class PlainTextExporter implements IMemoryExporter { public String getId() { - return "PlainTextExporter"; + return "PlainTextExporter"; //$NON-NLS-1$ } public String getName() { - return "Plain Text"; + return Messages.getString("PlainTextExporter.Name"); //$NON-NLS-1$ } public void exportMemory() { @@ -387,7 +387,7 @@ public class PlainTextExporter implements IMemoryExporter { jobs = jobs.divide(factor); } - monitor.beginTask("Transferring Data", jobs.intValue()); + monitor.beginTask(Messages.getString("Exporter.ProgressTitle"), jobs.intValue()); //$NON-NLS-1$ BigInteger jobCount = BigInteger.ZERO; while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled()) @@ -396,7 +396,7 @@ public class PlainTextExporter implements IMemoryExporter { if(fEndAddress.subtract(transferAddress).compareTo(length) < 0) length = fEndAddress.subtract(transferAddress); - monitor.subTask(String.format("Transfering %s bytes at address 0x%s", length.toString(10), transferAddress.toString(16))); + monitor.subTask(String.format(Messages.getString("Exporter.Progress"), length.toString(10), transferAddress.toString(16))); //$NON-NLS-1$ StringBuffer buf = new StringBuffer(); @@ -413,7 +413,7 @@ public class PlainTextExporter implements IMemoryExporter { for(int i = 0; i < length.divide(CELLSIZE).intValue(); i++) { if(i != 0) - buf.append(" "); + buf.append(" "); //$NON-NLS-1$ MemoryByte bytes[] = ((IMemoryBlockExtension) fMemoryBlock).getBytesFromAddress( transferAddress.add(CELLSIZE.multiply(BigInteger.valueOf(i))), CELLSIZE.longValue() / ((IMemoryBlockExtension) fMemoryBlock).getAddressableSize()); @@ -421,13 +421,13 @@ public class PlainTextExporter implements IMemoryExporter { { String bString = BigInteger.valueOf(0xFF & bytes[byteIndex].getValue()).toString(16); if(bString.length() == 1) - buf.append("0"); + buf.append("0"); //$NON-NLS-1$ buf.append(bString); } } writer.write(buf.toString().toUpperCase()); - writer.write("\n"); + writer.write("\n"); //$NON-NLS-1$ transferAddress = transferAddress.add(length); @@ -443,20 +443,20 @@ public class PlainTextExporter implements IMemoryExporter { monitor.done(); } catch (IOException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to file.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrFile"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to file.", ex); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrFile"), ex); //$NON-NLS-1$ } catch (DebugException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could read from target.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrReadTarget"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could read from target.", ex); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrReadTarget"), ex); //$NON-NLS-1$ } catch (Exception ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure exporting memory", ex)); + DebugException.INTERNAL_ERROR, Messages.getString("Exporter.Falure"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure exporting memory", ex); + DebugException.INTERNAL_ERROR, Messages.getString("Exporter.Falure"), ex); //$NON-NLS-1$ } return Status.OK_STATUS; }}; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java index 59bc5968c83..2ea5071d494 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java @@ -109,7 +109,7 @@ public class PlainTextImporter implements IMemoryImporter { // fComboRestoreToThisAddress.setLayoutData(data); Label labelStartText = new Label(composite, SWT.NONE); - labelStartText.setText("Restore to address: "); + labelStartText.setText(Messages.getString("PlainTextImporter.RestoreAddress")); //$NON-NLS-1$ fStartText = new Text(composite, SWT.NONE); data = new FormData(); @@ -124,7 +124,7 @@ public class PlainTextImporter implements IMemoryImporter { fFileText = new Text(composite, SWT.NONE); Button fileButton = new Button(composite, SWT.PUSH); - fileLabel.setText("File name: "); + fileLabel.setText(Messages.getString("Importer.File")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fileButton, 0, SWT.CENTER); fileLabel.setLayoutData(data); @@ -135,14 +135,14 @@ public class PlainTextImporter implements IMemoryImporter { data.width = 300; fFileText.setLayoutData(data); - fileButton.setText("Browse..."); + fileButton.setText(Messages.getString("Importer.Browse")); //$NON-NLS-1$ 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")); + fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$ + fScrollToStart = Boolean.valueOf(properties.getProperty(TRANSFER_SCROLL_TO_START, Boolean.TRUE.toString())); try { fStartText.setText(properties.getProperty(TRANSFER_START)); @@ -150,7 +150,7 @@ public class PlainTextImporter implements IMemoryImporter { catch(IllegalArgumentException e) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$ } fileButton.addSelectionListener(new SelectionListener() { @@ -162,9 +162,9 @@ public class PlainTextImporter implements IMemoryImporter { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE); - dialog.setText("Choose memory import file"); - dialog.setFilterExtensions(new String[] { "*.*;*" } ); - dialog.setFilterNames(new String[] { "All Files" } ); + dialog.setText(Messages.getString("PlainTextImporter.ChooseFile")); //$NON-NLS-1$ + dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ + dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$NON-NLS-1$ dialog.setFileName(fFileText.getText()); dialog.open(); @@ -207,7 +207,7 @@ public class PlainTextImporter implements IMemoryImporter { }); fScrollToBeginningOnImportComplete = new Button(composite, SWT.CHECK); - fScrollToBeginningOnImportComplete.setText("Scroll to File Start Address"); + fScrollToBeginningOnImportComplete.setText(Messages.getString("PlainTextImporter.ScrollToStart")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fileButton); fScrollToBeginningOnImportComplete.setLayoutData(data); @@ -251,7 +251,7 @@ public class PlainTextImporter implements IMemoryImporter { public BigInteger getStartAddress() { String text = fStartText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -265,12 +265,12 @@ public class PlainTextImporter implements IMemoryImporter { public String getId() { - return "PlainTextImporter"; + return "PlainTextImporter"; //$NON-NLS-1$ } public String getName() { - return "Plain Text"; + return Messages.getString("PlainTextImporter.Name"); //$NON-NLS-1$ } public void importMemory() { @@ -293,14 +293,14 @@ public class PlainTextImporter implements IMemoryImporter { jobs = jobs.divide(factor); } - monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$ + monitor.beginTask(Messages.getString("Importer.ProgressTitle"), jobs.intValue()); //$NON-NLS-1$ BigInteger recordAddress = fStartAddress; String line = reader.readLine(); int lineNo = 1; // line error reporting while(line != null && !monitor.isCanceled()) { - StringTokenizer st = new StringTokenizer(line, " "); + StringTokenizer st = new StringTokenizer(line, " "); //$NON-NLS-1$ int bytesRead = 0; while(st.hasMoreElements()) { @@ -313,7 +313,7 @@ public class PlainTextImporter implements IMemoryImporter { data[i] = new BigInteger(valueString.substring(position++, position++ + 1), 16).byteValue(); } catch (NumberFormatException ex) { return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, String.format("Invalid file format. Expected integer at line %d", lineNo ), ex); + DebugException.REQUEST_FAILED, String.format(Messages.getString("PlainTextImporter.ErrInvalidFormat"), lineNo ), ex); //$NON-NLS-1$ } } @@ -344,24 +344,24 @@ public class PlainTextImporter implements IMemoryImporter { reader.close(); monitor.done(); - if(fProperties.getProperty(TRANSFER_SCROLL_TO_START, "false").equals("true")) + if(Boolean.parseBoolean(fProperties.getProperty(TRANSFER_SCROLL_TO_START, Boolean.FALSE.toString()))) fParentDialog.scrollRenderings(scrollToAddress); } catch (IOException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not read from file.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrReadFile"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not read from file.", ex); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrReadFile"), ex); //$NON-NLS-1$ } catch (DebugException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to target.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrWriteTarget"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to target.", ex); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrWriteTarget"), ex); //$NON-NLS-1$ } catch (Exception ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure importing from file", ex)); + DebugException.INTERNAL_ERROR, Messages.getString("Importer.FalureImporting"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure importing from file", ex); + DebugException.INTERNAL_ERROR, Messages.getString("Importer.FalureImporting"), ex); //$NON-NLS-1$ } return Status.OK_STATUS; }}; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java index 4b8ec8c532a..a0a088c88ad 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java @@ -88,7 +88,7 @@ public class RAWBinaryExporter implements IMemoryExporter // start address Label startLabel = new Label(composite, SWT.NONE); - startLabel.setText("Start address: "); + startLabel.setText(Messages.getString("RAWBinaryExporter.StartAddress")); //$NON-NLS-1$ FormData data = new FormData(); startLabel.setLayoutData(data); @@ -101,7 +101,7 @@ public class RAWBinaryExporter implements IMemoryExporter // end address Label endLabel = new Label(composite, SWT.NONE); - endLabel.setText("End address: "); + endLabel.setText(Messages.getString("RAWBinaryExporter.EndAddress")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fStartText, 0, SWT.CENTER); data.left = new FormAttachment(fStartText); @@ -117,7 +117,7 @@ public class RAWBinaryExporter implements IMemoryExporter // length Label lengthLabel = new Label(composite, SWT.NONE); - lengthLabel.setText("Length: "); + lengthLabel.setText(Messages.getString("RAWBinaryExporter.Length")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fStartText, 0, SWT.CENTER); data.left = new FormAttachment(fEndText); @@ -136,7 +136,7 @@ public class RAWBinaryExporter implements IMemoryExporter fFileText = new Text(composite, SWT.NONE); Button fileButton = new Button(composite, SWT.PUSH); - fileLabel.setText("File name: "); + fileLabel.setText(Messages.getString("Exporter.FileName")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fileButton, 0, SWT.CENTER); fileLabel.setLayoutData(data); @@ -147,13 +147,13 @@ public class RAWBinaryExporter implements IMemoryExporter data.width = 300; fFileText.setLayoutData(data); - fileButton.setText("Browse..."); + fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fLengthText); data.left = new FormAttachment(fFileText); fileButton.setLayoutData(data); - fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); + fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$ try { fStartText.setText(properties.getProperty(TRANSFER_START)); @@ -163,7 +163,7 @@ public class RAWBinaryExporter implements IMemoryExporter catch(IllegalArgumentException e) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$ } fileButton.addSelectionListener(new SelectionListener() { @@ -173,9 +173,9 @@ public class RAWBinaryExporter implements IMemoryExporter 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.setText(Messages.getString("RAWBinaryExporter.ChooseFile")); //$NON-NLS-1$ + dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ + dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$NON-NLS-1$ dialog.setFileName(fFileText.getText()); dialog.open(); @@ -252,7 +252,7 @@ public class RAWBinaryExporter implements IMemoryExporter BigInteger length = getLength(); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); BigInteger startAddress = getStartAddress(); - String endString = "0x" + startAddress.add(length).toString(16); + String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$ if(!fEndText.getText().equals(endString)) fEndText.setText(endString); } @@ -305,7 +305,7 @@ public class RAWBinaryExporter implements IMemoryExporter public BigInteger getEndAddress() { String text = fEndText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -315,7 +315,7 @@ public class RAWBinaryExporter implements IMemoryExporter public BigInteger getStartAddress() { String text = fStartText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -325,7 +325,7 @@ public class RAWBinaryExporter implements IMemoryExporter public BigInteger getLength() { String text = fLengthText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -366,12 +366,12 @@ public class RAWBinaryExporter implements IMemoryExporter public String getId() { - return "rawbinary"; + return "rawbinary"; //$NON-NLS-1$ } public String getName() { - return "RAW Binary"; + return Messages.getString("RAWBinaryExporter.Name"); //$NON-NLS-1$ } public void exportMemory() @@ -394,7 +394,7 @@ public class RAWBinaryExporter implements IMemoryExporter jobs = jobs.divide(factor); } - monitor.beginTask("Transferring Data", jobs.intValue()); + monitor.beginTask(Messages.getString("Exporter.ProgressTitle"), jobs.intValue()); //$NON-NLS-1$ BigInteger jobCount = BigInteger.ZERO; while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled()) @@ -403,7 +403,7 @@ public class RAWBinaryExporter implements IMemoryExporter if(fEndAddress.subtract(transferAddress).compareTo(length) < 0) length = fEndAddress.subtract(transferAddress); - monitor.subTask(String.format("Transfering %s bytes at address 0x%s", length.toString(10), transferAddress.toString(16))); + monitor.subTask(String.format(Messages.getString("Exporter.Progress"), length.toString(10), transferAddress.toString(16))); //$NON-NLS-1$ // data byte[] byteValues = new byte[length.intValue()]; @@ -432,20 +432,20 @@ public class RAWBinaryExporter implements IMemoryExporter monitor.done(); } catch (IOException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to file.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrFile"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to file.", ex); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrFile"), ex); //$NON-NLS-1$ } catch (DebugException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not read from target.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrReadTarget"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not read from target.", ex); - } catch (Exception e) { + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrReadTarget"), ex); //$NON-NLS-1$ + } catch (Exception ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure exporting memory", e)); + DebugException.INTERNAL_ERROR, Messages.getString("Exporter.Falure"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure exporting memory", e); + DebugException.INTERNAL_ERROR, Messages.getString("Exporter.Falure"), ex); //$NON-NLS-1$ } return Status.OK_STATUS; }}; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java index 0b58dcbcf1e..339c7d03f80 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java @@ -87,7 +87,7 @@ public class RAWBinaryImporter implements IMemoryImporter { // restore to this address Label labelStartText = new Label(composite, SWT.NONE); - labelStartText.setText("Restore to address: "); + labelStartText.setText(Messages.getString("RAWBinaryImporter.RestoreAddress")); //$NON-NLS-1$ fStartText = new Text(composite, SWT.NONE); FormData data = new FormData(); @@ -101,7 +101,7 @@ public class RAWBinaryImporter implements IMemoryImporter { fFileText = new Text(composite, SWT.NONE); Button fileButton = new Button(composite, SWT.PUSH); - fileLabel.setText("File name: "); + fileLabel.setText(Messages.getString("Importer.File")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fileButton, 0, SWT.CENTER); fileLabel.setLayoutData(data); @@ -112,14 +112,14 @@ public class RAWBinaryImporter implements IMemoryImporter { data.width = 300; fFileText.setLayoutData(data); - fileButton.setText("Browse..."); + fileButton.setText(Messages.getString("Importer.Browse")); //$NON-NLS-1$ 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")); + fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$ + fScrollToStart = Boolean.valueOf(properties.getProperty(TRANSFER_SCROLL_TO_START, Boolean.TRUE.toString())); try { fStartText.setText(properties.getProperty(TRANSFER_START)); @@ -127,7 +127,7 @@ public class RAWBinaryImporter implements IMemoryImporter { catch(IllegalArgumentException e) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$ } fileButton.addSelectionListener(new SelectionListener() { @@ -137,9 +137,9 @@ public class RAWBinaryImporter implements IMemoryImporter { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE); - dialog.setText("Choose memory import file"); - dialog.setFilterExtensions(new String[] { "*.*;*" } ); - dialog.setFilterNames(new String[] { "All Files" } ); + dialog.setText(Messages.getString("RAWBinaryImporter.ChooseFile")); //$NON-NLS-1$ + dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ + dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$NON-NLS-1$ dialog.setFileName(fFileText.getText()); dialog.open(); @@ -182,7 +182,7 @@ public class RAWBinaryImporter implements IMemoryImporter { }); fScrollToBeginningOnImportComplete = new Button(composite, SWT.CHECK); - fScrollToBeginningOnImportComplete.setText("Scroll to File Start Address"); + fScrollToBeginningOnImportComplete.setText(Messages.getString("RAWBinaryImporter.ScrollToStart")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fileButton); fScrollToBeginningOnImportComplete.setLayoutData(data); @@ -226,7 +226,7 @@ public class RAWBinaryImporter implements IMemoryImporter { public BigInteger getStartAddress() { String text = fStartText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -240,12 +240,12 @@ public class RAWBinaryImporter implements IMemoryImporter { public String getId() { - return "rawbinary"; + return "rawbinary"; //$NON-NLS-1$ } public String getName() { - return "RAW Binary"; + return Messages.getString("RAWBinaryImporter.Name"); //$NON-NLS-1$ } public void importMemory() { @@ -270,7 +270,7 @@ public class RAWBinaryImporter implements IMemoryImporter { byte[] byteValues = new byte[1024]; - monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$ + monitor.beginTask(Messages.getString("Importer.ProgressTitle"), jobs.intValue()); //$NON-NLS-1$ int actualByteCount = reader.read(byteValues); BigInteger recordAddress = fStartAddress; @@ -307,24 +307,25 @@ public class RAWBinaryImporter implements IMemoryImporter { reader.close(); monitor.done(); - if(fProperties.getProperty(TRANSFER_SCROLL_TO_START, "false").equals("true")) + if(Boolean.parseBoolean(fProperties.getProperty(TRANSFER_SCROLL_TO_START, Boolean.FALSE.toString()))) fParentDialog.scrollRenderings(scrollToAddress); + } catch (IOException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not read from file.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrReadFile"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not read from file.", ex); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrReadFile"), ex); //$NON-NLS-1$ } catch (DebugException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to target.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrWriteTarget"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to target.", ex); - } catch (Exception ex) { + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrWriteTarget"), ex); //$NON-NLS-1$ + } catch (Exception ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure importing from file", ex)); + DebugException.INTERNAL_ERROR, Messages.getString("Importer.FalureImporting"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure importing from file", ex); + DebugException.INTERNAL_ERROR, Messages.getString("Importer.FalureImporting"), ex); //$NON-NLS-1$ } return Status.OK_STATUS; }}; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java index 2c818db1d67..aa3be4dceb5 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java @@ -88,7 +88,7 @@ public class SRecordExporter implements IMemoryExporter // start address Label startLabel = new Label(composite, SWT.NONE); - startLabel.setText("Start address: "); + startLabel.setText(Messages.getString("SRecordExporter.StartAddress")); //$NON-NLS-1$ FormData data = new FormData(); startLabel.setLayoutData(data); @@ -101,7 +101,7 @@ public class SRecordExporter implements IMemoryExporter // end address Label endLabel = new Label(composite, SWT.NONE); - endLabel.setText("End address: "); + endLabel.setText(Messages.getString("SRecordExporter.EndAddress")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fStartText, 0, SWT.CENTER); data.left = new FormAttachment(fStartText); @@ -117,7 +117,7 @@ public class SRecordExporter implements IMemoryExporter // length Label lengthLabel = new Label(composite, SWT.NONE); - lengthLabel.setText("Length: "); + lengthLabel.setText(Messages.getString("SRecordExporter.Length")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fStartText, 0, SWT.CENTER); data.left = new FormAttachment(fEndText); @@ -136,7 +136,7 @@ public class SRecordExporter implements IMemoryExporter fFileText = new Text(composite, SWT.NONE); Button fileButton = new Button(composite, SWT.PUSH); - fileLabel.setText("File name: "); + fileLabel.setText(Messages.getString("Exporter.FileName")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fileButton, 0, SWT.CENTER); fileLabel.setLayoutData(data); @@ -147,13 +147,13 @@ public class SRecordExporter implements IMemoryExporter data.width = 300; fFileText.setLayoutData(data); - fileButton.setText("Browse..."); + fileButton.setText(Messages.getString("Exporter.Browse")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fLengthText); data.left = new FormAttachment(fFileText); fileButton.setLayoutData(data); - fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); + fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$ try { fStartText.setText(properties.getProperty(TRANSFER_START)); @@ -163,7 +163,7 @@ public class SRecordExporter implements IMemoryExporter catch(IllegalArgumentException e) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$ } fileButton.addSelectionListener(new SelectionListener() { @@ -175,9 +175,9 @@ public class SRecordExporter implements IMemoryExporter 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.setText(Messages.getString("SRecordExporter.ChooseFile")); //$NON-NLS-1$ + dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ + dialog.setFilterNames(new String[] { Messages.getString("Exporter.AllFiles") } ); //$NON-NLS-1$ dialog.setFileName(fFileText.getText()); dialog.open(); @@ -254,7 +254,7 @@ public class SRecordExporter implements IMemoryExporter BigInteger length = getLength(); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); BigInteger startAddress = getStartAddress(); - String endString = "0x" + startAddress.add(length).toString(16); + String endString = "0x" + startAddress.add(length).toString(16); //$NON-NLS-1$ if(!fEndText.getText().equals(endString)) fEndText.setText(endString); } @@ -307,7 +307,7 @@ public class SRecordExporter implements IMemoryExporter public BigInteger getEndAddress() { String text = fEndText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger endAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -317,7 +317,7 @@ public class SRecordExporter implements IMemoryExporter public BigInteger getStartAddress() { String text = fStartText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -327,7 +327,7 @@ public class SRecordExporter implements IMemoryExporter public BigInteger getLength() { String text = fLengthText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger lengthAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -368,12 +368,12 @@ public class SRecordExporter implements IMemoryExporter public String getId() { - return "srecord"; + return "srecord"; //$NON-NLS-1$ } public String getName() { - return "SRecord"; + return Messages.getString("SRecordExporter.Name"); //$NON-NLS-1$ } public void exportMemory() @@ -398,7 +398,7 @@ public class SRecordExporter implements IMemoryExporter jobs = jobs.divide(factor); } - monitor.beginTask("Transferring Data", jobs.intValue()); + monitor.beginTask(Messages.getString("Exporter.ProgressTitle"), jobs.intValue()); //$NON-NLS-1$ BigInteger jobCount = BigInteger.ZERO; while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled()) @@ -407,9 +407,9 @@ public class SRecordExporter implements IMemoryExporter if(fEndAddress.subtract(transferAddress).compareTo(length) < 0) length = fEndAddress.subtract(transferAddress); - monitor.subTask(String.format("Transfering %s bytes at address 0x%s", length.toString(10), transferAddress.toString(16))); + monitor.subTask(String.format(Messages.getString("Exporter.Progress"), length.toString(10), transferAddress.toString(16))); //$NON-NLS-1$ - writer.write("S3"); // FIXME 4 byte address + writer.write("S3"); // FIXME 4 byte address //$NON-NLS-1$ StringBuffer buf = new StringBuffer(); @@ -421,10 +421,10 @@ public class SRecordExporter implements IMemoryExporter String lengthString = sRecordLength.toString(16); if(lengthString.length() == 1) - buf.append("0"); + buf.append("0"); //$NON-NLS-1$ buf.append(lengthString); for(int i = 0; i < 8 - transferAddressString.length(); i++) - buf.append("0"); + buf.append("0"); //$NON-NLS-1$ buf.append(transferAddressString); // data @@ -435,7 +435,7 @@ public class SRecordExporter implements IMemoryExporter { String bString = BigInteger.valueOf(0xFF & bytes[byteIndex].getValue()).toString(16); if(bString.length() == 1) - buf.append("0"); + buf.append("0"); //$NON-NLS-1$ buf.append(bString); } @@ -454,11 +454,11 @@ public class SRecordExporter implements IMemoryExporter String bString = BigInteger.valueOf(0xFF - checksum).and(BigInteger.valueOf(0xFF)).toString(16); if(bString.length() == 1) - buf.append("0"); + buf.append("0"); //$NON-NLS-1$ buf.append(bString); writer.write(buf.toString().toUpperCase()); - writer.write("\n"); + writer.write("\n"); //$NON-NLS-1$ transferAddress = transferAddress.add(length); @@ -474,20 +474,20 @@ public class SRecordExporter implements IMemoryExporter monitor.done(); } catch (IOException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to file.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrFile"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to file.", ex); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrFile"), ex); //$NON-NLS-1$ } catch (DebugException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not read from target.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrReadTarget"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not read from target.", ex); + DebugException.REQUEST_FAILED, Messages.getString("Exporter.ErrReadTarget"), ex); //$NON-NLS-1$ } catch (Exception ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure exporting memory", ex)); + DebugException.INTERNAL_ERROR, Messages.getString("Exporter.Falure"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure exporting memory", ex); + DebugException.INTERNAL_ERROR, Messages.getString("Exporter.Falure"), ex); //$NON-NLS-1$ } return Status.OK_STATUS; }}; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java index 41c62197835..87eedc0a778 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java @@ -78,7 +78,7 @@ public class SRecordImporter implements IMemoryImporter { fProperties.setProperty(TRANSFER_FILE, fFileText.getText()); fProperties.setProperty(TRANSFER_START, fStartText.getText()); fProperties.setProperty(TRANSFER_SCROLL_TO_START, fScrollToStart.toString()); - fProperties.setProperty(TRANSFER_CUSTOM_START_ADDRESS, "" + fComboRestoreToThisAddress.getSelection()); + fProperties.setProperty(TRANSFER_CUSTOM_START_ADDRESS, "" + fComboRestoreToThisAddress.getSelection()); //$NON-NLS-1$ fStartAddress = getStartAddress(); fInputFile = getFile(); @@ -95,15 +95,15 @@ public class SRecordImporter implements IMemoryImporter { fComboRestoreToFileAddress = new Button(composite, SWT.RADIO); fComboRestoreToFileAddress.setSelection(true); - fComboRestoreToFileAddress.setText("Restore to address specified in the file"); - fComboRestoreToFileAddress.setSelection(!new Boolean(properties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, "false")).booleanValue()); + fComboRestoreToFileAddress.setText(Messages.getString("SRecordImporter.FileAddressRestore")); //$NON-NLS-1$ + fComboRestoreToFileAddress.setSelection(!Boolean.getBoolean(properties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, Boolean.FALSE.toString()))); //comboRestoreToFileAddress.setLayoutData(data); // restore to this address fComboRestoreToThisAddress = new Button(composite, SWT.RADIO); - fComboRestoreToThisAddress.setText("Restore to this address: "); - fComboRestoreToThisAddress.setSelection(new Boolean(properties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, "false")).booleanValue()); + fComboRestoreToThisAddress.setText(Messages.getString("SRecordImporter.CustomAddressRestore")); //$NON-NLS-1$ + fComboRestoreToThisAddress.setSelection(Boolean.parseBoolean(properties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, Boolean.FALSE.toString()))); FormData data = new FormData(); data.top = new FormAttachment(fComboRestoreToFileAddress); fComboRestoreToThisAddress.setLayoutData(data); @@ -139,7 +139,7 @@ public class SRecordImporter implements IMemoryImporter { fFileText = new Text(composite, SWT.NONE); Button fileButton = new Button(composite, SWT.PUSH); - fileLabel.setText("File name: "); + fileLabel.setText(Messages.getString("Importer.File")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fileButton, 0, SWT.CENTER); fileLabel.setLayoutData(data); @@ -150,14 +150,14 @@ public class SRecordImporter implements IMemoryImporter { data.width = 300; fFileText.setLayoutData(data); - fileButton.setText("Browse..."); + fileButton.setText(Messages.getString("Importer.Browse")); //$NON-NLS-1$ 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")); + fFileText.setText(properties.getProperty(TRANSFER_FILE, "")); //$NON-NLS-1$ + fScrollToStart = Boolean.valueOf(properties.getProperty(TRANSFER_SCROLL_TO_START, Boolean.TRUE.toString())); try { fStartText.setText(properties.getProperty(TRANSFER_START)); @@ -165,7 +165,7 @@ public class SRecordImporter implements IMemoryImporter { catch(IllegalArgumentException e) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure", e)); //$NON-NLS-1$ } fileButton.addSelectionListener(new SelectionListener() { @@ -177,9 +177,9 @@ public class SRecordImporter implements IMemoryImporter { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE); - dialog.setText("Choose memory import file"); - dialog.setFilterExtensions(new String[] { "*.*;*" } ); - dialog.setFilterNames(new String[] { "All Files" } ); + dialog.setText(Messages.getString("SRecordImporter.ChooseFile")); //$NON-NLS-1$ + dialog.setFilterExtensions(new String[] { "*.*;*" } ); //$NON-NLS-1$ + dialog.setFilterNames(new String[] { Messages.getString("Importer.AllFiles") } ); //$NON-NLS-1$ dialog.setFileName(fFileText.getText()); dialog.open(); @@ -222,7 +222,7 @@ public class SRecordImporter implements IMemoryImporter { }); fScrollToBeginningOnImportComplete = new Button(composite, SWT.CHECK); - fScrollToBeginningOnImportComplete.setText("Scroll to File Start Address"); + fScrollToBeginningOnImportComplete.setText(Messages.getString("SRecordImporter.ScrollToStart")); //$NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fileButton); fScrollToBeginningOnImportComplete.setLayoutData(data); @@ -274,7 +274,7 @@ public class SRecordImporter implements IMemoryImporter { public BigInteger getStartAddress() { String text = fStartText.getText(); - boolean hex = text.startsWith("0x"); + boolean hex = text.startsWith("0x"); //$NON-NLS-1$ BigInteger startAddress = new BigInteger(hex ? text.substring(2) : text, hex ? 16 : 10); @@ -288,12 +288,12 @@ public class SRecordImporter implements IMemoryImporter { public String getId() { - return "srecord"; + return "srecord"; //$NON-NLS-1$ } public String getName() { - return "SRecord"; + return Messages.getString("SRecordImporter.Name"); //$NON-NLS-1$ } public void importMemory() { @@ -312,7 +312,7 @@ public class SRecordImporter implements IMemoryImporter { BigInteger scrollToAddress = null; BigInteger offset = null; - if(!fProperties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, "false").equals("true")) + if(!Boolean.parseBoolean(fProperties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, Boolean.FALSE.toString()))) offset = BigInteger.ZERO; BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fInputFile))); @@ -325,7 +325,7 @@ public class SRecordImporter implements IMemoryImporter { jobs = jobs.divide(factor); } - monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$ + monitor.beginTask(Messages.getString("Importer.ProgressTitle"), jobs.intValue()); //$NON-NLS-1$ String line = reader.readLine(); int lineNo = 1; // line error reporting @@ -337,7 +337,7 @@ public class SRecordImporter implements IMemoryImporter { recordCount = Integer.parseInt(line.substring(2, 4), 16); } catch (NumberFormatException ex) { return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, String.format("Invalid file format. Invalid line length at line %d", lineNo ), ex); + DebugException.REQUEST_FAILED, String.format(Messages.getString("SRecordImporter.InvalidLineLength"), lineNo ), ex); //$NON-NLS-1$ } int bytesRead = 4 + recordCount; @@ -346,18 +346,18 @@ public class SRecordImporter implements IMemoryImporter { BigInteger recordAddress = null; - if("S3".equals(recordType)) //$NON-NLS-1$ + if("S3".equals(recordType)) //$NON-NLS-1$ addressSize = 4; - else if("S1".equals(recordType)) //$NON-NLS-1$ + else if("S1".equals(recordType)) //$NON-NLS-1$ addressSize = 2; - else if("S2".equals(recordType)) //$NON-NLS-1$ + else if("S2".equals(recordType)) //$NON-NLS-1$ addressSize = 3; try { recordAddress = new BigInteger(line.substring(position, position + addressSize * 2), 16); } catch (NumberFormatException ex) { return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, String.format("Invalid file format. Invalid address at line %d", lineNo ), ex); + DebugException.REQUEST_FAILED, String.format(Messages.getString("SRecordImporter.InvalidAddress"), lineNo ), ex); //$NON-NLS-1$ } recordCount -= addressSize; position += addressSize * 2; @@ -374,7 +374,7 @@ public class SRecordImporter implements IMemoryImporter { data[i] = new BigInteger(line.substring(position++, position++ + 1), 16).byteValue(); } catch (NumberFormatException ex) { return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, String.format("Invalid file format. Invalid data at line %d", lineNo ), ex); + DebugException.REQUEST_FAILED, String.format(Messages.getString("SRecordImporter.InvalidData"), lineNo ), ex); //$NON-NLS-1$ } } @@ -393,7 +393,7 @@ public class SRecordImporter implements IMemoryImporter { value = new BigInteger(buf.substring(i, i+2), 16); } catch (NumberFormatException ex) { return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, String.format("Invalid file format. Invalid checksum format at line %d", lineNo ), ex); + DebugException.REQUEST_FAILED, String.format(Messages.getString("SRecordImporter.InvalidChecksum"), lineNo ), ex); //$NON-NLS-1$ } checksum += value.byteValue(); } @@ -406,7 +406,7 @@ public class SRecordImporter implements IMemoryImporter { if ( checksum != (byte) -1 ) { reader.close(); monitor.done(); - return new Status( IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), "Checksum failure of line = " + line); //$NON-NLS-1$ + return new Status( IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), Messages.getString("SRecordImporter.ChecksumFalure") + line); //$NON-NLS-1$ } if(scrollToAddress == null) @@ -429,24 +429,25 @@ public class SRecordImporter implements IMemoryImporter { reader.close(); monitor.done(); - if(fProperties.getProperty(TRANSFER_SCROLL_TO_START, "false").equals("true")) + if(Boolean.parseBoolean(fProperties.getProperty(TRANSFER_SCROLL_TO_START, Boolean.FALSE.toString()))) fParentDialog.scrollRenderings(scrollToAddress); + } catch (IOException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not read from file.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrReadFile"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not read from file.", ex); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrReadFile"), ex); //$NON-NLS-1$ } catch (DebugException ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to target.", ex)); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrWriteTarget"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.REQUEST_FAILED, "Could not write to target.", ex); + DebugException.REQUEST_FAILED, Messages.getString("Importer.ErrWriteTarget"), ex); //$NON-NLS-1$ } catch (Exception ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure importing from file", ex)); + DebugException.INTERNAL_ERROR, Messages.getString("Importer.FalureImporting"), ex)); //$NON-NLS-1$ return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure importing from file", ex); + DebugException.INTERNAL_ERROR, Messages.getString("Importer.FalureImporting"), ex); //$NON-NLS-1$ } return Status.OK_STATUS; }}; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/messages.properties b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/messages.properties index e69de29bb2d..c3a03ba9e12 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/messages.properties +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/messages.properties @@ -0,0 +1,74 @@ +############################################################################### +# Copyright (c) 2009 Wind River Systems 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) - initial API and implementation +# Teodor Madan (Freescale) - +############################################################################### + +ExportMemoryDialog.Format=Format: +ExportMemoryDialog.Title=Export Memory + +ImportMemoryDialog.Format=Format: +ImportMemoryDialog.Title=Download to Memory + +Exporter.AllFiles=All Files +Exporter.Browse=Browse... +Exporter.ErrFile=Could not write to file. +Exporter.ErrReadTarget=Could not read from target. +Exporter.Falure=Failure exporting memory +Exporter.FileName=File name: +Exporter.Progress=Transferring %s bytes at address 0x%s +Exporter.ProgressTitle=Transferring Data + +Importer.AllFiles=All Files +Importer.Browse=Browse... +Importer.ErrReadFile=Could not read from file. +Importer.ErrWriteTarget=Could not write to target. +Importer.FalureImporting=Failure importing from file +Importer.File=File name: +Importer.ProgressTitle=Transferring Data + +PlainTextExporter.ChooseFile=Choose memory export file +PlainTextExporter.EndAddress=End address: +PlainTextExporter.Length=Length: +PlainTextExporter.Name=Plain Text +PlainTextExporter.StartAddress=Start address: + +PlainTextImporter.ChooseFile=Choose memory import file +PlainTextImporter.ErrInvalidFormat=Invalid file format. Expected integer at line %d +PlainTextImporter.Name=Plain Text +PlainTextImporter.RestoreAddress=Restore to address: +PlainTextImporter.ScrollToStart=Scroll to File Start Address + +SRecordExporter.ChooseFile=Choose memory export file +SRecordExporter.EndAddress=End address: +SRecordExporter.Length=Length: +SRecordExporter.Name=SRecord +SRecordExporter.StartAddress=Start address: + +SRecordImporter.ChecksumFalure=Checksum failure of line = +SRecordImporter.ChooseFile=Choose memory import file +SRecordImporter.CustomAddressRestore=Restore to this address: +SRecordImporter.FileAddressRestore=Restore to address specified in the file +SRecordImporter.InvalidAddress=Invalid file format. Invalid address at line %d +SRecordImporter.InvalidChecksum=Invalid file format. Invalid checksum format at line %d +SRecordImporter.InvalidData=Invalid file format. Invalid data at line %d +SRecordImporter.InvalidLineLength=Invalid file format. Invalid line length at line %d +SRecordImporter.Name=SRecord +SRecordImporter.ScrollToStart=Scroll to File Start Address + +RAWBinaryExporter.ChooseFile=Choose memory export file +RAWBinaryExporter.EndAddress=End address: +RAWBinaryExporter.Length=Length: +RAWBinaryExporter.Name=RAW Binary +RAWBinaryExporter.StartAddress=Start address: + +RAWBinaryImporter.ChooseFile=Choose memory import file +RAWBinaryImporter.Name=RAW Binary +RAWBinaryImporter.RestoreAddress=Restore to address: +RAWBinaryImporter.ScrollToStart=Scroll to File Start Address diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/model/IMemoryExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/model/IMemoryExporter.java index 8f3da546fe3..f7cc098abd7 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/model/IMemoryExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/model/IMemoryExporter.java @@ -20,9 +20,9 @@ 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 static final String TRANSFER_FILE = "File"; //$NON-NLS-1$ + public static final String TRANSFER_START = "Start"; //$NON-NLS-1$ + public static final String TRANSFER_END = "End"; //$NON-NLS-1$ /** * @param parent diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/model/IMemoryImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/model/IMemoryImporter.java index 1541c43ae0a..40d4d6d72b2 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/model/IMemoryImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/model/IMemoryImporter.java @@ -20,10 +20,10 @@ 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_CUSTOM_START_ADDRESS = "CustomStartAddress"; - public static final String TRANSFER_SCROLL_TO_START = "ScrollToStart"; + public static final String TRANSFER_FILE = "File"; //$NON-NLS-1$ + public static final String TRANSFER_START = "Start"; //$NON-NLS-1$ + public static final String TRANSFER_CUSTOM_START_ADDRESS = "CustomStartAddress"; //$NON-NLS-1$ + public static final String TRANSFER_SCROLL_TO_START = "ScrollToStart"; //$NON-NLS-1$ /** * @param parent