/*******************************************************************************
- * Copyright (c) 2010, 2014 Ericsson
+ * Copyright (c) 2010, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import java.io.InputStreamReader;
import java.net.URL;
import java.text.ParseException;
+import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map.Entry;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.ui.Messages;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.Tag;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlInputAttribute;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlInputElement;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlInputAttribute;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType;
import org.eclipse.tracecompass.tmf.core.project.model.TraceTypeHelper;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
private static final Color COLOR_LIGHT_RED = new Color(Display.getDefault(), 255, 192, 192);
private static final Color COLOR_TEXT_BACKGROUND = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
private static final Color COLOR_WIDGET_BACKGROUND = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
+ private static final Color COLOR_GRAY = Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
private final ISelection selection;
private CustomXmlTraceDefinition definition;
timeStampOutputFormatText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);
timeStampOutputFormatText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
timeStampOutputFormatText.setText(DEFAULT_TIMESTAMP_FORMAT);
+ timeStampOutputFormatText.addPaintListener(e -> {
+ if (!timeStampOutputFormatText.isFocusControl() && timeStampOutputFormatText.getText().trim().isEmpty()) {
+ e.gc.setForeground(COLOR_GRAY);
+ int borderWidth = timeStampOutputFormatText.getBorderWidth();
+ e.gc.drawText(Messages.CustomXmlParserInputWizardPage_default, borderWidth, borderWidth);
+ }
+ });
Button timeStampFormatHelpButton = new Button(headerComposite, SWT.PUSH);
timeStampFormatHelpButton.setImage(HELP_IMAGE);
SashForm vSash = new SashForm(container, SWT.VERTICAL);
vSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- vSash.setBackground(vSash.getDisplay().getSystemColor(SWT.COLOR_GRAY));
+ vSash.setBackground(COLOR_GRAY);
SashForm hSash = new SashForm(vSash, SWT.HORIZONTAL);
hSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
addChildButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- CustomXmlInputElement inputElement = new CustomXmlInputElement("", false, CustomXmlTraceDefinition.TAG_IGNORE, 0, "", null); //$NON-NLS-1$ //$NON-NLS-2$
+ CustomXmlInputElement inputElement = new CustomXmlInputElement("", false, Tag.IGNORE, Tag.IGNORE.toString(), 0, "", null); //$NON-NLS-1$ //$NON-NLS-2$
if (definition.rootInputElement == null) {
definition.rootInputElement = inputElement;
inputElement.setElementName(getChildNameSuggestion(null));
addNextButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- CustomXmlInputElement inputElement = new CustomXmlInputElement("", false, CustomXmlTraceDefinition.TAG_IGNORE, 0, "", null); //$NON-NLS-1$ //$NON-NLS-2$
+ CustomXmlInputElement inputElement = new CustomXmlInputElement("", false, Tag.IGNORE, Tag.IGNORE.toString(), 0, "", null); //$NON-NLS-1$ //$NON-NLS-2$
if (definition.rootInputElement == null) {
definition.rootInputElement = inputElement;
inputElement.setElementName(getChildNameSuggestion(null));
CustomXmlInputElement inputElement = null;
if (definition.rootInputElement == null) {
if (getChildNameSuggestion(null).length() != 0) {
- inputElement = new CustomXmlInputElement(getChildNameSuggestion(null), false, CustomXmlTraceDefinition.TAG_IGNORE, 0, "", null); //$NON-NLS-1$
+ inputElement = new CustomXmlInputElement(getChildNameSuggestion(null), false, Tag.IGNORE, Tag.IGNORE.toString(), 0, "", null); //$NON-NLS-1$
definition.rootInputElement = inputElement;
feelingLucky(inputElement);
} else {
if (attributeName.length() == 0) {
break;
}
- CustomXmlInputAttribute attribute = new CustomXmlInputAttribute(attributeName, attributeName, 0, ""); //$NON-NLS-1$
+ CustomXmlInputAttribute attribute = new CustomXmlInputAttribute(attributeName, Tag.OTHER, attributeName, 0, ""); //$NON-NLS-1$
inputElement.addAttribute(attribute);
}
while (true) {
if (childName.length() == 0) {
break;
}
- CustomXmlInputElement childElement = new CustomXmlInputElement(childName, false, CustomXmlTraceDefinition.TAG_IGNORE, 0, "", null); //$NON-NLS-1$
+ CustomXmlInputElement childElement = new CustomXmlInputElement(childName, false, Tag.IGNORE, Tag.IGNORE.toString(), 0, "", null); //$NON-NLS-1$
inputElement.addChild(childElement);
feelingLucky(childElement);
}
private void loadDefinition(CustomXmlTraceDefinition def) {
categoryText.setText(def.categoryName);
logtypeText.setText(def.definitionName);
- timeStampOutputFormatText.setText(def.timeStampOutputFormat);
+ if (def.timeStampOutputFormat != null) {
+ timeStampOutputFormatText.setText(def.timeStampOutputFormat);
+ } else {
+ timeStampOutputFormatText.setText(""); //$NON-NLS-1$
+ }
treeViewer.setInput(def);
if (def.rootInputElement != null) {
}
/**
- * Get the global list of input names.
+ * Get the global list of inputs.
*
- * @return The list of input names
+ * @return The list of inputs
*/
- public List<String> getInputNames() {
- return getInputNames(definition.rootInputElement);
+ public List<Entry<Tag, String>> getInputs() {
+ return getInputs(definition.rootInputElement);
}
/**
- * Get the list of input names for a given element.
+ * Get the list of inputs for a given element, recursively.
*
* @param inputElement
* The element
- * @return The input names for this element
+ * @return The list of inputs
*/
- public List<String> getInputNames(CustomXmlInputElement inputElement) {
- List<String> inputs = new ArrayList<>();
- if (inputElement.getInputName() != null && !inputElement.getInputName().equals(CustomXmlTraceDefinition.TAG_IGNORE)) {
- String inputName = inputElement.getInputName();
- if (!inputs.contains(inputName)) {
- inputs.add(inputName);
+ public List<Entry<Tag, String>> getInputs(CustomXmlInputElement inputElement) {
+ List<Entry<Tag, String>> inputs = new ArrayList<>();
+ if (inputElement.getInputTag() != null && !inputElement.getInputTag().equals(Tag.IGNORE)) {
+ Entry<Tag, String> input = new SimpleEntry<>(inputElement.getInputTag(), inputElement.getInputName());
+ if (!inputs.contains(input)) {
+ inputs.add(input);
}
}
if (inputElement.getAttributes() != null) {
for (CustomXmlInputAttribute attribute : inputElement.getAttributes()) {
- String inputName = attribute.getInputName();
- if (!inputs.contains(inputName)) {
- inputs.add(inputName);
+ Entry<Tag, String> input = new SimpleEntry<>(attribute.getInputTag(), attribute.getInputName());
+ if (!inputs.contains(input)) {
+ inputs.add(input);
}
}
}
if (inputElement.getChildElements() != null) {
for (CustomXmlInputElement childInputElement : inputElement.getChildElements()) {
- for (String inputName : getInputNames(childInputElement)) {
- if (!inputs.contains(inputName)) {
- inputs.add(inputName);
+ for (Entry<Tag, String> input : getInputs(childInputElement)) {
+ if (!inputs.contains(input)) {
+ inputs.add(input);
}
}
}
try {
TmfTimestampFormat timestampFormat = new TmfTimestampFormat(timeStampFormat);
long timestamp = timestampFormat.parseValue(timeStampValue);
- timestampFormat = new TmfTimestampFormat(timeStampOutputFormatText.getText().trim());
+ if (timeStampOutputFormatText.getText().trim().isEmpty()) {
+ timestampFormat = new TmfTimestampFormat();
+ } else {
+ timestampFormat = new TmfTimestampFormat(timeStampOutputFormatText.getText().trim());
+ }
timeStampPreviewText.setText(timestampFormat.format(timestamp));
} catch (ParseException e) {
timeStampPreviewText.setText("*parse exception* [" + timeStampValue + "] <> [" + timeStampFormat + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
private Label previewLabel;
private Text previewText;
private Button logEntryButton;
+ private Button eventTypeButton;
+ private Text eventTypeText;
private Label fillerLabel;
private Composite addAttributeComposite;
private Button addAttributeButton;
tagComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
tagCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
- tagCombo.setItems(new String[] { CustomXmlTraceDefinition.TAG_IGNORE, CustomTraceDefinition.TAG_TIMESTAMP,
- CustomTraceDefinition.TAG_MESSAGE, CustomTraceDefinition.TAG_OTHER });
+ tagCombo.setItems(new String[] {
+ Tag.IGNORE.toString(),
+ Tag.TIMESTAMP.toString(),
+ Tag.EVENT_TYPE.toString(),
+ Tag.MESSAGE.toString(),
+ Tag.EXTRA_FIELD_NAME.toString(),
+ Tag.EXTRA_FIELD_VALUE.toString(),
+ Tag.OTHER.toString() });
tagCombo.setVisibleItemCount(tagCombo.getItemCount());
tagCombo.addSelectionListener(new SelectionListener() {
@Override
tagText.addModifyListener(updateListener);
actionCombo.setVisible(true);
break;
- case 2: // Message
+ case 2: // Event type
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(true);
+ break;
+ case 3: // Message
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(true);
+ break;
+ case 4: // Field names
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(false);
+ break;
+ case 5: // Field values
tagLabel.setVisible(false);
tagText.setVisible(false);
actionCombo.setVisible(true);
break;
- case 3: // Other
- tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);
+ case 6: // Other
+ tagLabel.setText(Messages.CustomXmlParserInputWizardPage_name);
tagLabel.setVisible(true);
if (tagText.getText().trim().length() == 0) {
tagText.setText(elementNameText.getText().trim());
actionCombo.select(inputElement.getInputAction());
actionCombo.addSelectionListener(updateListener);
- if (inputElement.getInputName().equals(CustomXmlTraceDefinition.TAG_IGNORE)) {
+ if (inputElement.getInputTag().equals(Tag.IGNORE)) {
tagCombo.select(0);
tagLabel.setVisible(false);
tagText.setVisible(false);
actionCombo.setVisible(false);
- } else if (inputElement.getInputName().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+ } else if (inputElement.getInputTag().equals(Tag.TIMESTAMP)) {
tagCombo.select(1);
tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);
tagText.setText(inputElement.getInputFormat());
tagText.addModifyListener(updateListener);
- } else if (inputElement.getInputName().equals(CustomTraceDefinition.TAG_MESSAGE)) {
+ actionCombo.setVisible(true);
+ } else if (inputElement.getInputTag().equals(Tag.EVENT_TYPE)) {
tagCombo.select(2);
tagLabel.setVisible(false);
tagText.setVisible(false);
- } else {
+ actionCombo.setVisible(true);
+ } else if (inputElement.getInputTag().equals(Tag.MESSAGE)) {
tagCombo.select(3);
- tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(true);
+ } else if (inputElement.getInputTag().equals(Tag.EXTRA_FIELD_NAME)) {
+ tagCombo.select(4);
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(false);
+ } else if (inputElement.getInputTag().equals(Tag.EXTRA_FIELD_VALUE)) {
+ tagCombo.select(5);
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(true);
+ } else {
+ tagCombo.select(6);
+ tagLabel.setText(Messages.CustomXmlParserInputWizardPage_name);
tagText.setText(inputElement.getInputName());
tagText.addModifyListener(updateListener);
+ actionCombo.setVisible(true);
}
+
+ eventTypeButton = new Button(group, SWT.CHECK);
+ eventTypeButton.setText(Messages.CustomTxtParserInputWizardPage_eventType);
+ eventTypeButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
+ eventTypeButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (eventTypeButton.getSelection()) {
+ eventTypeText.setEnabled(true);
+ } else {
+ eventTypeText.setEnabled(false);
+ }
+ }
+ });
+ eventTypeButton.addSelectionListener(updateListener);
+
+ eventTypeText = new Text(group, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gd.widthHint = 0;
+ eventTypeText.setLayoutData(gd);
+ if (inputElement.getEventType() != null) {
+ eventTypeText.setText(inputElement.getEventType());
+ eventTypeButton.setSelection(true);
+ } else {
+ eventTypeText.setEnabled(false);
+ eventTypeButton.setSelection(false);
+ }
+ eventTypeText.addModifyListener(updateListener);
}
if (inputElement.getAttributes() != null) {
private void updatePreview() {
Element element = getPreviewElement(inputElement);
- if (inputElement.getParentElement() != null) { // no preview text for
- // document element
+ // no preview text for document element
+ if (inputElement.getParentElement() != null) {
previewText.setText(Messages.CustomXmlParserInputWizardPage_noMatchingElement);
if (element != null) {
previewText.setText(CustomXmlTrace.parseElement(element, new StringBuffer()).toString());
logEntryFound = true;
logEntriesCount++;
} else {
- logEntryButton.setSelection(false); // remove nested
- // log entry
+ // remove nested log entry
+ logEntryButton.setSelection(false);
}
}
- if (tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP) && logEntriesCount <= 1) {
+ if (tagCombo.getText().equals(Tag.TIMESTAMP.toString()) && logEntriesCount <= 1) {
String value = previewText.getText().trim();
if (value.length() != 0) {
if (actionCombo.getSelectionIndex() == CustomTraceDefinition.ACTION_SET) {
}
} else if (actionCombo.getSelectionIndex() == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {
if (timeStampValue != null) {
- timeStampValue += " | " + value; //$NON-NLS-1$
- timeStampFormat += " | " + tagText.getText().trim(); //$NON-NLS-1$
+ timeStampValue += CustomTraceDefinition.SEPARATOR + value;
+ timeStampFormat += CustomTraceDefinition.SEPARATOR + tagText.getText().trim();
} else {
timeStampValue = value;
timeStampFormat = tagText.getText().trim();
String value = element.getAttribute(attribute.attributeNameText.getText().trim());
if (value.length() != 0) {
attribute.previewText.setText(value);
- if (attribute.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP) && logEntriesCount <= 1) {
+ if (attribute.tagCombo.getText().equals(Tag.TIMESTAMP.toString()) && logEntriesCount <= 1) {
if (attribute.actionCombo.getSelectionIndex() == CustomTraceDefinition.ACTION_SET) {
timeStampValue = value;
timeStampFormat = attribute.tagText.getText().trim();
public void widgetSelected(SelectionEvent e) {
removeAddButton();
String attributeName = getAttributeNameSuggestion(inputElement);
- CustomXmlInputAttribute inputAttribute = new CustomXmlInputAttribute(attributeName, attributeName, 0, ""); //$NON-NLS-1$
+ CustomXmlInputAttribute inputAttribute = new CustomXmlInputAttribute(attributeName, Tag.OTHER, attributeName, 0, ""); //$NON-NLS-1$
attributes.add(new Attribute(group, ElementNode.this, inputAttribute, attributes.size() + 1));
createAddButton();
elementContainer.layout();
inputElement.setElementName(elementNameText.getText().trim());
if (inputElement.getParentElement() != null) {
inputElement.setLogEntry(logEntryButton.getSelection());
- if (tagCombo.getText().equals(CustomTraceDefinition.TAG_OTHER)) {
+ inputElement.setEventType(eventTypeButton.getSelection() ? eventTypeText.getText().trim() : null);
+ Tag inputTag = Tag.fromLabel(tagCombo.getText());
+ inputElement.setInputTag(inputTag);
+ if (inputTag.equals(Tag.OTHER)) {
inputElement.setInputName(tagText.getText().trim());
} else {
- inputElement.setInputName(tagCombo.getText());
- if (tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+ inputElement.setInputName(inputTag.toString());
+ if (inputTag.equals(Tag.TIMESTAMP)) {
inputElement.setInputFormat(tagText.getText().trim());
}
}
String inputFormat = null;
Attribute attribute = attributes.get(i);
String attributeName = attribute.attributeNameText.getText().trim();
- if (attribute.tagCombo.getText().equals(CustomTraceDefinition.TAG_OTHER)) {
+ Tag inputTag = Tag.fromLabel(attribute.tagCombo.getText());
+ if (inputTag.equals(Tag.OTHER)) {
inputName = attribute.tagText.getText().trim();
} else {
- inputName = attribute.tagCombo.getText();
- if (attribute.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+ inputName = inputTag.toString();
+ if (inputTag.equals(Tag.TIMESTAMP)) {
inputFormat = attribute.tagText.getText().trim();
}
}
int inputAction = attribute.actionCombo.getSelectionIndex();
- inputElement.addAttribute(new CustomXmlInputAttribute(attributeName, inputName, inputAction, inputFormat));
+ inputElement.addAttribute(new CustomXmlInputAttribute(attributeName, inputTag, inputName, inputAction, inputFormat));
}
}
}
tagComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
tagCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
- tagCombo.setItems(new String[] { CustomTraceDefinition.TAG_TIMESTAMP, CustomTraceDefinition.TAG_MESSAGE,
- CustomTraceDefinition.TAG_OTHER });
- tagCombo.select(2); // Other
+ tagCombo.setItems(new String[] {
+ Tag.TIMESTAMP.toString(),
+ Tag.EVENT_TYPE.toString(),
+ Tag.MESSAGE.toString(),
+ Tag.EXTRA_FIELD_NAME.toString(),
+ Tag.EXTRA_FIELD_VALUE.toString(),
+ Tag.OTHER.toString() });
+ tagCombo.select(3); // Other
tagCombo.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
tagLabel.setVisible(true);
tagText.setVisible(true);
tagText.addModifyListener(updateListener);
+ actionCombo.setVisible(true);
+ break;
+ case 1: // Event type
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(true);
+ break;
+ case 2: // Message
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(true);
+ break;
+ case 3: // Field names
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(false);
break;
- case 1: // Message
+ case 4: // Field values
tagLabel.setVisible(false);
tagText.setVisible(false);
+ actionCombo.setVisible(true);
break;
- case 2: // Other
- tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);
+ case 5: // Other
+ tagLabel.setText(Messages.CustomXmlParserInputWizardPage_name);
tagLabel.setVisible(true);
if (tagText.getText().trim().length() == 0) {
tagText.setText(attributeNameText.getText().trim());
}
tagText.setVisible(true);
tagText.addModifyListener(updateListener);
+ actionCombo.setVisible(true);
break;
default:
break;
actionCombo.select(inputAttribute.getInputAction());
actionCombo.addSelectionListener(updateListener);
- if (inputAttribute.getInputName().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+ if (inputAttribute.getInputTag().equals(Tag.TIMESTAMP)) {
tagCombo.select(0);
tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);
tagText.setText(inputAttribute.getInputFormat());
tagText.addModifyListener(updateListener);
- } else if (inputAttribute.getInputName().equals(CustomTraceDefinition.TAG_MESSAGE)) {
+ actionCombo.setVisible(true);
+ } else if (inputAttribute.getInputTag().equals(Tag.EVENT_TYPE)) {
tagCombo.select(1);
tagLabel.setVisible(false);
tagText.setVisible(false);
- } else {
+ actionCombo.setVisible(true);
+ } else if (inputAttribute.getInputTag().equals(Tag.MESSAGE)) {
tagCombo.select(2);
- tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(true);
+ } else if (inputAttribute.getInputTag().equals(Tag.EXTRA_FIELD_NAME)) {
+ tagCombo.select(3);
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(false);
+ } else if (inputAttribute.getInputTag().equals(Tag.EXTRA_FIELD_VALUE)) {
+ tagCombo.select(4);
+ tagLabel.setVisible(false);
+ tagText.setVisible(false);
+ actionCombo.setVisible(true);
+ } else {
+ tagCombo.select(5);
+ tagLabel.setText(Messages.CustomXmlParserInputWizardPage_name);
tagText.setText(inputAttribute.getInputName());
tagText.addModifyListener(updateListener);
+ actionCombo.setVisible(true);
}
}
errors.add(Messages.CustomXmlParserInputWizardPage_missingLogEntryError);
}
- if (timeStampFound) {
- if (timeStampOutputFormatText.getText().trim().length() == 0) {
- errors.add(Messages.CustomXmlParserInputWizardPage_missingTimestampFmtError);
+ if (timeStampFound && !definition.timeStampOutputFormat.isEmpty()) {
+ try {
+ new TmfTimestampFormat(timeStampOutputFormatText.getText().trim());
+ timeStampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
+ } catch (IllegalArgumentException e) {
+ errors.add(Messages.CustomXmlParserInputWizardPage_elementInvalidTimestampFmtError);
timeStampOutputFormatText.setBackground(COLOR_LIGHT_RED);
- } else {
- try {
- new TmfTimestampFormat(timeStampOutputFormatText.getText().trim());
- timeStampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
- } catch (IllegalArgumentException e) {
- errors.add(Messages.CustomXmlParserInputWizardPage_elementInvalidTimestampFmtError);
- timeStampOutputFormatText.setBackground(COLOR_LIGHT_RED);
- }
}
} else {
- timeStampPreviewText.setText(Messages.CustomXmlParserInputWizardPage_noTimestampElementOrAttribute);
+ timeStampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
+ if (!timeStampFound) {
+ timeStampPreviewText.setText(Messages.CustomXmlParserInputWizardPage_noTimestampElementOrAttribute);
+ }
}
}
} else {
if (inputElement.isLogEntry()) {
logEntryFound = true;
}
- if (inputElement.getInputName().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+ if (inputElement.getInputTag().equals(Tag.TIMESTAMP)) {
timeStampFound = true;
if (inputElement.getInputFormat().length() == 0) {
errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_elementMissingTimestampFmtError, getName(inputElement)));
if (elementNode != null) {
elementNode.tagText.setBackground(COLOR_LIGHT_RED);
}
+ } else if (inputElement.getInputTag().equals(Tag.OTHER) && Tag.fromLabel(inputElement.getInputName()) != null) {
+ errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_elementReservedInputNameError, getName(inputElement)));
+ if (elementNode != null) {
+ elementNode.tagText.setBackground(COLOR_LIGHT_RED);
+ }
} else {
if (elementNode != null) {
elementNode.tagText.setBackground(COLOR_TEXT_BACKGROUND);
}
}
+ if (inputElement.getEventType() != null && inputElement.getEventType().trim().isEmpty()) {
+ errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_emptyEventTypeError, getName(inputElement)));
+ if (elementNode != null) {
+ elementNode.eventTypeText.setBackground(COLOR_LIGHT_RED);
+ }
+ } else {
+ if (elementNode != null) {
+ elementNode.eventTypeText.setBackground(COLOR_TEXT_BACKGROUND);
+ }
+ }
}
if (inputElement.getAttributes() != null) {
if (elementNode != null) {
elementNode.attributes.get(i).attributeNameText.setBackground(COLOR_LIGHT_RED);
}
}
- if (attribute.getInputName().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+ if (attribute.getInputTag().equals(Tag.TIMESTAMP)) {
timeStampFound = true;
if (attribute.getInputFormat().length() == 0) {
errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_attributeMissingTimestampFmtError, getName(attribute, inputElement)));
if (elementNode != null) {
elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED);
}
+ } else if (attribute.getInputTag().equals(Tag.OTHER) && Tag.fromLabel(attribute.getInputName()) != null) {
+ errors.add(NLS.bind(Messages.CustomXmlParserInputWizardPage_attributeReservedInputNameError, getName(attribute, inputElement)));
+ if (elementNode != null) {
+ elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED);
+ }
} else {
if (elementNode != null) {
elementNode.attributes.get(i).tagText.setBackground(COLOR_TEXT_BACKGROUND);