Quick fix for synchronization of the Events View
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / events / EventsView.java
CommitLineData
6e512b93 1/*******************************************************************************
8035003b 2 * Copyright (c) 2009 Ericsson
6e512b93
ASL
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
13package org.eclipse.linuxtools.lttng.ui.views.events;
14
6e512b93
ASL
15import org.eclipse.linuxtools.tmf.event.TmfEvent;
16import org.eclipse.linuxtools.tmf.ui.views.TmfEventsView;
17import org.eclipse.swt.SWT;
d15fd570
FC
18import org.eclipse.swt.events.SelectionEvent;
19import org.eclipse.swt.events.SelectionListener;
6e512b93
ASL
20import org.eclipse.swt.widgets.Table;
21import org.eclipse.swt.widgets.TableColumn;
22
23/**
24 * <b><u>EventsView</u></b>
25 * <p>
26 * TODO: Implement me. Please.
27 */
28public class EventsView extends TmfEventsView {
29
62d1696a 30 public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.events";
6e512b93 31
8035003b 32 // ========================================================================
6e512b93 33 // Table data
8035003b 34 // ========================================================================
6e512b93
ASL
35
36 // Table column names
37 private final String TIMESTAMP_COLUMN = "Timestamp";
38 private final String SOURCE_COLUMN = "Source";
39 private final String TYPE_COLUMN = "Type";
40 private final String REFERENCE_COLUMN = "Reference";
41 private final String CONTENT_COLUMN = "Content";
42 private final String[] columnProperties = new String[] {
43 TIMESTAMP_COLUMN,
44 SOURCE_COLUMN,
45 TYPE_COLUMN,
46 REFERENCE_COLUMN,
47 CONTENT_COLUMN
48 };
49
50 // Column data
51 private class ColumnData {
52 public final String header;
53 public final int width;
54 public final int alignment;
55
56 public ColumnData(String h, int w, int a) {
57 header = h;
58 width = w;
59 alignment = a;
60 }
61 };
62
63 private ColumnData[] columnData = new ColumnData[] {
8035003b 64 new ColumnData(columnProperties[0], 100, SWT.LEFT),
6e512b93 65 new ColumnData(columnProperties[1], 100, SWT.LEFT),
8035003b
ASL
66 new ColumnData(columnProperties[2], 100, SWT.LEFT),
67 new ColumnData(columnProperties[3], 100, SWT.LEFT),
6e512b93
ASL
68 new ColumnData(columnProperties[4], 100, SWT.LEFT)
69 };
70
8035003b 71 // ========================================================================
6e512b93 72 // Constructor
8035003b 73 // ========================================================================
6e512b93
ASL
74
75 public EventsView() {
6e512b93
ASL
76 }
77
d15fd570
FC
78 /**
79 * @param table
80 *
81 * FIXME: Add support for column selection
82 */
83 @Override
8035003b 84 protected void setColumnHeaders(Table table) {
6e512b93 85 for (int i = 0; i < columnData.length; i++) {
d15fd570 86 final TableColumn column = new TableColumn(table, columnData[i].alignment, i);
6e512b93
ASL
87 column.setText(columnData[i].header);
88 column.setWidth(columnData[i].width);
d15fd570
FC
89 // TODO: Investigate why the column resizing doesn't work by default
90 // Anything to do with SWT_VIRTUAL?
91 column.addSelectionListener(new SelectionListener() {
92 public void widgetDefaultSelected(SelectionEvent e) {
93 // TODO Auto-generated method stub
94 }
95 public void widgetSelected(SelectionEvent e) {
96 column.pack();
97 }
98 });
6e512b93 99 }
d15fd570 100 }
6e512b93
ASL
101
102 /**
103 * @param event
104 * @return
105 */
106 @Override
107 protected String[] extractItemFields(TmfEvent event) {
108 String[] fields = new String[0];
6e512b93
ASL
109 if (event != null) {
110 fields = new String[] {
111 event.getTimestamp().toString(),
112 event.getSource().toString(),
113 event.getType().toString(),
114 event.getReference().toString(),
8b29a712 115 event.getContent().getContent() };
6e512b93
ASL
116 }
117 return fields;
118 }
119
8d2e2848
FC
120 /* (non-Javadoc)
121 * @see java.lang.Object#toString()
122 */
123 @Override
124 public String toString() {
125 return "[EventsView]";
126 }
127
128
6e512b93 129}
This page took 0.030597 seconds and 5 git commands to generate.