59a959202d99783d63fa2e2192e656e9598f26da
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
.linuxtools
.btf
.ui
;
16 import java
.util
.Collection
;
18 import org
.eclipse
.jdt
.annotation
.NonNull
;
19 import org
.eclipse
.linuxtools
.btf
.core
.trace
.BtfColumnNames
;
20 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
21 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
.columns
.ITmfEventTableColumns
;
22 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
.columns
.TmfEventTableColumn
;
23 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
.columns
.TmfEventTableFieldColumn
;
25 import com
.google
.common
.collect
.ImmutableList
;
28 * Columns to use in the BTF event table
30 * @author Alexandre Montplaisir
32 public class BtfEventTableColumns
implements ITmfEventTableColumns
{
34 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
38 @SuppressWarnings("null")
39 private static final @NonNull Collection
<TmfEventTableColumn
> BTF_COLUMNS
= ImmutableList
.of(
40 TmfEventTableColumn
.BaseColumns
.TIMESTAMP
,
41 new BtfSourceColumn(),
42 new BtfSourceInstanceColumn(),
43 TmfEventTableColumn
.BaseColumns
.EVENT_TYPE
,
44 new BtfTargetColumn(),
45 new BtfTargetInstanceColumn(),
51 * The "source" column, whose value comes from {@link ITmfEvent#getSource()}
53 private static class BtfSourceColumn
extends TmfEventTableColumn
{
55 public BtfSourceColumn() {
56 super(BtfColumnNames
.SOURCE
.toString(), null);
60 public String
getItemString(ITmfEvent event
) {
61 String ret
= event
.getSource();
62 return (ret
== null ? EMPTY_STRING
: ret
);
66 public String
getFilterFieldId() {
67 return ITmfEvent
.EVENT_FIELD_SOURCE
;
72 * The "source instance" column, whose value comes from the field of the
75 private static class BtfSourceInstanceColumn
extends TmfEventTableFieldColumn
{
76 public BtfSourceInstanceColumn() {
77 super(BtfColumnNames
.SOURCE_INSTANCE
.toString());
82 * The "target" column, taking its value from
83 * {@link ITmfEvent#getReference()}.
85 private static class BtfTargetColumn
extends TmfEventTableColumn
{
87 public BtfTargetColumn() {
88 super(BtfColumnNames
.TARGET
.toString());
92 public String
getItemString(ITmfEvent event
) {
93 String ret
= event
.getReference();
94 return (ret
== null ? EMPTY_STRING
: ret
);
98 public String
getFilterFieldId() {
99 return ITmfEvent
.EVENT_FIELD_REFERENCE
;
104 * The "target instance" column, whose value comes from the field of the
107 private static class BtfTargetInstanceColumn
extends TmfEventTableFieldColumn
{
108 public BtfTargetInstanceColumn() {
109 super(BtfColumnNames
.TARGET_INSTANCE
.toString());
114 * The "event" column, whose value comes from the field of the same name.
116 private static class BtfEventColumn
extends TmfEventTableFieldColumn
{
117 public BtfEventColumn() {
118 super(BtfColumnNames
.EVENT
.toString());
123 * The "notes" column, whose value comes from the field of the same name, if
126 private static class BtfNotesColumn
extends TmfEventTableFieldColumn
{
127 public BtfNotesColumn() {
128 super(BtfColumnNames
.NOTES
.toString());
132 // ------------------------------------------------------------------------
133 // ITmfEventTableColumns
134 // ------------------------------------------------------------------------
137 public Collection
<?
extends TmfEventTableColumn
> getEventTableColumns() {
This page took 0.04183 seconds and 4 git commands to generate.