Commit | Line | Data |
---|---|---|
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 | |
13 | package org.eclipse.linuxtools.tmf.ui.parsers.custom;\r | |
14 | \r | |
6c13869b FC |
15 | import org.eclipse.linuxtools.tmf.core.event.TmfEvent;\r |
16 | import org.eclipse.linuxtools.tmf.core.event.TmfEventReference;\r | |
17 | import org.eclipse.linuxtools.tmf.core.event.TmfEventSource;\r | |
18 | import org.eclipse.linuxtools.tmf.core.event.TmfEventType;\r | |
19 | import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;\r | |
20 | import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;\r | |
c3c5c786 FC |
21 | \r |
22 | public class CustomXmlEvent extends CustomEvent {\r | |
23 | \r | |
4bf17f4a | 24 | public CustomXmlEvent(CustomXmlTraceDefinition definition) {\r |
25 | super(definition);\r | |
26 | fType = new CustomXmlEventType(definition);\r | |
27 | }\r | |
28 | \r | |
c3c5c786 FC |
29 | public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfEvent other) {\r |
30 | super(definition, other);\r | |
31 | }\r | |
32 | \r | |
4bf17f4a | 33 | public CustomXmlEvent(CustomXmlTraceDefinition definition, ITmfTrace<?> parentTrace, TmfTimestamp timestamp, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r |
34 | super(definition, parentTrace, timestamp, source, type, reference);\r | |
c3c5c786 FC |
35 | }\r |
36 | \r | |
37 | public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfTimestamp originalTS, TmfTimestamp effectiveTS, TmfEventSource source, TmfEventType type, TmfEventReference reference) {\r | |
38 | super(definition, originalTS, effectiveTS, source, type, reference);\r | |
39 | }\r | |
40 | \r | |
41 | public void parseInput(String value, String name, int inputAction, String inputFormat) {\r | |
42 | if (value.length() == 0) {\r | |
43 | return;\r | |
44 | }\r | |
45 | if (inputAction == CustomTraceDefinition.ACTION_SET) {\r | |
46 | fData.put(name, value);\r | |
47 | if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r | |
48 | fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);\r | |
49 | }\r | |
50 | } else if (inputAction == CustomTraceDefinition.ACTION_APPEND) {\r | |
51 | String s = fData.get(name);\r | |
52 | if (s != null) {\r | |
53 | fData.put(name, s + value);\r | |
54 | } else {\r | |
55 | fData.put(name, value);\r | |
56 | }\r | |
57 | if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r | |
58 | String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);\r | |
59 | if (timeStampInputFormat != null) {\r | |
60 | fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + inputFormat);\r | |
61 | } else {\r | |
62 | fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);\r | |
63 | }\r | |
64 | }\r | |
65 | } else if (inputAction == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {\r | |
66 | String s = fData.get(name);\r | |
67 | if (s != null) {\r | |
3b38ea61 | 68 | fData.put(name, s + " | " + value); //$NON-NLS-1$\r |
c3c5c786 FC |
69 | } else {\r |
70 | fData.put(name, value);\r | |
71 | }\r | |
72 | if (name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {\r | |
73 | String timeStampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);\r | |
74 | if (timeStampInputFormat != null) {\r | |
3b38ea61 | 75 | fData.put(TIMESTAMP_INPUT_FORMAT_KEY, timeStampInputFormat + " | " + inputFormat); //$NON-NLS-1$\r |
c3c5c786 FC |
76 | } else {\r |
77 | fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);\r | |
78 | }\r | |
79 | }\r | |
80 | }\r | |
81 | }\r | |
82 | \r | |
83 | }\r |