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 | |
c64aa527 | 15 | import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;\r |
6c13869b | 16 | import org.eclipse.linuxtools.tmf.core.event.TmfEvent;\r |
6c13869b | 17 | import org.eclipse.linuxtools.tmf.core.event.TmfEventType;\r |
6c13869b | 18 | import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;\r |
c3c5c786 FC |
19 | \r |
20 | public class CustomXmlEvent extends CustomEvent {\r | |
21 | \r | |
4bf17f4a | 22 | public CustomXmlEvent(CustomXmlTraceDefinition definition) {\r |
23 | super(definition);\r | |
24 | fType = new CustomXmlEventType(definition);\r | |
25 | }\r | |
26 | \r | |
c3c5c786 FC |
27 | public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfEvent other) {\r |
28 | super(definition, other);\r | |
29 | }\r | |
30 | \r | |
c64aa527 | 31 | public CustomXmlEvent(CustomXmlTraceDefinition definition, ITmfTrace<?> parentTrace, ITmfTimestamp timestamp, String source, TmfEventType type, String reference) {\r |
4bf17f4a | 32 | super(definition, parentTrace, timestamp, source, type, reference);\r |
c3c5c786 FC |
33 | }\r |
34 | \r | |
c3c5c786 FC |
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 |