Commit | Line | Data |
---|---|---|
baafe54c 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 | ||
13 | package org.eclipse.linuxtools.internal.tmf.ui.viewers.events.columns; | |
14 | ||
15 | import org.eclipse.jdt.annotation.NonNull; | |
16 | import org.eclipse.linuxtools.internal.tmf.ui.Messages; | |
17 | import org.eclipse.linuxtools.tmf.core.event.ITmfEvent; | |
18 | import org.eclipse.linuxtools.tmf.core.event.ITmfEventType; | |
19 | import org.eclipse.linuxtools.tmf.ui.viewers.events.columns.TmfEventTableColumn; | |
20 | ||
21 | /** | |
22 | * Column for the event type | |
23 | */ | |
24 | public final class TmfTypeColumn extends TmfEventTableColumn { | |
25 | ||
26 | @SuppressWarnings("null") | |
27 | private static final @NonNull String HEADER = Messages.TmfEventsTable_TypeColumnHeader; | |
28 | ||
29 | /** | |
30 | * Constructor | |
31 | */ | |
32 | public TmfTypeColumn() { | |
33 | super(HEADER); | |
34 | } | |
35 | ||
36 | @Override | |
37 | public String getItemString(ITmfEvent event) { | |
38 | ITmfEventType type = event.getType(); | |
39 | if (type == null) { | |
40 | return EMPTY_STRING; | |
41 | } | |
42 | String typeName = type.getName(); | |
43 | return (typeName == null ? EMPTY_STRING : typeName); | |
44 | } | |
45 | ||
46 | @Override | |
47 | public String getFilterFieldId() { | |
48 | return ITmfEvent.EVENT_FIELD_TYPE; | |
49 | } | |
50 | } |