1 /*******************************************************************************
2 * Copyright (c) 2014, 2015 Ericsson
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
10 * Matthew Khouzam - Initial API and implementation
11 * Alexandre Montplaisir - Update to new Event Table API
12 * Patrick Tasse - Update for renamed target field
13 *******************************************************************************/
15 package org
.eclipse
.tracecompass
.btf
.core
.trace
;
17 import org
.eclipse
.jdt
.annotation
.NonNullByDefault
;
18 import org
.eclipse
.jdt
.annotation
.Nullable
;
19 import org
.eclipse
.tracecompass
.btf
.core
.event
.BtfEvent
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.ITmfEventAspect
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.TmfContentFieldAspect
;
24 import com
.google
.common
.collect
.ImmutableList
;
27 * Columns to use in the BTF event table
29 * @author Alexandre Montplaisir
32 public final class BtfEventAspects
{
34 private BtfEventAspects() {}
36 private static final Iterable
<ITmfEventAspect
> BTF_ASPECTS
=
38 ITmfEventAspect
.BaseAspects
.TIMESTAMP
,
39 new BtfSourceAspect(),
40 new TmfContentFieldAspect(BtfColumnNames
.SOURCE_INSTANCE
.toString(), BtfColumnNames
.SOURCE_INSTANCE
.toString()),
41 ITmfEventAspect
.BaseAspects
.EVENT_TYPE
,
42 new BtfTargetAspect(),
43 new TmfContentFieldAspect(BtfColumnNames
.TARGET_INSTANCE
.toString(), BtfColumnNames
.TARGET_INSTANCE
.toString()),
44 new TmfContentFieldAspect(BtfColumnNames
.EVENT
.toString(), BtfColumnNames
.EVENT
.toString()),
45 new TmfContentFieldAspect(BtfColumnNames
.NOTES
.toString(), BtfColumnNames
.NOTES
.toString())
49 * The "source" aspect, whose value comes from {@link ITmfEvent#getSource()}
51 private static class BtfSourceAspect
implements ITmfEventAspect
{
54 public String
getName() {
55 return BtfColumnNames
.SOURCE
.toString();
59 public String
getHelpText() {
64 public @Nullable String
resolve(ITmfEvent event
) {
65 if (!(event
instanceof BtfEvent
)) {
68 String ret
= ((BtfEvent
) event
).getSource();
69 return (ret
== null ? EMPTY_STRING
: ret
);
74 * The "target" aspect, taking its value from
75 * {@link ITmfEvent#getTarget()}.
77 private static class BtfTargetAspect
implements ITmfEventAspect
{
80 public String
getName() {
81 return BtfColumnNames
.TARGET
.toString();
85 public String
getHelpText() {
90 public @Nullable String
resolve(ITmfEvent event
) {
91 if (!(event
instanceof BtfEvent
)) {
94 String ret
= ((BtfEvent
) event
).getTarget();
95 return (ret
== null ? EMPTY_STRING
: ret
);
100 * Return the event aspects defined for BTF traces.
102 * @return The aspects
104 public static Iterable
<ITmfEventAspect
> getAspects() {
This page took 0.036404 seconds and 5 git commands to generate.