Update bookmarks file API, link to editor and delete & rename handlers
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / parsers / custom / CustomEventsTable.java
CommitLineData
be222f56
PT
1/*******************************************************************************
2 * Copyright (c) 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 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;
14
15import java.util.LinkedList;
16import java.util.List;
17
18import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTraceDefinition.OutputColumn;
19import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
20import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
21import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;
22import org.eclipse.linuxtools.tmf.ui.widgets.virtualtable.ColumnData;
23import org.eclipse.swt.SWT;
24import org.eclipse.swt.widgets.Composite;
25
26public class CustomEventsTable extends TmfEventsTable {
27
28 private final CustomTraceDefinition fDefinition;
29
30 public CustomEventsTable(CustomTraceDefinition definition, Composite parent, int cacheSize) {
31 super(parent, cacheSize, new ColumnData[0]);
32 fDefinition = definition;
33 createColumnHeaders();
34 }
35
36 protected void createColumnHeaders() {
37 if (fDefinition == null) {
38 return;
39 }
40 List<ColumnData> columnData = new LinkedList<ColumnData>();
41 for (OutputColumn outputColumn : fDefinition.outputs) {
42 ColumnData column = new ColumnData(outputColumn.name, 0, SWT.LEFT);
43 columnData.add(column);
44 }
45 setColumnHeaders(columnData.toArray(new ColumnData[0]));
46 }
47
48 @Override
49 public TmfEventField[] extractItemFields(ITmfEvent event) {
50 if (event instanceof CustomEvent) {
51 TmfEventField[] fields = ((CustomEvent) event).extractItemFields();
52// String[] labels = new String[fields.length];
53// for (int i = 0; i < fields.length; i++) {
54// labels[i] = (String) fields[i].getValue();
55// }
56 return fields;
57 }
58 return new TmfEventField[0];
59 }
60}
This page took 0.027445 seconds and 5 git commands to generate.