| 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.internal.tmf.ui.parsers.custom;\r |
| 14 | \r |
| 15 | import java.text.SimpleDateFormat;\r |
| 16 | import java.util.List;\r |
| 17 | \r |
| 18 | import org.eclipse.linuxtools.internal.tmf.ui.Messages;\r |
| 19 | import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;\r |
| 20 | \r |
| 21 | \r |
| 22 | public abstract class CustomTraceDefinition {\r |
| 23 | \r |
| 24 | public static final int ACTION_SET = 0;\r |
| 25 | public static final int ACTION_APPEND = 1;\r |
| 26 | public static final int ACTION_APPEND_WITH_SEPARATOR = 2;\r |
| 27 | \r |
| 28 | public static final String TAG_TIMESTAMP = Messages.CustomTraceDefinition_timestampTag;\r |
| 29 | public static final String TAG_MESSAGE = Messages.CustomTraceDefinition_messageTag;\r |
| 30 | public static final String TAG_OTHER = Messages.CustomTraceDefinition_otherTag;\r |
| 31 | \r |
| 32 | public String definitionName;\r |
| 33 | public List<OutputColumn> outputs;\r |
| 34 | public String timeStampOutputFormat;\r |
| 35 | \r |
| 36 | public static class OutputColumn {\r |
| 37 | public String name;\r |
| 38 | \r |
| 39 | public OutputColumn() {}\r |
| 40 | \r |
| 41 | public OutputColumn(String name) {\r |
| 42 | this.name = name;\r |
| 43 | }\r |
| 44 | \r |
| 45 | @Override\r |
| 46 | public String toString() {\r |
| 47 | return name;\r |
| 48 | }\r |
| 49 | }\r |
| 50 | \r |
| 51 | public String formatTimeStamp(TmfTimestamp timestamp) {\r |
| 52 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat(timeStampOutputFormat);\r |
| 53 | return simpleDateFormat.format(timestamp.getValue());\r |
| 54 | }\r |
| 55 | \r |
| 56 | public abstract void save();\r |
| 57 | public abstract void save(String path);\r |
| 58 | }\r |