~ubuntu-branches/ubuntu/wily/eclipse-linuxtools/wily

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/viewers/events/LTTng2EventsTable.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam, Jakub Adam, tony mancill
  • Date: 2014-10-11 11:44:05 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20141011114405-yazjvxfzzhmi5sgj
Tags: 3.1.0-1
[ Jakub Adam ]
* New upstream release (Closes: #761524).
* Refreshed d/patches.
* Don't build removed feature org.eclipse.linuxtools.tools.launch
  - merged into org.eclipse.linuxtools.profiling.
* Use javac target 1.7.
* Build new feature org.eclipse.linuxtools.dataviewers.feature
  - required by Valgrind integration.
* Build-depend on eclipse-remote-services-api and eclipse-cdt-autotools.
* Bump Standards-Version to 3.9.6.
* Override incompatible-java-bytecode-format - linuxtools needs Java 7.
* Remove unused codeless-jar override.

[ tony mancill ]
* Tweak short package description to make lintian happy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
package org.eclipse.linuxtools.internal.lttng2.kernel.ui.viewers.events;
14
14
 
 
15
import java.util.Collection;
 
16
 
 
17
import org.eclipse.jdt.annotation.NonNull;
15
18
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
16
 
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
17
 
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
18
19
import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;
19
 
import org.eclipse.linuxtools.tmf.ui.widgets.virtualtable.ColumnData;
20
 
import org.eclipse.swt.SWT;
 
20
import org.eclipse.linuxtools.tmf.ui.viewers.events.columns.TmfEventTableColumn;
21
21
import org.eclipse.swt.widgets.Composite;
22
22
 
 
23
import com.google.common.collect.ImmutableList;
 
24
 
23
25
/**
24
26
 * Events table specific for LTTng 2.0 kernel traces
25
27
 */
26
28
public class LTTng2EventsTable extends TmfEventsTable {
27
29
 
28
30
    // ------------------------------------------------------------------------
29
 
    // Table data
 
31
    // Column definition
30
32
    // ------------------------------------------------------------------------
31
33
 
32
 
    // Table column names
33
 
    static private final String TIMESTAMP_COLUMN = Messages.EventsTable_timestampColumn;
34
 
    static private final String CHANNEL_COLUMN = Messages.EventsTable_channelColumn;
35
 
    static private final String TYPE_COLUMN = Messages.EventsTable_typeColumn;
36
 
    static private final String CONTENT_COLUMN = Messages.EventsTable_contentColumn;
37
 
    static private final String[] COLUMN_NAMES = new String[] {
38
 
            TIMESTAMP_COLUMN,
39
 
            CHANNEL_COLUMN,
40
 
            TYPE_COLUMN,
41
 
            CONTENT_COLUMN
42
 
    };
43
 
 
44
 
    static private final ColumnData[] COLUMN_DATA = new ColumnData[] {
45
 
            new ColumnData(COLUMN_NAMES[0], 150, SWT.LEFT),
46
 
            new ColumnData(COLUMN_NAMES[1], 120, SWT.LEFT),
47
 
            new ColumnData(COLUMN_NAMES[2], 200, SWT.LEFT),
48
 
            new ColumnData(COLUMN_NAMES[3], 100, SWT.LEFT)
49
 
    };
 
34
    @SuppressWarnings("null")
 
35
    private static final @NonNull String CHANNEL_HEADER = Messages.EventsTable_channelColumn;
 
36
 
 
37
    private static final Collection<TmfEventTableColumn> LTTNG_COLUMNS =
 
38
            ImmutableList.<TmfEventTableColumn> of(
 
39
                    TmfEventTableColumn.BaseColumns.TIMESTAMP,
 
40
                    new LttngChannelColumn(),
 
41
                    TmfEventTableColumn.BaseColumns.EVENT_TYPE,
 
42
                    TmfEventTableColumn.BaseColumns.CONTENTS);
 
43
 
 
44
    private static class LttngChannelColumn extends TmfEventTableColumn {
 
45
 
 
46
        public LttngChannelColumn() {
 
47
            super(CHANNEL_HEADER);
 
48
        }
 
49
 
 
50
        @Override
 
51
        public String getItemString(ITmfEvent event) {
 
52
            String ret = event.getReference();
 
53
            return (ret == null ? EMPTY_STRING : ret);
 
54
        }
 
55
 
 
56
        @Override
 
57
        public String getFilterFieldId() {
 
58
            return ITmfEvent.EVENT_FIELD_REFERENCE;
 
59
        }
 
60
    }
50
61
 
51
62
    // ------------------------------------------------------------------------
52
63
    // Constructor
61
72
     *            The size of the rows cache
62
73
     */
63
74
    public LTTng2EventsTable(Composite parent, int cacheSize) {
64
 
        super(parent, cacheSize, COLUMN_DATA);
65
 
        fTable.getColumns()[0].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TIMESTAMP);
66
 
        fTable.getColumns()[1].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_REFERENCE);
67
 
        fTable.getColumns()[2].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TYPE);
68
 
        fTable.getColumns()[3].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_CONTENT);
69
 
    }
70
 
 
71
 
    @Override
72
 
    protected ITmfEventField[] extractItemFields(ITmfEvent event) {
73
 
        ITmfEventField[] fields = EMPTY_FIELD_ARRAY;
74
 
        if (event != null) {
75
 
            fields = new TmfEventField[] {
76
 
                     new TmfEventField(ITmfEvent.EVENT_FIELD_TIMESTAMP, event.getTimestamp().toString(), null),
77
 
                     new TmfEventField(ITmfEvent.EVENT_FIELD_REFERENCE, event.getReference(), null),
78
 
                     new TmfEventField(ITmfEvent.EVENT_FIELD_TYPE, event.getType().getName(), null),
79
 
                     new TmfEventField(ITmfEvent.EVENT_FIELD_CONTENT, event.getContent().toString(), null)
80
 
                    };
81
 
        }
82
 
        return fields;
83
 
    }
84
 
 
 
75
        super(parent, cacheSize, LTTNG_COLUMNS);
 
76
    }
85
77
}