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
.tmf
.ui
.parsers
.custom
;
15 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEvent
;
16 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEventReference
;
17 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEventSource
;
18 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEventType
;
19 import org
.eclipse
.linuxtools
.tmf
.event
.TmfTimestamp
;
21 public class CustomXmlEvent
extends CustomEvent
{
23 public CustomXmlEvent(CustomXmlTraceDefinition definition
, TmfEvent other
) {
24 super(definition
, other
);
27 public CustomXmlEvent(CustomXmlTraceDefinition definition
, TmfTimestamp timestamp
, TmfEventSource source
, TmfEventType type
, TmfEventReference reference
) {
28 super(definition
, timestamp
, source
, type
, reference
);
31 public CustomXmlEvent(CustomXmlTraceDefinition definition
, TmfTimestamp originalTS
, TmfTimestamp effectiveTS
, TmfEventSource source
, TmfEventType type
, TmfEventReference reference
) {
32 super(definition
, originalTS
, effectiveTS
, source
, type
, reference
);
35 public void parseInput(String value
, String name
, int inputAction
, String inputFormat
) {
36 if (value
.length() == 0) {
39 if (inputAction
== CustomTraceDefinition
.ACTION_SET
) {
40 fData
.put(name
, value
);
41 if (name
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
42 fData
.put(TIMESTAMP_INPUT_FORMAT_KEY
, inputFormat
);
44 } else if (inputAction
== CustomTraceDefinition
.ACTION_APPEND
) {
45 String s
= fData
.get(name
);
47 fData
.put(name
, s
+ value
);
49 fData
.put(name
, value
);
51 if (name
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
52 String timeStampInputFormat
= fData
.get(TIMESTAMP_INPUT_FORMAT_KEY
);
53 if (timeStampInputFormat
!= null) {
54 fData
.put(TIMESTAMP_INPUT_FORMAT_KEY
, timeStampInputFormat
+ inputFormat
);
56 fData
.put(TIMESTAMP_INPUT_FORMAT_KEY
, inputFormat
);
59 } else if (inputAction
== CustomTraceDefinition
.ACTION_APPEND_WITH_SEPARATOR
) {
60 String s
= fData
.get(name
);
62 fData
.put(name
, s
+ " | " + value
); //$NON-NLS-1$
64 fData
.put(name
, value
);
66 if (name
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
67 String timeStampInputFormat
= fData
.get(TIMESTAMP_INPUT_FORMAT_KEY
);
68 if (timeStampInputFormat
!= null) {
69 fData
.put(TIMESTAMP_INPUT_FORMAT_KEY
, timeStampInputFormat
+ " | " + inputFormat
); //$NON-NLS-1$
71 fData
.put(TIMESTAMP_INPUT_FORMAT_KEY
, inputFormat
);