ctf: make Declarations have some NonNull annotations
[deliverable/tracecompass.git] / org.eclipse.tracecompass.lttng2.kernel.ui / src / org / eclipse / tracecompass / internal / lttng2 / kernel / ui / viewers / events / LttngEventTableColumns.java
1 /*******************************************************************************
2 * Copyright (c) 2014 Ericsson
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 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.internal.lttng2.kernel.ui.viewers.events;
14
15 import java.util.Collection;
16
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
19 import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
20 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
21 import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.ITmfEventTableColumns;
22 import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn;
23
24 import com.google.common.collect.ImmutableList;
25
26 /**
27 * Event table columns for LTTng 2.x kernel traces
28 */
29 public class LttngEventTableColumns implements ITmfEventTableColumns {
30
31 // ------------------------------------------------------------------------
32 // Column definition
33 // ------------------------------------------------------------------------
34
35 @SuppressWarnings("null")
36 private static final @NonNull String CHANNEL_HEADER = Messages.EventsTable_channelColumn;
37
38 @SuppressWarnings("null")
39 private static final @NonNull Collection<TmfEventTableColumn> LTTNG_COLUMNS =
40 ImmutableList.<TmfEventTableColumn> of(
41 new TmfEventTableColumn(ITmfEventAspect.BaseAspects.TIMESTAMP),
42 new TmfEventTableColumn(new LttngChannelAspect()),
43 new TmfEventTableColumn(ITmfEventAspect.BaseAspects.EVENT_TYPE),
44 new TmfEventTableColumn(ITmfEventAspect.BaseAspects.CONTENTS));
45
46 private static class LttngChannelAspect implements ITmfEventAspect {
47
48 @Override
49 public String getName() {
50 return CHANNEL_HEADER;
51 }
52
53 @Override
54 public String getHelpText() {
55 return EMPTY_STRING;
56 }
57
58 @Override
59 public String resolve(ITmfEvent event) {
60 if (!(event instanceof CtfTmfEvent)) {
61 return EMPTY_STRING;
62 }
63 String ret = ((CtfTmfEvent) event).getReference();
64 return (ret == null ? EMPTY_STRING : ret);
65 }
66
67 @Override
68 public String getFilterId() {
69 return ITmfEvent.EVENT_FIELD_REFERENCE;
70 }
71 }
72
73 // ------------------------------------------------------------------------
74 // Constructor
75 // ------------------------------------------------------------------------
76
77 @Override
78 public Collection<? extends TmfEventTableColumn> getEventTableColumns() {
79 return LTTNG_COLUMNS;
80 }
81 }
This page took 0.039659 seconds and 5 git commands to generate.