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 / CustomTraceDefinition.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 java.text.SimpleDateFormat;
16 import java.util.List;
17 import java.util.TimeZone;
18
19 import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
20
21
22 public abstract class CustomTraceDefinition {
23
24 public static final int ACTION_SET = 0;
25 public static final int ACTION_APPEND = 1;
26 public static final int ACTION_APPEND_WITH_SEPARATOR = 2;
27
28 public static final String TAG_TIMESTAMP = Messages.CustomTraceDefinition_timestampTag;
29 public static final String TAG_MESSAGE = Messages.CustomTraceDefinition_messageTag;
30 public static final String TAG_OTHER = Messages.CustomTraceDefinition_otherTag;
31
32 public String definitionName;
33 public List<OutputColumn> outputs;
34 public String timeStampOutputFormat;
35
36 public static class OutputColumn {
37 public String name;
38
39 public OutputColumn() {};
40
41 public OutputColumn(String name) {
42 this.name = name;
43 }
44
45 @Override
46 public String toString() {
47 return name;
48 }
49 }
50
51 public String formatTimeStamp(TmfTimestamp timestamp) {
52 SimpleDateFormat simpleDateFormat = new SimpleDateFormat(timeStampOutputFormat);
53 simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
54 return simpleDateFormat.format(timestamp.getValue());
55 }
56
57 public abstract void save();
58 public abstract void save(String path);
59 }
This page took 0.030879 seconds and 5 git commands to generate.