7bcbfb2612d86e91cacc9d09380e4348930cd7a1
1 /*******************************************************************************
2 * Copyright (c) 2014 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 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.btf
.ui
;
16 import java
.util
.Collection
;
18 import org
.eclipse
.jdt
.annotation
.NonNull
;
19 import org
.eclipse
.tracecompass
.btf
.core
.event
.BtfEvent
;
20 import org
.eclipse
.tracecompass
.btf
.core
.trace
.BtfColumnNames
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.ITmfEventAspect
;
23 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.TmfEventFieldAspect
;
24 import org
.eclipse
.tracecompass
.tmf
.ui
.viewers
.events
.columns
.ITmfEventTableColumns
;
25 import org
.eclipse
.tracecompass
.tmf
.ui
.viewers
.events
.columns
.TmfEventTableColumn
;
27 import com
.google
.common
.collect
.ImmutableList
;
30 * Columns to use in the BTF event table
32 * @author Alexandre Montplaisir
34 public class BtfEventTableColumns
implements ITmfEventTableColumns
{
36 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
40 @SuppressWarnings("null")
41 private static final @NonNull Collection
<TmfEventTableColumn
> BTF_COLUMNS
= ImmutableList
.of(
42 new TmfEventTableColumn(ITmfEventAspect
.BaseAspects
.TIMESTAMP
),
43 new TmfEventTableColumn(new BtfSourceAspect()),
44 new TmfEventTableColumn(new BtfSourceInstanceAspect()),
45 new TmfEventTableColumn(ITmfEventAspect
.BaseAspects
.EVENT_TYPE
),
46 new TmfEventTableColumn(new BtfTargetAspect()),
47 new TmfEventTableColumn(new BtfTargetInstanceAspect()),
48 new TmfEventTableColumn(new BtfEventAspect()),
49 new TmfEventTableColumn(new BtfNotesAspect())
53 * The "source" aspect, whose value comes from {@link ITmfEvent#getSource()}
55 private static class BtfSourceAspect
implements ITmfEventAspect
{
58 public String
getName() {
59 return BtfColumnNames
.SOURCE
.toString();
63 public String
getHelpText() {
68 public String
resolve(ITmfEvent event
) {
69 if (!(event
instanceof BtfEvent
)) {
72 String ret
= ((BtfEvent
) event
).getSource();
73 return (ret
== null ? EMPTY_STRING
: ret
);
77 public String
getFilterId() {
78 return ITmfEvent
.EVENT_FIELD_SOURCE
;
83 * The "source instance" aspect, whose value comes from the field of the
86 private static class BtfSourceInstanceAspect
extends TmfEventFieldAspect
{
87 public BtfSourceInstanceAspect() {
88 super(BtfColumnNames
.SOURCE_INSTANCE
.toString(),
89 BtfColumnNames
.SOURCE_INSTANCE
.toString());
94 * The "target" aspect, taking its value from
95 * {@link ITmfEvent#getReference()}.
97 private static class BtfTargetAspect
implements ITmfEventAspect
{
100 public String
getName() {
101 return BtfColumnNames
.TARGET
.toString();
105 public String
getHelpText() {
110 public String
resolve(ITmfEvent event
) {
111 if (!(event
instanceof BtfEvent
)) {
114 String ret
= ((BtfEvent
) event
).getReference();
115 return (ret
== null ? EMPTY_STRING
: ret
);
119 public String
getFilterId() {
120 return ITmfEvent
.EVENT_FIELD_REFERENCE
;
125 * The "target instance" aspect, whose value comes from the field of the
128 private static class BtfTargetInstanceAspect
extends TmfEventFieldAspect
{
129 public BtfTargetInstanceAspect() {
130 super(BtfColumnNames
.TARGET_INSTANCE
.toString(),
131 BtfColumnNames
.TARGET_INSTANCE
.toString());
136 * The "event" aspect, whose value comes from the field of the same name.
138 private static class BtfEventAspect
extends TmfEventFieldAspect
{
139 public BtfEventAspect() {
140 super(BtfColumnNames
.EVENT
.toString(),
141 BtfColumnNames
.EVENT
.toString());
146 * The "notes" column, whose value comes from the field of the same name, if
149 private static class BtfNotesAspect
extends TmfEventFieldAspect
{
150 public BtfNotesAspect() {
151 super(BtfColumnNames
.NOTES
.toString(),
152 BtfColumnNames
.NOTES
.toString());
156 // ------------------------------------------------------------------------
157 // ITmfEventTableColumns
158 // ------------------------------------------------------------------------
161 public Collection
<?
extends TmfEventTableColumn
> getEventTableColumns() {
This page took 0.04664 seconds and 5 git commands to generate.