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