Re-structure LTTng sub-project as per the Linux Tools guidelines
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / parsers / custom / CustomXmlEvent.java
1 /*******************************************************************************
2 * Copyright (c) 2010 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.ui.parsers.custom;
14
15 import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
16 import org.eclipse.linuxtools.tmf.core.event.TmfEventReference;
17 import org.eclipse.linuxtools.tmf.core.event.TmfEventSource;
18 import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
19 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
20 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
21
22 public class CustomXmlEvent extends CustomEvent {
23
24 public CustomXmlEvent(CustomXmlTraceDefinition definition) {
25 super(definition);
26 fType = new CustomXmlEventType(definition);
27 }
28
29 public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfEvent other) {
30 super(definition, other);
31 }
32
33 public CustomXmlEvent(CustomXmlTraceDefinition definition, ITmfTrace<?> parentTrace, TmfTimestamp timestamp, TmfEventSource source, TmfEventType type, TmfEventReference reference) {
34 super(definition, parentTrace, timestamp, source, type, reference);
35 }
36
37 public CustomXmlEvent(CustomXmlTraceDefinition definition, TmfTimestamp originalTS, TmfTimestamp effectiveTS, TmfEventSource source, TmfEventType type, TmfEventReference reference) {
38 super(definition, originalTS, effectiveTS, source, type, reference);
39 }
40
41 public void parseInput(String value, String name, int inputAction, String inputFormat) {
42 if (value.length() == 0) {
43 return;
44 }
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);
49 }
50 } else if (inputAction == CustomTraceDefinition.ACTION_APPEND) {
51 String s = fData.get(name);
52 if (s != null) {
53 fData.put(name, s + value);
54 } else {
55 fData.put(name, value);
56 }
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);
61 } else {
62 fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);
63 }
64 }
65 } else if (inputAction == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {
66 String s = fData.get(name);
67 if (s != null) {
68 fData.put(name, s + " | " + value); //$NON-NLS-1$
69 } else {
70 fData.put(name, value);
71 }
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$
76 } else {
77 fData.put(TIMESTAMP_INPUT_FORMAT_KEY, inputFormat);
78 }
79 }
80 }
81 }
82
83 }
This page took 0.041863 seconds and 6 git commands to generate.