Commit | Line | Data |
---|---|---|
a0a88f65 | 1 | /******************************************************************************* |
c8422608 | 2 | * Copyright (c) 2010, 2013 Ericsson |
a0a88f65 AM |
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 Tassé - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
be222f56 PT |
13 | package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom; |
14 | ||
15 | import org.eclipse.linuxtools.tmf.core.event.ITmfEventField; | |
16 | import org.eclipse.linuxtools.tmf.core.event.TmfEventField; | |
17 | import org.eclipse.linuxtools.tmf.core.event.TmfEventType; | |
18 | ||
a0a88f65 AM |
19 | /** |
20 | * Event type for custom text parsers. | |
21 | * | |
22 | * @author Patrick Tassé | |
23 | */ | |
be222f56 | 24 | public abstract class CustomEventType extends TmfEventType { |
a0a88f65 | 25 | |
be222f56 | 26 | private static String CONTEXT_ID = "CustomEventType"; //$NON-NLS-1$ |
a0a88f65 AM |
27 | |
28 | /** | |
29 | * Constructor | |
30 | * | |
31 | * @param definition | |
32 | * Trace definition | |
33 | */ | |
be222f56 PT |
34 | public CustomEventType(CustomTraceDefinition definition) { |
35 | super(CONTEXT_ID, definition.definitionName, getRootField(definition)); | |
36 | } | |
37 | ||
38 | private static ITmfEventField getRootField(CustomTraceDefinition definition) { | |
39 | ITmfEventField[] fields = new ITmfEventField[definition.outputs.size()]; | |
40 | for (int i = 0; i < fields.length; i++) { | |
41 | fields[i] = new TmfEventField(definition.outputs.get(i).name, null); | |
42 | } | |
43 | ITmfEventField rootField = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, fields); | |
44 | return rootField; | |
45 | } | |
46 | ||
47 | } |