Commit | Line | Data |
---|---|---|
be222f56 PT |
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.internal.tmf.ui.parsers.custom; | |
14 | ||
15 | import java.text.SimpleDateFormat; | |
16 | import java.util.List; | |
17 | ||
18 | import org.eclipse.linuxtools.internal.tmf.ui.Messages; | |
19 | import org.eclipse.linuxtools.tmf.core.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 | return simpleDateFormat.format(timestamp.getValue()); | |
54 | } | |
55 | ||
56 | public abstract void save(); | |
57 | public abstract void save(String path); | |
58 | } |