2010-11-09 Francois Chouinard <fchouinard@gmail.com> Contribution for Bug315307
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / events / EventsTable.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.lttng.ui.views.events;
14
15 import org.eclipse.linuxtools.lttng.event.LttngEventContent;
16 import org.eclipse.linuxtools.tmf.event.TmfEvent;
17 import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;
18 import org.eclipse.linuxtools.tmf.ui.widgets.ColumnData;
19 import org.eclipse.swt.SWT;
20 import org.eclipse.swt.widgets.Composite;
21
22 public class EventsTable extends TmfEventsTable {
23
24 // ------------------------------------------------------------------------
25 // Table data
26 // ------------------------------------------------------------------------
27
28 // Table column names
29 static private final String TIMESTAMP_COLUMN = Messages.EventsTable_timestampColumn;
30 static private final String SOURCE_COLUMN = Messages.EventsTable_sourceColumn;
31 static private final String TYPE_COLUMN = Messages.EventsTable_typeColumn;
32 static private final String REFERENCE_COLUMN = Messages.EventsTable_referenceColumn;
33 static private final String CONTENT_COLUMN = Messages.EventsTable_contentColumn;
34 static private final String[] COLUMN_NAMES = new String[] {
35 TIMESTAMP_COLUMN,
36 SOURCE_COLUMN,
37 TYPE_COLUMN,
38 REFERENCE_COLUMN,
39 CONTENT_COLUMN
40 };
41
42 static private final ColumnData[] COLUMN_DATA = new ColumnData[] {
43 new ColumnData(COLUMN_NAMES[0], 125, SWT.LEFT),
44 new ColumnData(COLUMN_NAMES[1], 100, SWT.LEFT),
45 new ColumnData(COLUMN_NAMES[2], 200, SWT.LEFT),
46 new ColumnData(COLUMN_NAMES[3], 200, SWT.LEFT),
47 new ColumnData(COLUMN_NAMES[4], 100, SWT.LEFT)
48 };
49
50 // ------------------------------------------------------------------------
51 // Constructor
52 // ------------------------------------------------------------------------
53
54 public EventsTable(Composite parent, int cacheSize) {
55 super(parent, cacheSize, COLUMN_DATA);
56 }
57
58 /**
59 * @param event
60 * @return
61 */
62 @Override
63 protected String[] extractItemFields(TmfEvent event) {
64 String[] fields = new String[0];
65
66 if (event != null) {
67 fields = new String[] {
68 event.getTimestamp().toString(),
69 event.getSource().toString(),
70 event.getType().toString(),
71 event.getReference().toString(),
72 ((LttngEventContent)event.getContent()).toString()
73 };
74 }
75 return fields;
76 }
77
78 }
This page took 0.032707 seconds and 5 git commands to generate.