Commit | Line | Data |
---|---|---|
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 | 13 | package org.eclipse.tracecompass.internal.gdbtrace.ui.views.events; |
99d7adc6 AM |
14 | |
15 | import java.util.Collection; | |
16 | ||
17 | import org.eclipse.jdt.annotation.NonNull; | |
e1de2fd4 | 18 | import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent; |
04c0d7d3 | 19 | import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent; |
2bdf0193 | 20 | import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; |
9447c7ee AM |
21 | import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect; |
22 | import org.eclipse.tracecompass.tmf.core.event.aspect.TmfEventFieldAspect; | |
2bdf0193 AM |
23 | import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.ITmfEventTableColumns; |
24 | import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn; | |
99d7adc6 AM |
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( | |
9447c7ee AM |
41 | new TmfEventTableColumn(new GdbTraceFrameAspect()), |
42 | new TmfEventTableColumn(new GdbTracepointAspect()), | |
43 | new TmfEventTableColumn(new GdbFileAspect()) | |
99d7adc6 AM |
44 | ); |
45 | ||
9447c7ee AM |
46 | private static class GdbTraceFrameAspect extends TmfEventFieldAspect { |
47 | public GdbTraceFrameAspect() { | |
48 | super(GdbTraceEventContent.TRACE_FRAME, | |
49 | GdbTraceEventContent.TRACE_FRAME); | |
99d7adc6 AM |
50 | } |
51 | } | |
52 | ||
9447c7ee AM |
53 | private static class GdbTracepointAspect extends TmfEventFieldAspect { |
54 | public GdbTracepointAspect() { | |
55 | super(GdbTraceEventContent.TRACEPOINT, | |
56 | GdbTraceEventContent.TRACEPOINT); | |
99d7adc6 AM |
57 | } |
58 | } | |
59 | ||
9447c7ee | 60 | private static class GdbFileAspect implements ITmfEventAspect { |
99d7adc6 | 61 | |
9447c7ee AM |
62 | @Override |
63 | public String getName() { | |
64 | return "File"; //$NON-NLS-1$ | |
65 | } | |
66 | ||
67 | @Override | |
68 | public String getHelpText() { | |
69 | return EMPTY_STRING; | |
99d7adc6 AM |
70 | } |
71 | ||
72 | @Override | |
9447c7ee | 73 | public String resolve(ITmfEvent event) { |
e1de2fd4 AM |
74 | if (!(event instanceof GdbTraceEvent)) { |
75 | return EMPTY_STRING; | |
76 | } | |
77 | String ret = ((GdbTraceEvent) event).getReference(); | |
99d7adc6 AM |
78 | return (ret == null ? EMPTY_STRING : ret); |
79 | } | |
80 | ||
81 | @Override | |
9447c7ee | 82 | public String getFilterId() { |
99d7adc6 AM |
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 | } |