tmf: Remove the ITmfEventTableColumns extension point
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.pcap.core / src / org / eclipse / tracecompass / internal / tmf / pcap / core / event / aspect / PcapSourceAspect.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 * Vincent Perot - Initial API and implementation
11 * Alexandre Montplaisir - Update to new ITmfEventAspect API
12 *******************************************************************************/
13
14 package org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect;
15
16 import org.eclipse.jdt.annotation.NonNull;
17 import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent;
18 import org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol;
19 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
20 import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
21
22 /**
23 * The packet source aspect for pcap events.
24 *
25 * This normally represents the source address of the packet, and the format
26 * depends on the protocol (e.g. source IP address, source port, etc.)
27 *
28 * @author Alexandre Montplaisir
29 */
30 public class PcapSourceAspect implements ITmfEventAspect {
31
32 @Override
33 public String getName() {
34 return Messages.getMessage(Messages.PcapAspectName_Source);
35 }
36
37 @Override
38 public String getHelpText() {
39 return EMPTY_STRING;
40 }
41
42 @Override
43 public String resolve(ITmfEvent event) {
44 if (!(event instanceof PcapEvent)) {
45 return EMPTY_STRING;
46 }
47 PcapEvent pcapEvent = (PcapEvent) event;
48 TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
49
50 String ret = pcapEvent.getSourceEndpoint(protocol);
51 return (ret == null ? EMPTY_STRING : ret);
52 }
53
54 @Override
55 public @NonNull String getFilterId() {
56 return PcapEvent.EVENT_FIELD_PACKET_SOURCE;
57 }
58 }
This page took 0.038373 seconds and 5 git commands to generate.