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 - Updated to new Event Table API
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.btf
.ui
;
16 import java
.util
.Collection
;
18 import org
.eclipse
.linuxtools
.btf
.core
.trace
.BtfColumnNames
;
19 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
20 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
.TmfEventsTable
;
21 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
.columns
.TmfEventTableColumn
;
22 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.events
.columns
.TmfEventTableFieldColumn
;
23 import org
.eclipse
.swt
.widgets
.Composite
;
25 import com
.google
.common
.collect
.ImmutableList
;
30 * @author Matthew Khouzam
32 public class BtfEventViewer
extends TmfEventsTable
{
34 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
38 private static final Collection
<TmfEventTableColumn
> BTF_COLUMNS
= ImmutableList
.of(
39 TmfEventTableColumn
.BaseColumns
.TIMESTAMP
,
40 new BtfSourceColumn(),
41 new BtfSourceInstanceColumn(),
42 TmfEventTableColumn
.BaseColumns
.EVENT_TYPE
,
43 new BtfTargetColumn(),
44 new BtfTargetInstanceColumn(),
50 * The "source" column, whose value comes from {@link ITmfEvent#getSource()}
52 private static class BtfSourceColumn
extends TmfEventTableColumn
{
54 public BtfSourceColumn() {
55 super(BtfColumnNames
.SOURCE
.toString(), null);
59 public String
getItemString(ITmfEvent event
) {
60 String ret
= event
.getSource();
61 return (ret
== null ? EMPTY_STRING
: ret
);
65 public String
getFilterFieldId() {
66 return ITmfEvent
.EVENT_FIELD_SOURCE
;
71 * The "source instance" column, whose value comes from the field of the
74 private static class BtfSourceInstanceColumn
extends TmfEventTableFieldColumn
{
75 public BtfSourceInstanceColumn() {
76 super(BtfColumnNames
.SOURCE_INSTANCE
.toString());
81 * The "target" column, taking its value from
82 * {@link ITmfEvent#getReference()}.
84 private static class BtfTargetColumn
extends TmfEventTableColumn
{
86 public BtfTargetColumn() {
87 super(BtfColumnNames
.TARGET
.toString());
91 public String
getItemString(ITmfEvent event
) {
92 String ret
= event
.getReference();
93 return (ret
== null ? EMPTY_STRING
: ret
);
97 public String
getFilterFieldId() {
98 return ITmfEvent
.EVENT_FIELD_REFERENCE
;
103 * The "target instance" column, whose value comes from the field of the
106 private static class BtfTargetInstanceColumn
extends TmfEventTableFieldColumn
{
107 public BtfTargetInstanceColumn() {
108 super(BtfColumnNames
.TARGET_INSTANCE
.toString());
113 * The "event" column, whose value comes from the field of the same name.
115 private static class BtfEventColumn
extends TmfEventTableFieldColumn
{
116 public BtfEventColumn() {
117 super(BtfColumnNames
.EVENT
.toString());
122 * The "notes" column, whose value comes from the field of the same name, if
125 private static class BtfNotesColumn
extends TmfEventTableFieldColumn
{
126 public BtfNotesColumn() {
127 super(BtfColumnNames
.NOTES
.toString());
131 // ------------------------------------------------------------------------
133 // ------------------------------------------------------------------------
136 * Basic constructor, will use default column data.
139 * The parent composite UI object
141 * The size of the event table cache
143 public BtfEventViewer(Composite parent
, int cacheSize
) {
144 super(parent
, cacheSize
, BTF_COLUMNS
);
This page took 0.032978 seconds and 5 git commands to generate.