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