2010-11-09 Francois Chouinard <fchouinard@gmail.com> Contribution for Bug315307
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / parsers / custom / CustomXmlEvent.java
CommitLineData
c3c5c786
FC
1/*******************************************************************************\r
2 * Copyright (c) 2010 Ericsson\r
3 * \r
4 * All rights reserved. This program and the accompanying materials are\r
5 * made available under the terms of the Eclipse Public License v1.0 which\r
6 * accompanies this distribution, and is available at\r
7 * http://www.eclipse.org/legal/epl-v10.html\r
8 * \r
9 * Contributors:\r
10 * Patrick Tasse - Initial API and implementation\r
11 *******************************************************************************/\r
12\r
13package org.eclipse.linuxtools.tmf.ui.parsers.custom;\r
14\r
15import org.eclipse.linuxtools.tmf.event.TmfEvent;\r
16import org.eclipse.linuxtools.tmf.event.TmfEventReference;\r
17import org.eclipse.linuxtools.tmf.event.TmfEventSource;\r
18import org.eclipse.linuxtools.tmf.event.TmfEventType;\r
19import org.eclipse.linuxtools.tmf.event.TmfTimestamp;\r
20\r
21public class CustomXmlEvent extends CustomEvent {\r
22\r
23 public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfEvent other) {\r
24 super(definition, other);\r
25 }\r
26\r
27 public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfTimestamp timestamp, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r
28 super(definition, timestamp, source, type, reference);\r
29 }\r
30\r
31 public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfTimestamp originalTS, TmfTimestamp effectiveTS, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r
32 super(definition, originalTS, effectiveTS, source, type, reference);\r
33 }\r
34\r
35 public void parseInput(String value, String name, int inputAction, String inputFormat) {\r
36 if (value.length() == 0) {\r
37 return;\r
38 }\r
39 if (inputAction == CustomTraceDefinition.ACTION_SET) {\r
40 fData.put(name, value);\r
41 if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
42 fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);\r
43 }\r
44 } else if (inputAction == CustomTraceDefinition.ACTION_APPEND) {\r
45 String s = fData.get(name);\r
46 if (s != null) {\r
47 fData.put(name, s + value);\r
48 } else {\r
49 fData.put(name, value);\r
50 }\r
51 if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
52 String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);\r
53 if (timeStampInputFormat != null) {\r
54 fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + inputFormat);\r
55 } else {\r
56 fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);\r
57 }\r
58 }\r
59 } else if (inputAction == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r
60 String s = fData.get(name);\r
61 if (s != null) {\r
3b38ea61 62 fData.put(name, s + " | " + value); //$NON-NLS-1$\r
c3c5c786
FC
63 } else {\r
64 fData.put(name, value);\r
65 }\r
66 if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r
67 String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);\r
68 if (timeStampInputFormat != null) {\r
3b38ea61 69 fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + " | " + inputFormat); //$NON-NLS-1$\r
c3c5c786
FC
70 } else {\r
71 fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);\r
72 }\r
73 }\r
74 }\r
75 }\r
76\r
77}\r
This page took 0.027242 seconds and 5 git commands to generate.