tmf: Remove source and reference from ITmfEvent
[deliverable/tracecompass.git] / org.eclipse.tracecompass.gdbtrace.ui / src / org / eclipse / tracecompass / internal / gdbtrace / ui / views / events / GdbEventTableColumns.java
CommitLineData
99d7adc6
AM
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
04c0d7d3 13package org.eclipse.tracecompass.internal.gdbtrace.ui.views.events;
99d7adc6
AM
14
15import java.util.Collection;
16
17import org.eclipse.jdt.annotation.NonNull;
e1de2fd4 18import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent;
04c0d7d3 19import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent;
2bdf0193
AM
20import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
21import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.ITmfEventTableColumns;
22import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn;
23import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableFieldColumn;
99d7adc6
AM
24
25import com.google.common.collect.ImmutableList;
26
27/**
28 * Event table column definition for GDB traces.
29 *
30 * @author Alexandre Montplaisir
31 */
32public class GdbEventTableColumns implements ITmfEventTableColumns {
33
34 // ------------------------------------------------------------------------
35 // Column definition
36 // ------------------------------------------------------------------------
37
38 @SuppressWarnings("null")
39 static final @NonNull Collection<TmfEventTableColumn> GDB_COLUMNS = ImmutableList.of(
40 new GdbTraceFrameColumn(),
41 new GdbTracepointColumn(),
42 new GdbFileColumn()
43 );
44
45 private static class GdbTraceFrameColumn extends TmfEventTableFieldColumn {
46 public GdbTraceFrameColumn() {
47 super(GdbTraceEventContent.TRACE_FRAME);
48 }
49 }
50
51 private static class GdbTracepointColumn extends TmfEventTableFieldColumn {
52 public GdbTracepointColumn() {
53 super(GdbTraceEventContent.TRACEPOINT);
54 }
55 }
56
57 private static class GdbFileColumn extends TmfEventTableColumn {
58
59 public GdbFileColumn() {
60 super("File"); //$NON-NLS-1$
61 }
62
63 @Override
64 public String getItemString(ITmfEvent event) {
e1de2fd4
AM
65 if (!(event instanceof GdbTraceEvent)) {
66 return EMPTY_STRING;
67 }
68 String ret = ((GdbTraceEvent) event).getReference();
99d7adc6
AM
69 return (ret == null ? EMPTY_STRING : ret);
70 }
71
72 @Override
73 public String getFilterFieldId() {
74 return ITmfEvent.EVENT_FIELD_REFERENCE;
75 }
76 }
77
78 // ------------------------------------------------------------------------
79 // ITmfEventTableColumns
80 // ------------------------------------------------------------------------
81
82 @Override
83 public Collection<? extends TmfEventTableColumn> getEventTableColumns() {
84 return GDB_COLUMNS;
85 }
86}
This page took 0.034027 seconds and 5 git commands to generate.