1
/*******************************************************************************
2
* Copyright (c) 2010 Ericsson
4
* All rights reserved. This program and the accompanying materials are
5
* made available under the terms of the Eclipse Public License v1.0 which
6
* accompanies this distribution, and is available at
7
* http://www.eclipse.org/legal/epl-v10.html
10
* Patrick Tasse - Initial API and implementation
11
*******************************************************************************/
13
package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;
15
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
16
import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
17
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
18
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
19
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
21
public class CustomXmlEvent extends CustomEvent {
23
public CustomXmlEvent(CustomXmlTraceDefinition definition) {
25
setType(new CustomXmlEventType(definition));
28
public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfEvent other) {
29
super(definition, other);
32
public CustomXmlEvent(CustomXmlTraceDefinition definition, ITmfTrace<?> parentTrace, ITmfTimestamp timestamp, String source, TmfEventType type, String reference) {
33
super(definition, parentTrace, timestamp, source, type, reference);
37
public void setContent(ITmfEventField content) {
38
super.setContent(content);
41
public void parseInput(String value, String name, int inputAction, String inputFormat) {
42
if (value.length() == 0) {
45
if (inputAction == CustomTraceDefinition.ACTION_SET) {
46
fData.put(name, value);
47
if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
48
fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);
50
} else if (inputAction == CustomTraceDefinition.ACTION_APPEND) {
51
String s = fData.get(name);
53
fData.put(name, s + value);
55
fData.put(name, value);
57
if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
58
String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);
59
if (timeStampInputFormat != null) {
60
fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + inputFormat);
62
fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);
65
} else if (inputAction == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {
66
String s = fData.get(name);
68
fData.put(name, s + " | " + value); //$NON-NLS-1$
70
fData.put(name, value);
72
if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
73
String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);
74
if (timeStampInputFormat != null) {
75
fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + " | " + inputFormat); //$NON-NLS-1$
77
fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);
1
/*******************************************************************************
2
* Copyright (c) 2010 Ericsson
4
* All rights reserved. This program and the accompanying materials are
5
* made available under the terms of the Eclipse Public License v1.0 which
6
* accompanies this distribution, and is available at
7
* http://www.eclipse.org/legal/epl-v10.html
10
* Patrick Tasse - Initial API and implementation
11
*******************************************************************************/
13
package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;
15
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
16
import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
17
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
18
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
19
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
21
public class CustomXmlEvent extends CustomEvent {
23
public CustomXmlEvent(CustomXmlTraceDefinition definition) {
25
setType(new CustomXmlEventType(definition));
28
public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfEvent other) {
29
super(definition, other);
32
public CustomXmlEvent(CustomXmlTraceDefinition definition, ITmfTrace<?> parentTrace, ITmfTimestamp timestamp, String source, TmfEventType type, String reference) {
33
super(definition, parentTrace, timestamp, source, type, reference);
37
public void setContent(ITmfEventField content) {
38
super.setContent(content);
41
public void parseInput(String value, String name, int inputAction, String inputFormat) {
42
if (value.length() == 0) {
45
if (inputAction == CustomTraceDefinition.ACTION_SET) {
46
fData.put(name, value);
47
if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
48
fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);
50
} else if (inputAction == CustomTraceDefinition.ACTION_APPEND) {
51
String s = fData.get(name);
53
fData.put(name, s + value);
55
fData.put(name, value);
57
if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
58
String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);
59
if (timeStampInputFormat != null) {
60
fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + inputFormat);
62
fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);
65
} else if (inputAction == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {
66
String s = fData.get(name);
68
fData.put(name, s + " | " + value); //$NON-NLS-1$
70
fData.put(name, value);
72
if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
73
String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);
74
if (timeStampInputFormat != null) {
75
fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + " | " + inputFormat); //$NON-NLS-1$
77
fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);