| 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.ui.viewers.events.columns.TmfEventTableColumn; |
| 19 | |
| 20 | /** |
| 21 | * Column for the timestamps |
| 22 | */ |
| 23 | public final class TmfTimestampColumn extends TmfEventTableColumn { |
| 24 | |
| 25 | @SuppressWarnings("null") |
| 26 | private static final @NonNull String HEADER = Messages.TmfEventsTable_TimestampColumnHeader; |
| 27 | |
| 28 | /** |
| 29 | * Constructor |
| 30 | */ |
| 31 | public TmfTimestampColumn() { |
| 32 | super(HEADER); |
| 33 | } |
| 34 | |
| 35 | @Override |
| 36 | public String getItemString(ITmfEvent event) { |
| 37 | String ret = event.getTimestamp().toString(); |
| 38 | return (ret == null ? EMPTY_STRING : ret); |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | public String getFilterFieldId() { |
| 43 | return ITmfEvent.EVENT_FIELD_TIMESTAMP; |
| 44 | } |
| 45 | } |