tmf: Add missing export to tmf.ui's Manifest
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / parsers / custom / CustomTrace.java
CommitLineData
2b0005f0
PT
1/*******************************************************************************
2 * Copyright (c) 2015 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
13package org.eclipse.tracecompass.tmf.core.parsers.custom;
14
15import org.eclipse.jdt.annotation.NonNull;
16import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
17import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
18
19/**
20 * Base class for custom traces.
21 *
22 * @author Patrick Tasse
23 */
24public abstract class CustomTrace extends TmfTrace {
25
26 private static final char SEPARATOR = ':';
27
28 private final String fTraceTypeId;
29
30 /**
31 * Basic constructor.
32 *
33 * @param definition
34 * Custom trace definition
35 */
36 public CustomTrace(CustomTraceDefinition definition) {
37 fTraceTypeId = buildTraceTypeId(getClass(), definition.categoryName, definition.definitionName);
38 }
39
40 /**
41 * Build the trace type id for a custom trace
42 *
43 * @param traceClass
44 * the trace class
45 * @param category
46 * the category
47 * @param definitionName
48 * the definition name
49 * @return the trace type id
50 */
51 public static @NonNull String buildTraceTypeId(Class<? extends ITmfTrace> traceClass, String category, String definitionName) {
52 return traceClass.getCanonicalName() + SEPARATOR + category + SEPARATOR + definitionName;
53 }
54
55 @Override
56 public String getTraceTypeId() {
57 return fTraceTypeId;
58 }
59}
This page took 0.037746 seconds and 5 git commands to generate.