From 89151d6a8ac768728abb3d03b100c021dc9d7d94 Mon Sep 17 00:00:00 2001 From: Patrick Tasse Date: Mon, 8 Sep 2014 13:51:08 -0400 Subject: [PATCH] tmf: Fix some NLS Message strings Change-Id: I41b3e8ce64b9fca5150681f487786826a2ce968c Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/33062 Reviewed-by: Matthew Khouzam Tested-by: Hudson CI --- .../linuxtools/internal/tmf/ui/Messages.java | 28 +++----- .../tmf/ui/commands/ExportToTextJob.java | 3 +- .../ui/dialogs/ManageCustomParsersDialog.java | 4 +- .../internal/tmf/ui/messages.properties | 58 +++++++-------- .../CustomTxtParserInputWizardPage.java | 11 +-- .../CustomXmlParserInputWizardPage.java | 72 +++++++++---------- 6 files changed, 80 insertions(+), 96 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java index 75a09febec..56d02a551f 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/Messages.java @@ -32,10 +32,7 @@ public class Messages extends NLS { public static String ManageCustomParsersDialog_ImportButtonLabel; public static String ManageCustomParsersDialog_ImportParserSelection; public static String ManageCustomParsersDialog_NewButtonLabel; - public static String ManageCustomParsersDialog_ParseButtonLabel; - public static String ManageCustomParsersDialog_ParseError; public static String ManageCustomParsersDialog_TextButtonLabel; - public static String ManageCustomParsersDialog_TraceSelection; public static String TmfEventsTable_AddBookmarkActionText; public static String TmfEventsTable_AddBookmarkDialogMessage; @@ -148,7 +145,6 @@ public class Messages extends NLS { public static String CustomTxtParserInputWizardPage_group; public static String CustomTxtParserInputWizardPage_highlightAll; public static String CustomTxtParserInputWizardPage_logType; - public static String CustomTxtParserInputWizardPage_matchingLineRoot; public static String CustomTxtParserInputWizardPage_matchingOtherLine; public static String CustomTxtParserInputWizardPage_matchingRootLine; public static String CustomTxtParserInputWizardPage_max; @@ -190,20 +186,18 @@ public class Messages extends NLS { public static String CustomXmlParserInputWizardPage_noDocumentError; public static String CustomXmlParserInputWizardPage_missingLogEntryError; public static String CustomXmlParserInputWizardPage_missingTimestampFmtError; - public static String CustomXmlParserInputWizardPage_invalidTimestampFmtError; - public static String CustomXmlParserInputWizardPage_notimestamporAttributeError; public static String CustomXmlParserInputWizardPage_missingDocumentElementError; - public static String CustomXmlParserInputWizardPage_timestampFormatPrompt; - public static String CustomXmlParserInputWizardPage_timestampElementPrompt; - public static String CustomXmlParserInputWizardPage_missingInputElementNameError; - public static String CustomXmlParserInputWizardPage_attributePrompt; - public static String CustomXmlParserInputWizardPage_missingAttribute; - public static String CustomXmlParserInputWizardPage_duplicateAttributeError; - public static String CustomXmlParserInputWizardPage_missingTimestampInFmtError; - public static String CustomXmlParserInputWizardPage_invalidTimestampInFmtError; - public static String CustomXmlParserInputWizardPage_missingDataGroupNameError; - public static String CustomXmlParserInputWizardPage_missingElementNameError; - public static String CustomXmlParserInputWizardPage_duplicateElementNameError; + public static String CustomXmlParserInputWizardPage_noTimestampElementOrAttribute; + public static String CustomXmlParserInputWizardPage_elementMissingNameError; + public static String CustomXmlParserInputWizardPage_elementMissingInputNameError; + public static String CustomXmlParserInputWizardPage_elementMissingTimestampFmtError; + public static String CustomXmlParserInputWizardPage_elementInvalidTimestampFmtError; + public static String CustomXmlParserInputWizardPage_elementDuplicateNameError; + public static String CustomXmlParserInputWizardPage_attributeMissingNameError; + public static String CustomXmlParserInputWizardPage_attributeMissingInputNameError; + public static String CustomXmlParserInputWizardPage_attributeMissingTimestampFmtError; + public static String CustomXmlParserInputWizardPage_attributeInvalidTimestampFmtError; + public static String CustomXmlParserInputWizardPage_attributeDuplicateNameError; public static String CustomXmlParserInputWizardPage_addAttribute; public static String CustomXmlParserInputWizardPage_addChildElement; public static String CustomXmlParserInputWizardPage_addDocumentEleemnt; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/commands/ExportToTextJob.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/commands/ExportToTextJob.java index a3672a2a58..6a4979d3a4 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/commands/ExportToTextJob.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/commands/ExportToTextJob.java @@ -27,6 +27,7 @@ import org.eclipse.linuxtools.internal.tmf.ui.Messages; import org.eclipse.linuxtools.tmf.core.filter.ITmfFilter; import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable; +import org.eclipse.osgi.util.NLS; /** * This job exports traces to text files. @@ -71,7 +72,7 @@ public class ExportToTextJob extends Job { @Override public IStatus run(IProgressMonitor monitor) { - monitor.beginTask(Messages.ExportToTextJob_Export_trace_to + destination, TOTAL_WORK); + monitor.beginTask(NLS.bind(Messages.ExportToTextJob_Export_trace_to, destination), TOTAL_WORK); IStatus ret = saveImpl(monitor); monitor.done(); return ret; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/dialogs/ManageCustomParsersDialog.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/dialogs/ManageCustomParsersDialog.java index 367f4865cc..459a66016c 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/dialogs/ManageCustomParsersDialog.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/dialogs/ManageCustomParsersDialog.java @@ -212,7 +212,7 @@ public class ManageCustomParsersDialog extends Dialog { boolean confirm = MessageDialog.openQuestion( getShell(), Messages.ManageCustomParsersDialog_DeleteParserDialogHeader, - Messages.ManageCustomParsersDialog_DeleteConfirmation + parserList.getSelection()[0] + "?"); //$NON-NLS-1$ + NLS.bind(Messages.ManageCustomParsersDialog_DeleteConfirmation, parserList.getSelection()[0])); if (confirm) { String selection = parserList.getSelection()[0]; String category = selection.substring(0, selection.indexOf(SEP)); @@ -273,7 +273,7 @@ public class ManageCustomParsersDialog extends Dialog { @Override public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE); - dialog.setText(Messages.ManageCustomParsersDialog_ExportParserSelection + parserList.getSelection()[0]); + dialog.setText(NLS.bind(Messages.ManageCustomParsersDialog_ExportParserSelection, parserList.getSelection()[0])); dialog.setFilterExtensions(new String[] { "*.xml", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ String path = dialog.open(); if (path != null) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties index 112e3cf04b..3d021c1336 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/messages.properties @@ -15,19 +15,16 @@ ManageCustomParsersDialog_ConflictMessage=Trace type ''{0} : {1}'' already exist ManageCustomParsersDialog_ConflictRenameButtonLabel=Rename ManageCustomParsersDialog_ConflictSkipButtonLabel=Skip ManageCustomParsersDialog_DeleteButtonLabel=Delete -ManageCustomParsersDialog_DeleteConfirmation=Are you sure you want to delete +ManageCustomParsersDialog_DeleteConfirmation=Are you sure you want to delete {0}? ManageCustomParsersDialog_DeleteParserDialogHeader=Delete Custom Parser ManageCustomParsersDialog_DialogHeader=Manage Custom Parsers ManageCustomParsersDialog_EditButtonLabel=Edit... ManageCustomParsersDialog_ExportButtonLabel=Export... -ManageCustomParsersDialog_ExportParserSelection=Select file to export +ManageCustomParsersDialog_ExportParserSelection=Select file to export {0} ManageCustomParsersDialog_ImportButtonLabel=Import... ManageCustomParsersDialog_ImportParserSelection=Select custom parser file to import ManageCustomParsersDialog_NewButtonLabel=New... -ManageCustomParsersDialog_ParseButtonLabel=Parse... -ManageCustomParsersDialog_ParseError=Parse Error ManageCustomParsersDialog_TextButtonLabel=Text -ManageCustomParsersDialog_TraceSelection=Select log file to parse using # org.eclipse.linuxtools.tmf.ui.viewers.events TmfEventsTable_AddBookmarkActionText=Add Bookmark... @@ -143,12 +140,11 @@ CustomTxtParserInputWizardPage_category=Category: CustomTxtParserInputWizardPage_desccriptionEdit=Edit an existing custom parser for text trace files CustomTxtParserInputWizardPage_descriptionNew=Create a new custom parser for text trace files CustomTxtParserInputWizardPage_format=format: -CustomTxtParserInputWizardPage_group=Group +CustomTxtParserInputWizardPage_group=Group {0}: CustomTxtParserInputWizardPage_highlightAll=Highlight All CustomTxtParserInputWizardPage_logType=Trace type: -CustomTxtParserInputWizardPage_matchingLineRoot=Matching root line : -CustomTxtParserInputWizardPage_matchingOtherLine=Matching other line: -CustomTxtParserInputWizardPage_matchingRootLine=matchingRootLine +CustomTxtParserInputWizardPage_matchingOtherLine=Matching other line: +CustomTxtParserInputWizardPage_matchingRootLine=Matching root line : CustomTxtParserInputWizardPage_max=max: CustomTxtParserInputWizardPage_min=min: CustomTxtParserInputWizardPage_moveDown=Move down @@ -180,28 +176,26 @@ CustomTxtParserOutputWizardPage_description=Customize the output of the parser CustomTxtParserOutputWizardPage_moveAfter=Move After CustomTxtParserOutputWizardPage_moveBefore=Move Before CustomTxtParserOutputWizardPage_visible=Visible -CustomXmlParserInputWizardPage_emptyCategoryError=Enter a category for the new trace type. -CustomXmlParserInputWizardPage_emptyLogTypeError=Enter a name for the new trace type. -CustomXmlParserInputWizardPage_invalidCategoryError=Invalid character ':' in category. -CustomXmlParserInputWizardPage_invalidLogTypeError=Invalid character ':' in trace type. -CustomXmlParserInputWizardPage_duplicatelogTypeError=The trace type name already exists. -CustomXmlParserInputWizardPage_noDocumentError=Add a document element. -CustomXmlParserInputWizardPage_missingLogEntryError=Identify a Log Entry element. -CustomXmlParserInputWizardPage_missingTimestampFmtError=Enter the output format for the Time Stamp field. -CustomXmlParserInputWizardPage_invalidTimestampFmtError=Enter a valid output format for the Time Stamp field. -CustomXmlParserInputWizardPage_notimestamporAttributeError=*no time stamp element or attribute* -CustomXmlParserInputWizardPage_missingDocumentElementError=Enter a name for the document element. -CustomXmlParserInputWizardPage_timestampElementPrompt=Element -CustomXmlParserInputWizardPage_timestampFormatPrompt=Enter the input format for the Time Stamp -CustomXmlParserInputWizardPage_missingInputElementNameError=Enter a name for the input -CustomXmlParserInputWizardPage_attributePrompt=Attribute -CustomXmlParserInputWizardPage_missingAttribute=Enter a name for the attribute -CustomXmlParserInputWizardPage_duplicateAttributeError=Duplicate attribute names -CustomXmlParserInputWizardPage_missingTimestampInFmtError=Enter the input format for the Time Stamp -CustomXmlParserInputWizardPage_invalidTimestampInFmtError=Enter a valid input format for the Time Stamp -CustomXmlParserInputWizardPage_missingDataGroupNameError=Enter a name for the data group -CustomXmlParserInputWizardPage_missingElementNameError=Enter a name for the element -CustomXmlParserInputWizardPage_duplicateElementNameError=Duplicate element names +CustomXmlParserInputWizardPage_emptyCategoryError=Enter a category for the new trace type. +CustomXmlParserInputWizardPage_emptyLogTypeError=Enter a name for the new trace type. +CustomXmlParserInputWizardPage_invalidCategoryError=Invalid character ':' in category. +CustomXmlParserInputWizardPage_invalidLogTypeError=Invalid character ':' in trace type. +CustomXmlParserInputWizardPage_duplicatelogTypeError=The trace type name already exists. +CustomXmlParserInputWizardPage_noDocumentError=Add a document element. +CustomXmlParserInputWizardPage_missingLogEntryError=Identify a Log Entry element. +CustomXmlParserInputWizardPage_missingTimestampFmtError=Enter the output format for the Time Stamp field. +CustomXmlParserInputWizardPage_missingDocumentElementError=Enter a name for the document element. +CustomXmlParserInputWizardPage_noTimestampElementOrAttribute=*no time stamp element or attribute* +CustomXmlParserInputWizardPage_elementMissingNameError=Enter a name for the element (Element {0}). +CustomXmlParserInputWizardPage_elementMissingInputNameError=Enter a name for the input (Element {0}). +CustomXmlParserInputWizardPage_elementMissingTimestampFmtError=Enter the input format for the Time Stamp (Element {0}). +CustomXmlParserInputWizardPage_elementInvalidTimestampFmtError=Enter a valid output format for the Time Stamp field (Element {0}). +CustomXmlParserInputWizardPage_elementDuplicateNameError=Duplicate element names (Element {0}). +CustomXmlParserInputWizardPage_attributeMissingNameError=Enter a name for the attribute (Attribute {0}: ?). +CustomXmlParserInputWizardPage_attributeMissingInputNameError=Enter a name for the input (Attribute {0}). +CustomXmlParserInputWizardPage_attributeMissingTimestampFmtError=Enter the input format for the Time Stamp (Attribute {0}). +CustomXmlParserInputWizardPage_attributeInvalidTimestampFmtError=Enter a valid input format for the Time Stamp (Attribute {0}). +CustomXmlParserInputWizardPage_attributeDuplicateNameError=Duplicate attribute names (Attribute {0}). CustomXmlParserInputWizardPage_addAttribute=Add attribute CustomXmlParserInputWizardPage_addChildElement=Add child element CustomXmlParserInputWizardPage_addDocumentEleemnt=Add document element @@ -291,5 +285,5 @@ CallStackView_ImportBinaryFileButtonTooltip=Import a binary file containing debu CallStackView_ImportBinaryFileDialogTitle=Select Binary File ExportToTextJob_Export_to=Export to {0}... -ExportToTextJob_Export_trace_to=Export trace to +ExportToTextJob_Export_trace_to=Export trace to {0} ExportToTextJob_Unable_to_export_trace=Unable to export trace to {0} diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java index f2de009962..0c205d562e 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java @@ -54,6 +54,7 @@ import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTxtTraceDefinition.I import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceType; import org.eclipse.linuxtools.tmf.core.project.model.TraceTypeHelper; import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.browser.TitleEvent; @@ -968,11 +969,11 @@ public class CustomTxtParserInputWizardPage extends WizardPage { int line1start = 0; String line1 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine; int line2start = line1start + line1.length(); - String line2 = Messages.CustomTxtParserInputWizardPage_matchingLineRoot + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$ + String line2 = Messages.CustomTxtParserInputWizardPage_matchingRootLine + ' ' + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$ int line3start = line2start + line2.length(); - String line3 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$ + String line3 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + ' ' + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$ int line4start = line3start + line3.length(); - String line4 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$ + String line4 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + ' ' + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$ int line5start = line4start + line4.length(); String line5 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine; int line6start = line5start + line5.length(); @@ -1382,7 +1383,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage { inputLabel = new Label(labelComposite, SWT.NULL); inputLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - inputLabel.setText(Messages.CustomTxtParserInputWizardPage_group + inputNumber + ":"); //$NON-NLS-1$ + inputLabel.setText(NLS.bind(Messages.CustomTxtParserInputWizardPage_group, inputNumber)); tagComposite = new Composite(parent, SWT.FILL); GridLayout tagLayout = new GridLayout(4, false); @@ -1470,7 +1471,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage { private void setInputNumber(int inputNumber) { this.inputNumber = inputNumber; - inputLabel.setText(Messages.CustomTxtParserInputWizardPage_group + inputNumber + ":"); //$NON-NLS-1$ + inputLabel.setText(NLS.bind(Messages.CustomTxtParserInputWizardPage_group, inputNumber)); labelComposite.layout(); } } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java index 2d09e10870..69e33ab022 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java @@ -53,6 +53,7 @@ import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomXmlTraceDefinition.I import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceType; import org.eclipse.linuxtools.tmf.core.project.model.TraceTypeHelper; import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.browser.TitleEvent; @@ -95,6 +96,8 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; +import com.google.common.base.Joiner; + /** * Input wizard page for custom XML trace parsers. * @@ -1493,23 +1496,23 @@ public class CustomXmlParserInputWizardPage extends WizardPage { treeViewer.refresh(); } - StringBuffer errors = new StringBuffer(); + List errors = new ArrayList<>(); if (definition.categoryName.length() == 0) { - errors.append(Messages.CustomXmlParserInputWizardPage_emptyCategoryError); + errors.add(Messages.CustomXmlParserInputWizardPage_emptyCategoryError); categoryText.setBackground(COLOR_LIGHT_RED); } else if (definition.definitionName.length() == 0) { - errors.append(Messages.CustomXmlParserInputWizardPage_emptyLogTypeError); + errors.add(Messages.CustomXmlParserInputWizardPage_emptyLogTypeError); logtypeText.setBackground(COLOR_LIGHT_RED); } else { categoryText.setBackground(COLOR_TEXT_BACKGROUND); logtypeText.setBackground(COLOR_TEXT_BACKGROUND); if (definition.categoryName.indexOf(':') != -1) { - errors.append(Messages.CustomXmlParserInputWizardPage_invalidCategoryError); + errors.add(Messages.CustomXmlParserInputWizardPage_invalidCategoryError); categoryText.setBackground(COLOR_LIGHT_RED); } if (definition.definitionName.indexOf(':') != -1) { - errors.append(Messages.CustomXmlParserInputWizardPage_invalidLogTypeError); + errors.add(Messages.CustomXmlParserInputWizardPage_invalidLogTypeError); logtypeText.setBackground(COLOR_LIGHT_RED); } for (TraceTypeHelper helper : TmfTraceType.getTraceTypeHelpers()) { @@ -1517,7 +1520,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage { definition.definitionName.equals(helper.getName()) && (editDefinitionName == null || !editDefinitionName.equals(definition.definitionName)) && (editCategoryName == null || !editCategoryName.equals(definition.categoryName))) { - errors.append(Messages.CustomXmlParserInputWizardPage_duplicatelogTypeError); + errors.add(Messages.CustomXmlParserInputWizardPage_duplicatelogTypeError); logtypeText.setBackground(COLOR_LIGHT_RED); break; } @@ -1525,48 +1528,48 @@ public class CustomXmlParserInputWizardPage extends WizardPage { } if (definition.rootInputElement == null) { - errors.append(Messages.CustomXmlParserInputWizardPage_noDocumentError); + errors.add(Messages.CustomXmlParserInputWizardPage_noDocumentError); } if (definition.rootInputElement != null) { logEntryFound = false; timeStampFound = false; - errors.append(validateElement(definition.rootInputElement)); + errors.addAll(validateElement(definition.rootInputElement)); if ((definition.rootInputElement.attributes != null && definition.rootInputElement.attributes.size() != 0) || (definition.rootInputElement.childElements != null && definition.rootInputElement.childElements.size() != 0) - || errors.length() == 0) { + || errors.size() == 0) { if (!logEntryFound) { - errors.append(Messages.CustomXmlParserInputWizardPage_missingLogEntryError); + errors.add(Messages.CustomXmlParserInputWizardPage_missingLogEntryError); } if (timeStampFound) { if (timeStampOutputFormatText.getText().trim().length() == 0) { - errors.append(Messages.CustomXmlParserInputWizardPage_missingTimestampFmtError); + errors.add(Messages.CustomXmlParserInputWizardPage_missingTimestampFmtError); timeStampOutputFormatText.setBackground(COLOR_LIGHT_RED); } else { try { new TmfTimestampFormat(timeStampOutputFormatText.getText().trim()); timeStampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND); } catch (IllegalArgumentException e) { - errors.append(Messages.CustomXmlParserInputWizardPage_invalidTimestampFmtError); + errors.add(Messages.CustomXmlParserInputWizardPage_elementInvalidTimestampFmtError); timeStampOutputFormatText.setBackground(COLOR_LIGHT_RED); } } } else { - timeStampPreviewText.setText(Messages.CustomXmlParserInputWizardPage_notimestamporAttributeError); + timeStampPreviewText.setText(Messages.CustomXmlParserInputWizardPage_noTimestampElementOrAttribute); } } } else { - timeStampPreviewText.setText(Messages.CustomXmlParserInputWizardPage_notimestamporAttributeError); + timeStampPreviewText.setText(Messages.CustomXmlParserInputWizardPage_noTimestampElementOrAttribute); } - if (errors.length() == 0) { + if (errors.size() == 0) { setDescription(defaultDescription); setPageComplete(true); } else { - setDescription(errors.toString()); + setDescription(Joiner.on(' ').join(errors)); setPageComplete(false); } } @@ -1578,15 +1581,15 @@ public class CustomXmlParserInputWizardPage extends WizardPage { * The element to clean up * @return The validated element */ - public StringBuffer validateElement(InputElement inputElement) { - StringBuffer errors = new StringBuffer(); + public List validateElement(InputElement inputElement) { + List errors = new ArrayList<>(); ElementNode elementNode = null; if (selectedElement != null && selectedElement.inputElement.equals(inputElement)) { elementNode = selectedElement; } if (inputElement == definition.rootInputElement) { if (inputElement.elementName.length() == 0) { - errors.append(Messages.CustomXmlParserInputWizardPage_missingDocumentElementError); + errors.add(Messages.CustomXmlParserInputWizardPage_missingDocumentElementError); if (elementNode != null) { elementNode.elementNameText.setBackground(COLOR_LIGHT_RED); } @@ -1603,8 +1606,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage { if (inputElement.inputName.equals(CustomTraceDefinition.TAG_TIMESTAMP)) { timeStampFound = true; if (inputElement.inputFormat.length() == 0) { - errors.append(Messages.CustomXmlParserInputWizardPage_timestampFormatPrompt - + " (" + Messages.CustomXmlParserInputWizardPage_timestampElementPrompt + " " + getName(inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_elementMissingTimestampFmtError, getName(inputElement))); if (elementNode != null) { elementNode.tagText.setBackground(COLOR_LIGHT_RED); } @@ -1615,15 +1617,14 @@ public class CustomXmlParserInputWizardPage extends WizardPage { elementNode.tagText.setBackground(COLOR_TEXT_BACKGROUND); } } catch (IllegalArgumentException e) { - errors.append(Messages.CustomXmlParserInputWizardPage_invalidTimestampFmtError - + " (" + Messages.CustomXmlParserInputWizardPage_timestampElementPrompt + " " + getName(inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_elementInvalidTimestampFmtError, getName(inputElement))); if (elementNode != null) { elementNode.tagText.setBackground(COLOR_LIGHT_RED); } } } } else if (inputElement.inputName.length() == 0) { - errors.append(Messages.CustomXmlParserInputWizardPage_missingInputElementNameError); + errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_elementMissingInputNameError, getName(inputElement))); if (elementNode != null) { elementNode.tagText.setBackground(COLOR_LIGHT_RED); } @@ -1652,14 +1653,12 @@ public class CustomXmlParserInputWizardPage extends WizardPage { } } if (attribute.attributeName.length() == 0) { - errors.append(Messages.CustomXmlParserInputWizardPage_missingAttribute - + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(inputElement) + ": ?). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_attributeMissingNameError, getName(inputElement))); if (elementNode != null) { elementNode.attributes.get(i).attributeNameText.setBackground(COLOR_LIGHT_RED); } } else if (duplicate) { - errors.append(Messages.CustomXmlParserInputWizardPage_duplicateAttributeError - + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_attributeDuplicateNameError, getName(attribute, inputElement))); if (elementNode != null) { elementNode.attributes.get(i).attributeNameText.setBackground(COLOR_LIGHT_RED); } @@ -1667,8 +1666,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage { if (attribute.inputName.equals(CustomTraceDefinition.TAG_TIMESTAMP)) { timeStampFound = true; if (attribute.inputFormat.length() == 0) { - errors.append(Messages.CustomXmlParserInputWizardPage_missingTimestampInFmtError - + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_attributeMissingTimestampFmtError, getName(attribute, inputElement))); if (elementNode != null) { elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED); } @@ -1679,16 +1677,14 @@ public class CustomXmlParserInputWizardPage extends WizardPage { elementNode.attributes.get(i).tagText.setBackground(COLOR_TEXT_BACKGROUND); } } catch (IllegalArgumentException e) { - errors.append(Messages.CustomXmlParserInputWizardPage_invalidTimestampInFmtError - + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_attributeInvalidTimestampFmtError, getName(attribute, inputElement))); if (elementNode != null) { elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED); } } } } else if (attribute.inputName.length() == 0) { - errors.append(Messages.CustomXmlParserInputWizardPage_missingDataGroupNameError - + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_attributeMissingInputNameError, getName(attribute, inputElement))); if (elementNode != null) { elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED); } @@ -1716,8 +1712,7 @@ public class CustomXmlParserInputWizardPage extends WizardPage { childElementNode = selectedElement; } if (child.elementName.length() == 0) { - errors.append(Messages.CustomXmlParserInputWizardPage_missingElementNameError - + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(child) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_elementMissingNameError, getName(child))); if (childElementNode != null) { childElementNode.elementNameText.setBackground(COLOR_LIGHT_RED); } @@ -1737,15 +1732,14 @@ public class CustomXmlParserInputWizardPage extends WizardPage { } } if (duplicate) { - errors.append(Messages.CustomXmlParserInputWizardPage_duplicateElementNameError - + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(child) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_elementDuplicateNameError, getName(child))); if (childElementNode != null) { childElementNode.elementNameText.setBackground(COLOR_LIGHT_RED); } } } - errors.append(validateElement(child)); + errors.addAll(validateElement(child)); } } return errors; -- 2.34.1