tmf: Use TmfFilterMatchesAspectNode's in the event table
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.pcap.core / src / org / eclipse / tracecompass / internal / tmf / pcap / core / event / aspect / PcapProtocolAspect.java
CommitLineData
b04903a2
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 * Vincent Perot - Initial API and implementation
11 * Alexandre Montplaisir - Update to new ITmfEventAspect API
12 *******************************************************************************/
13
14package org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect;
15
5db5a3a4
AM
16import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
17
b04903a2
AM
18import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent;
19import org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol;
20import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
21import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
22
23/**
24 * The "packet protocol" aspect for pcap events
25 *
26 * @author Alexandre Montplaisir
27 */
28public class PcapProtocolAspect implements ITmfEventAspect {
29
30 @Override
31 public String getName() {
32 return Messages.getMessage(Messages.PcapAspectName_Protocol);
33 }
34
35 @Override
36 public String getHelpText() {
37 return EMPTY_STRING;
38 }
39
40 @Override
41 public String resolve(ITmfEvent event) {
42 if (!(event instanceof PcapEvent)) {
43 return EMPTY_STRING;
44 }
45 PcapEvent pcapEvent = (PcapEvent) event;
46 TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
47
5db5a3a4 48 return checkNotNull(protocol.getShortName().toUpperCase());
b04903a2 49 }
b04903a2 50}
This page took 0.027286 seconds and 5 git commands to generate.