tmf: Make CustomText/Xml test wait until wizard shell is active
[deliverable/tracecompass.git] / btf / org.eclipse.tracecompass.btf.core / src / org / eclipse / tracecompass / btf / core / trace / BtfEventAspects.java
CommitLineData
ff71e543 1/*******************************************************************************
df854ddb 2 * Copyright (c) 2014, 2015 Ericsson
ff71e543
MK
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 * Matthew Khouzam - Initial API and implementation
99d7adc6 11 * Alexandre Montplaisir - Update to new Event Table API
df854ddb 12 * Patrick Tasse - Update for renamed target field
ff71e543
MK
13 *******************************************************************************/
14
b04903a2 15package org.eclipse.tracecompass.btf.core.trace;
baafe54c 16
99d7adc6 17import org.eclipse.jdt.annotation.NonNull;
e1de2fd4 18import org.eclipse.tracecompass.btf.core.event.BtfEvent;
5db5a3a4 19import org.eclipse.tracecompass.common.core.NonNullUtils;
2bdf0193 20import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
9447c7ee 21import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
40dfafb3 22import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
ff71e543 23
baafe54c
AM
24import com.google.common.collect.ImmutableList;
25
ff71e543 26/**
99d7adc6 27 * Columns to use in the BTF event table
ff71e543 28 *
99d7adc6 29 * @author Alexandre Montplaisir
ff71e543 30 */
b04903a2 31public final class BtfEventAspects {
ff71e543 32
b04903a2 33 private BtfEventAspects() {}
baafe54c 34
5db5a3a4
AM
35 private static final @NonNull Iterable<ITmfEventAspect> BTF_ASPECTS =
36 NonNullUtils.checkNotNull(ImmutableList.of(
37 ITmfEventAspect.BaseAspects.TIMESTAMP,
38 new BtfSourceAspect(),
40dfafb3 39 new TmfContentFieldAspect(BtfColumnNames.SOURCE_INSTANCE.toString(), BtfColumnNames.SOURCE_INSTANCE.toString()),
5db5a3a4
AM
40 ITmfEventAspect.BaseAspects.EVENT_TYPE,
41 new BtfTargetAspect(),
40dfafb3
PT
42 new TmfContentFieldAspect(BtfColumnNames.TARGET_INSTANCE.toString(), BtfColumnNames.TARGET_INSTANCE.toString()),
43 new TmfContentFieldAspect(BtfColumnNames.EVENT.toString(), BtfColumnNames.EVENT.toString()),
44 new TmfContentFieldAspect(BtfColumnNames.NOTES.toString(), BtfColumnNames.NOTES.toString())
5db5a3a4 45 ));
baafe54c
AM
46
47 /**
9447c7ee 48 * The "source" aspect, whose value comes from {@link ITmfEvent#getSource()}
baafe54c 49 */
9447c7ee 50 private static class BtfSourceAspect implements ITmfEventAspect {
baafe54c 51
9447c7ee
AM
52 @Override
53 public String getName() {
54 return BtfColumnNames.SOURCE.toString();
55 }
56
57 @Override
58 public String getHelpText() {
59 return EMPTY_STRING;
baafe54c
AM
60 }
61
62 @Override
9447c7ee 63 public String resolve(ITmfEvent event) {
e1de2fd4
AM
64 if (!(event instanceof BtfEvent)) {
65 return EMPTY_STRING;
66 }
67 String ret = ((BtfEvent) event).getSource();
baafe54c
AM
68 return (ret == null ? EMPTY_STRING : ret);
69 }
baafe54c
AM
70 }
71
baafe54c 72 /**
9447c7ee 73 * The "target" aspect, taking its value from
df854ddb 74 * {@link ITmfEvent#getTarget()}.
baafe54c 75 */
9447c7ee 76 private static class BtfTargetAspect implements ITmfEventAspect {
baafe54c 77
9447c7ee
AM
78 @Override
79 public String getName() {
80 return BtfColumnNames.TARGET.toString();
81 }
82
83 @Override
84 public String getHelpText() {
85 return EMPTY_STRING;
baafe54c
AM
86 }
87
88 @Override
9447c7ee 89 public String resolve(ITmfEvent event) {
e1de2fd4
AM
90 if (!(event instanceof BtfEvent)) {
91 return EMPTY_STRING;
92 }
df854ddb 93 String ret = ((BtfEvent) event).getTarget();
baafe54c
AM
94 return (ret == null ? EMPTY_STRING : ret);
95 }
baafe54c
AM
96 }
97
b04903a2
AM
98 /**
99 * Return the event aspects defined for BTF traces.
100 *
101 * @return The aspects
102 */
8192209b 103 public static @NonNull Iterable<ITmfEventAspect> getAspects() {
b04903a2 104 return BTF_ASPECTS;
ff71e543 105 }
baafe54c 106}
This page took 0.050559 seconds and 5 git commands to generate.