tmf: Add TmfEventTableColumn class
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.ui / src / org / eclipse / linuxtools / internal / lttng2 / kernel / ui / viewers / events / LTTng2EventsTable.java
CommitLineData
be222f56 1/*******************************************************************************
11252342 2 * Copyright (c) 2012, 2013 Ericsson
be222f56
PT
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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.internal.lttng2.kernel.ui.viewers.events;
14
baafe54c
AM
15import java.util.Collection;
16
17import org.eclipse.jdt.annotation.NonNull;
be222f56 18import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
be222f56 19import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;
baafe54c 20import org.eclipse.linuxtools.tmf.ui.viewers.events.columns.TmfEventTableColumn;
be222f56
PT
21import org.eclipse.swt.widgets.Composite;
22
baafe54c
AM
23import com.google.common.collect.ImmutableList;
24
be222f56
PT
25/**
26 * Events table specific for LTTng 2.0 kernel traces
27 */
28public class LTTng2EventsTable extends TmfEventsTable {
29
30 // ------------------------------------------------------------------------
baafe54c 31 // Column definition
be222f56
PT
32 // ------------------------------------------------------------------------
33
baafe54c
AM
34 @SuppressWarnings("null")
35 private static final @NonNull String CHANNEL_HEADER = Messages.EventsTable_channelColumn;
36
37 private static final Collection<TmfEventTableColumn> LTTNG_COLUMNS =
38 ImmutableList.<TmfEventTableColumn> of(
39 TmfEventTableColumn.BaseColumns.TIMESTAMP,
40 new LttngChannelColumn(),
41 TmfEventTableColumn.BaseColumns.EVENT_TYPE,
42 TmfEventTableColumn.BaseColumns.CONTENTS);
43
44 private static class LttngChannelColumn extends TmfEventTableColumn {
be222f56 45
baafe54c
AM
46 public LttngChannelColumn() {
47 super(CHANNEL_HEADER);
48 }
49
50 @Override
51 public String getItemString(ITmfEvent event) {
52 String ret = event.getReference();
53 return (ret == null ? EMPTY_STRING : ret);
54 }
55
56 @Override
57 public String getFilterFieldId() {
58 return ITmfEvent.EVENT_FIELD_REFERENCE;
59 }
60 }
be222f56
PT
61
62 // ------------------------------------------------------------------------
63 // Constructor
64 // ------------------------------------------------------------------------
65
66 /**
67 * Constructor
68 *
69 * @param parent
70 * The parent composite
71 * @param cacheSize
72 * The size of the rows cache
73 */
74 public LTTng2EventsTable(Composite parent, int cacheSize) {
baafe54c 75 super(parent, cacheSize, LTTNG_COLUMNS);
be222f56 76 }
be222f56 77}
This page took 0.043611 seconds and 5 git commands to generate.