ctf: make Declarations have some NonNull annotations
[deliverable/tracecompass.git] / org.eclipse.tracecompass.gdbtrace.ui / src / org / eclipse / tracecompass / internal / gdbtrace / ui / views / events / GdbEventTableColumns.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.gdbtrace.ui.views.events;
14
15 import java.util.Collection;
16
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent;
19 import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent;
20 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
21 import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
22 import org.eclipse.tracecompass.tmf.core.event.aspect.TmfEventFieldAspect;
23 import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.ITmfEventTableColumns;
24 import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn;
25
26 import com.google.common.collect.ImmutableList;
27
28 /**
29 * Event table column definition for GDB traces.
30 *
31 * @author Alexandre Montplaisir
32 */
33 public class GdbEventTableColumns implements ITmfEventTableColumns {
34
35 // ------------------------------------------------------------------------
36 // Column definition
37 // ------------------------------------------------------------------------
38
39 @SuppressWarnings("null")
40 static final @NonNull Collection<TmfEventTableColumn> GDB_COLUMNS = ImmutableList.of(
41 new TmfEventTableColumn(new GdbTraceFrameAspect()),
42 new TmfEventTableColumn(new GdbTracepointAspect()),
43 new TmfEventTableColumn(new GdbFileAspect())
44 );
45
46 private static class GdbTraceFrameAspect extends TmfEventFieldAspect {
47 public GdbTraceFrameAspect() {
48 super(GdbTraceEventContent.TRACE_FRAME,
49 GdbTraceEventContent.TRACE_FRAME);
50 }
51 }
52
53 private static class GdbTracepointAspect extends TmfEventFieldAspect {
54 public GdbTracepointAspect() {
55 super(GdbTraceEventContent.TRACEPOINT,
56 GdbTraceEventContent.TRACEPOINT);
57 }
58 }
59
60 private static class GdbFileAspect implements ITmfEventAspect {
61
62 @Override
63 public String getName() {
64 return "File"; //$NON-NLS-1$
65 }
66
67 @Override
68 public String getHelpText() {
69 return EMPTY_STRING;
70 }
71
72 @Override
73 public String resolve(ITmfEvent event) {
74 if (!(event instanceof GdbTraceEvent)) {
75 return EMPTY_STRING;
76 }
77 String ret = ((GdbTraceEvent) event).getReference();
78 return (ret == null ? EMPTY_STRING : ret);
79 }
80
81 @Override
82 public String getFilterId() {
83 return ITmfEvent.EVENT_FIELD_REFERENCE;
84 }
85 }
86
87 // ------------------------------------------------------------------------
88 // ITmfEventTableColumns
89 // ------------------------------------------------------------------------
90
91 @Override
92 public Collection<? extends TmfEventTableColumn> getEventTableColumns() {
93 return GDB_COLUMNS;
94 }
95 }
This page took 0.039726 seconds and 5 git commands to generate.