--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Khouzam - Initial API and implementation
+ * Alexandre Montplaisir - Update to new Event Table API
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.btf.core.trace;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.btf.core.event.BtfEvent;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfEventFieldAspect;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Columns to use in the BTF event table
+ *
+ * @author Alexandre Montplaisir
+ */
+public final class BtfEventAspects {
+
+ private BtfEventAspects() {}
+
+ @SuppressWarnings("null")
+ private static final @NonNull Iterable<ITmfEventAspect> BTF_ASPECTS = ImmutableList.of(
+ ITmfEventAspect.BaseAspects.TIMESTAMP,
+ new BtfSourceAspect(),
+ new BtfSourceInstanceAspect(),
+ ITmfEventAspect.BaseAspects.EVENT_TYPE,
+ new BtfTargetAspect(),
+ new BtfTargetInstanceAspect(),
+ new BtfEventAspect(),
+ new BtfNotesAspect()
+ );
+
+ /**
+ * The "source" aspect, whose value comes from {@link ITmfEvent#getSource()}
+ */
+ private static class BtfSourceAspect implements ITmfEventAspect {
+
+ @Override
+ public String getName() {
+ return BtfColumnNames.SOURCE.toString();
+ }
+
+ @Override
+ public String getHelpText() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String resolve(ITmfEvent event) {
+ if (!(event instanceof BtfEvent)) {
+ return EMPTY_STRING;
+ }
+ String ret = ((BtfEvent) event).getSource();
+ return (ret == null ? EMPTY_STRING : ret);
+ }
+
+ @Override
+ public String getFilterId() {
+ return ITmfEvent.EVENT_FIELD_SOURCE;
+ }
+ }
+
+ /**
+ * The "source instance" aspect, whose value comes from the field of the
+ * same name.
+ */
+ private static class BtfSourceInstanceAspect extends TmfEventFieldAspect {
+ public BtfSourceInstanceAspect() {
+ super(BtfColumnNames.SOURCE_INSTANCE.toString(),
+ BtfColumnNames.SOURCE_INSTANCE.toString());
+ }
+ }
+
+ /**
+ * The "target" aspect, taking its value from
+ * {@link ITmfEvent#getReference()}.
+ */
+ private static class BtfTargetAspect implements ITmfEventAspect {
+
+ @Override
+ public String getName() {
+ return BtfColumnNames.TARGET.toString();
+ }
+
+ @Override
+ public String getHelpText() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String resolve(ITmfEvent event) {
+ if (!(event instanceof BtfEvent)) {
+ return EMPTY_STRING;
+ }
+ String ret = ((BtfEvent) event).getReference();
+ return (ret == null ? EMPTY_STRING : ret);
+ }
+
+ @Override
+ public String getFilterId() {
+ return ITmfEvent.EVENT_FIELD_REFERENCE;
+ }
+ }
+
+ /**
+ * The "target instance" aspect, whose value comes from the field of the
+ * same name.
+ */
+ private static class BtfTargetInstanceAspect extends TmfEventFieldAspect {
+ public BtfTargetInstanceAspect() {
+ super(BtfColumnNames.TARGET_INSTANCE.toString(),
+ BtfColumnNames.TARGET_INSTANCE.toString());
+ }
+ }
+
+ /**
+ * The "event" aspect, whose value comes from the field of the same name.
+ */
+ private static class BtfEventAspect extends TmfEventFieldAspect {
+ public BtfEventAspect() {
+ super(BtfColumnNames.EVENT.toString(),
+ BtfColumnNames.EVENT.toString());
+ }
+ }
+
+ /**
+ * The "notes" column, whose value comes from the field of the same name, if
+ * present.
+ */
+ private static class BtfNotesAspect extends TmfEventFieldAspect {
+ public BtfNotesAspect() {
+ super(BtfColumnNames.NOTES.toString(),
+ BtfColumnNames.NOTES.toString());
+ }
+ }
+
+ /**
+ * Return the event aspects defined for BTF traces.
+ *
+ * @return The aspects
+ */
+ public static Iterable<ITmfEventAspect> getAspects() {
+ return BTF_ASPECTS;
+ }
+}
\ No newline at end of file
import org.eclipse.tracecompass.btf.core.event.BtfEventType;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.io.BufferedRandomAccessFile;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceContext;
return ImmutableMap.copyOf(fProperties);
}
+ @Override
+ public Iterable<ITmfEventAspect> getEventAspects() {
+ return BtfEventAspects.getAspects();
+ }
+
@Override
public void close() throws IOException {
if (fFileInput != null) {
plugin.properties,\
plugin.xml,\
about.html,\
- .,\
- plugin.xml
+ .
src.includes = about.html
additional.bundles = org.eclipse.jdt.annotation
jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
<type
icon="icons/btf.png"
tracetype="org.eclipse.linuxtools.btf.trace">
- <eventTableColumns
- class="org.eclipse.tracecompass.btf.ui.BtfEventTableColumns">
- </eventTableColumns>
</type>
</extension>
</plugin>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- * Alexandre Montplaisir - Update to new Event Table API
- *******************************************************************************/
-
-package org.eclipse.tracecompass.btf.ui;
-
-import java.util.Collection;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.btf.core.event.BtfEvent;
-import org.eclipse.tracecompass.btf.core.trace.BtfColumnNames;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.core.event.aspect.TmfEventFieldAspect;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.ITmfEventTableColumns;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Columns to use in the BTF event table
- *
- * @author Alexandre Montplaisir
- */
-public class BtfEventTableColumns implements ITmfEventTableColumns {
-
- // ------------------------------------------------------------------------
- // Column definition
- // ------------------------------------------------------------------------
-
- @SuppressWarnings("null")
- private static final @NonNull Collection<TmfEventTableColumn> BTF_COLUMNS = ImmutableList.of(
- new TmfEventTableColumn(ITmfEventAspect.BaseAspects.TIMESTAMP),
- new TmfEventTableColumn(new BtfSourceAspect()),
- new TmfEventTableColumn(new BtfSourceInstanceAspect()),
- new TmfEventTableColumn(ITmfEventAspect.BaseAspects.EVENT_TYPE),
- new TmfEventTableColumn(new BtfTargetAspect()),
- new TmfEventTableColumn(new BtfTargetInstanceAspect()),
- new TmfEventTableColumn(new BtfEventAspect()),
- new TmfEventTableColumn(new BtfNotesAspect())
- );
-
- /**
- * The "source" aspect, whose value comes from {@link ITmfEvent#getSource()}
- */
- private static class BtfSourceAspect implements ITmfEventAspect {
-
- @Override
- public String getName() {
- return BtfColumnNames.SOURCE.toString();
- }
-
- @Override
- public String getHelpText() {
- return EMPTY_STRING;
- }
-
- @Override
- public String resolve(ITmfEvent event) {
- if (!(event instanceof BtfEvent)) {
- return EMPTY_STRING;
- }
- String ret = ((BtfEvent) event).getSource();
- return (ret == null ? EMPTY_STRING : ret);
- }
-
- @Override
- public String getFilterId() {
- return ITmfEvent.EVENT_FIELD_SOURCE;
- }
- }
-
- /**
- * The "source instance" aspect, whose value comes from the field of the
- * same name.
- */
- private static class BtfSourceInstanceAspect extends TmfEventFieldAspect {
- public BtfSourceInstanceAspect() {
- super(BtfColumnNames.SOURCE_INSTANCE.toString(),
- BtfColumnNames.SOURCE_INSTANCE.toString());
- }
- }
-
- /**
- * The "target" aspect, taking its value from
- * {@link ITmfEvent#getReference()}.
- */
- private static class BtfTargetAspect implements ITmfEventAspect {
-
- @Override
- public String getName() {
- return BtfColumnNames.TARGET.toString();
- }
-
- @Override
- public String getHelpText() {
- return EMPTY_STRING;
- }
-
- @Override
- public String resolve(ITmfEvent event) {
- if (!(event instanceof BtfEvent)) {
- return EMPTY_STRING;
- }
- String ret = ((BtfEvent) event).getReference();
- return (ret == null ? EMPTY_STRING : ret);
- }
-
- @Override
- public String getFilterId() {
- return ITmfEvent.EVENT_FIELD_REFERENCE;
- }
- }
-
- /**
- * The "target instance" aspect, whose value comes from the field of the
- * same name.
- */
- private static class BtfTargetInstanceAspect extends TmfEventFieldAspect {
- public BtfTargetInstanceAspect() {
- super(BtfColumnNames.TARGET_INSTANCE.toString(),
- BtfColumnNames.TARGET_INSTANCE.toString());
- }
- }
-
- /**
- * The "event" aspect, whose value comes from the field of the same name.
- */
- private static class BtfEventAspect extends TmfEventFieldAspect {
- public BtfEventAspect() {
- super(BtfColumnNames.EVENT.toString(),
- BtfColumnNames.EVENT.toString());
- }
- }
-
- /**
- * The "notes" column, whose value comes from the field of the same name, if
- * present.
- */
- private static class BtfNotesAspect extends TmfEventFieldAspect {
- public BtfNotesAspect() {
- super(BtfColumnNames.NOTES.toString(),
- BtfColumnNames.NOTES.toString());
- }
- }
-
- // ------------------------------------------------------------------------
- // ITmfEventTableColumns
- // ------------------------------------------------------------------------
-
- @Override
- public Collection<? extends TmfEventTableColumn> getEventTableColumns() {
- return BTF_COLUMNS;
- }
-}
\ No newline at end of file
Export-Package: org.eclipse.tracecompass.internal.gdbtrace.core;x-friends:="org.eclipse.tracecompass.gdbtrace.core.tests",
org.eclipse.tracecompass.internal.gdbtrace.core.event;x-friends:="org.eclipse.tracecompass.gdbtrace.ui",
org.eclipse.tracecompass.internal.gdbtrace.core.trace;x-friends:="org.eclipse.tracecompass.gdbtrace.ui"
+Import-Package: com.google.common.collect
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.gdbtrace.core.trace;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent;
+import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfEventFieldAspect;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Event table column definition for GDB traces.
+ *
+ * @author Alexandre Montplaisir
+ */
+public final class GdbEventAspects {
+
+ private GdbEventAspects() {}
+
+ @SuppressWarnings("null")
+ private static final @NonNull Iterable<ITmfEventAspect> GDB_ASPECTS = ImmutableList.of(
+ new GdbTraceFrameAspect(),
+ new GdbTracepointAspect(),
+ new GdbFileAspect()
+ );
+
+ private static class GdbTraceFrameAspect extends TmfEventFieldAspect {
+ public GdbTraceFrameAspect() {
+ super(GdbTraceEventContent.TRACE_FRAME,
+ GdbTraceEventContent.TRACE_FRAME);
+ }
+ }
+
+ private static class GdbTracepointAspect extends TmfEventFieldAspect {
+ public GdbTracepointAspect() {
+ super(GdbTraceEventContent.TRACEPOINT,
+ GdbTraceEventContent.TRACEPOINT);
+ }
+ }
+
+ private static class GdbFileAspect implements ITmfEventAspect {
+
+ @Override
+ public String getName() {
+ return "File"; //$NON-NLS-1$
+ }
+
+ @Override
+ public String getHelpText() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String resolve(ITmfEvent event) {
+ if (!(event instanceof GdbTraceEvent)) {
+ return EMPTY_STRING;
+ }
+ String ret = ((GdbTraceEvent) event).getReference();
+ return (ret == null ? EMPTY_STRING : ret);
+ }
+
+ @Override
+ public String getFilterId() {
+ return ITmfEvent.EVENT_FIELD_REFERENCE;
+ }
+ }
+
+ /**
+ * Get the event aspects specific to GDB traces.
+ *
+ * @return The set of aspects
+ */
+ public static Iterable<ITmfEventAspect> getAspects() {
+ return GDB_ASPECTS;
+ }
+}
import org.eclipse.tracecompass.internal.gdbtrace.core.GdbTraceCorePlugin;
import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
// TmfTrace
// ------------------------------------------------------------------------
+ @Override
+ public Iterable<ITmfEventAspect> getEventAspects() {
+ return GdbEventAspects.getAspects();
+ }
+
@Override
public synchronized TmfContext seekEvent(ITmfLocation location) {
fLocation = (location != null) ? ((Long) location.getLocationInfo()) : 0;
<eventsTableType
class="org.eclipse.tracecompass.internal.gdbtrace.ui.views.events.GdbEventsTable">
</eventsTableType>
- <eventTableColumns
- class="org.eclipse.tracecompass.internal.gdbtrace.ui.views.events.GdbEventTableColumns">
- </eventTableColumns>
</type>
</extension>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.gdbtrace.ui.views.events;
-
-import java.util.Collection;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent;
-import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.core.event.aspect.TmfEventFieldAspect;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.ITmfEventTableColumns;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Event table column definition for GDB traces.
- *
- * @author Alexandre Montplaisir
- */
-public class GdbEventTableColumns implements ITmfEventTableColumns {
-
- // ------------------------------------------------------------------------
- // Column definition
- // ------------------------------------------------------------------------
-
- @SuppressWarnings("null")
- static final @NonNull Collection<TmfEventTableColumn> GDB_COLUMNS = ImmutableList.of(
- new TmfEventTableColumn(new GdbTraceFrameAspect()),
- new TmfEventTableColumn(new GdbTracepointAspect()),
- new TmfEventTableColumn(new GdbFileAspect())
- );
-
- private static class GdbTraceFrameAspect extends TmfEventFieldAspect {
- public GdbTraceFrameAspect() {
- super(GdbTraceEventContent.TRACE_FRAME,
- GdbTraceEventContent.TRACE_FRAME);
- }
- }
-
- private static class GdbTracepointAspect extends TmfEventFieldAspect {
- public GdbTracepointAspect() {
- super(GdbTraceEventContent.TRACEPOINT,
- GdbTraceEventContent.TRACEPOINT);
- }
- }
-
- private static class GdbFileAspect implements ITmfEventAspect {
-
- @Override
- public String getName() {
- return "File"; //$NON-NLS-1$
- }
-
- @Override
- public String getHelpText() {
- return EMPTY_STRING;
- }
-
- @Override
- public String resolve(ITmfEvent event) {
- if (!(event instanceof GdbTraceEvent)) {
- return EMPTY_STRING;
- }
- String ret = ((GdbTraceEvent) event).getReference();
- return (ret == null ? EMPTY_STRING : ret);
- }
-
- @Override
- public String getFilterId() {
- return ITmfEvent.EVENT_FIELD_REFERENCE;
- }
- }
-
- // ------------------------------------------------------------------------
- // ITmfEventTableColumns
- // ------------------------------------------------------------------------
-
- @Override
- public Collection<? extends TmfEventTableColumn> getEventTableColumns() {
- return GDB_COLUMNS;
- }
-}
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent;
import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent;
+import org.eclipse.tracecompass.internal.gdbtrace.core.trace.GdbEventAspects;
import org.eclipse.tracecompass.internal.gdbtrace.core.trace.GdbTrace;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
import org.eclipse.tracecompass.tmf.core.signal.TmfTimeSynchSignal;
* the cache size
*/
public GdbEventsTable(Composite parent, int cacheSize) {
- super(parent, cacheSize, GdbEventTableColumns.GDB_COLUMNS);
+ super(parent, cacheSize, GdbEventAspects.getAspects());
// Set the alignment of the first two columns
fTable.getColumns()[0].setAlignment(SWT.RIGHT);
fTable.getColumns()[1].setAlignment(SWT.RIGHT);
org.eclipse.tracecompass.tmf.ctf.core,
org.eclipse.tracecompass.lttng2.control.core
Export-Package: org.eclipse.tracecompass.internal.lttng2.kernel.core;x-friends:="org.eclipse.tracecompass.lttng2.kernel.ui,org.eclipse.tracecompass.lttng2.kernel.core.tests",
+ org.eclipse.tracecompass.internal.lttng2.kernel.core.event.aspect;x-internal:=true,
org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout;x-friends:="org.eclipse.tracecompass.lttng2.kernel.core.tests,org.eclipse.tracecompass.lttng2.kernel.ui",
org.eclipse.tracecompass.lttng2.kernel.core.analysis.cpuusage,
org.eclipse.tracecompass.lttng2.kernel.core.analysis.kernel,
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.kernel.core.event.aspect;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Event aspects for LTTng kernel traces.
+ *
+ * @author Alexandre Montplaisir
+ */
+public final class LttngEventAspects {
+
+ private LttngEventAspects() {}
+
+ @SuppressWarnings("null")
+ private static final @NonNull Iterable<ITmfEventAspect> LTTNG_ASPECTS =
+ ImmutableList.of(
+ ITmfEventAspect.BaseAspects.TIMESTAMP,
+ new LttngChannelAspect(),
+ ITmfEventAspect.BaseAspects.EVENT_TYPE,
+ ITmfEventAspect.BaseAspects.CONTENTS);
+
+ private static class LttngChannelAspect implements ITmfEventAspect {
+
+ @Override
+ public String getName() {
+ String ret = Messages.AspectName_Channel;
+ return (ret == null ? EMPTY_STRING : ret);
+ }
+
+ @Override
+ public String getHelpText() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String resolve(ITmfEvent event) {
+ if (!(event instanceof CtfTmfEvent)) {
+ return EMPTY_STRING;
+ }
+ String ret = ((CtfTmfEvent) event).getReference();
+ return (ret == null ? EMPTY_STRING : ret);
+ }
+
+ @Override
+ public String getFilterId() {
+ return ITmfEvent.EVENT_FIELD_REFERENCE;
+ }
+ }
+
+ /**
+ * Get the event aspects defined for LTTng kernel traces.
+ *
+ * @return The set of aspects
+ */
+ public static Iterable<ITmfEventAspect> getAspects() {
+ return LTTNG_ASPECTS;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tassé - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.lttng2.kernel.core.event.aspect;
+
+import org.eclipse.osgi.util.NLS;
+
+@SuppressWarnings("javadoc")
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME =
+ "org.eclipse.tracecompass.internal.lttng2.kernel.core.event.aspect.messages"; //$NON-NLS-1$
+
+ public static String AspectName_Channel;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2014 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+AspectName_Channel=Channel
import org.eclipse.tracecompass.ctf.core.trace.CTFReaderException;
import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.Activator;
+import org.eclipse.tracecompass.internal.lttng2.kernel.core.event.aspect.LttngEventAspects;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout.IKernelAnalysisEventLayout;
+import org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout.Lttng26EventLayout;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout.LttngEventLayout;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout.PerfEventLayout;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout.Lttng26EventLayout;
import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
}
}
+ @Override
+ public Iterable<ITmfEventAspect> getEventAspects() {
+ return LttngEventAspects.getAspects();
+ }
+
}
org.eclipse.tracecompass.lttng2.control.ui;bundle-version="0.1.0",
org.eclipse.tracecompass.lttng2.kernel.core;bundle-version="0.1.0"
Export-Package: org.eclipse.tracecompass.internal.lttng2.kernel.ui;x-friends:="org.eclipse.tracecompass.lttng2.kernel.ui.tests",
- org.eclipse.tracecompass.internal.lttng2.kernel.ui.viewers.events;x-internal:=true,
org.eclipse.tracecompass.internal.lttng2.kernel.ui.views;x-friends:="org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests",
org.eclipse.tracecompass.internal.lttng2.kernel.ui.views.controlflow;x-friends:="org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests",
org.eclipse.tracecompass.internal.lttng2.kernel.ui.views.cpuusage;x-friends:="org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests",
<type
icon="icons/obj16/garland16.png"
tracetype="org.eclipse.linuxtools.lttng2.kernel.tracetype">
- <eventTableColumns
- class="org.eclipse.tracecompass.internal.lttng2.kernel.ui.viewers.events.LttngEventTableColumns">
- </eventTableColumns>
</type>
</extension>
</plugin>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.kernel.ui.viewers.events;
-
-import java.util.Collection;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.ITmfEventTableColumns;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Event table columns for LTTng 2.x kernel traces
- */
-public class LttngEventTableColumns implements ITmfEventTableColumns {
-
- // ------------------------------------------------------------------------
- // Column definition
- // ------------------------------------------------------------------------
-
- @SuppressWarnings("null")
- private static final @NonNull String CHANNEL_HEADER = Messages.EventsTable_channelColumn;
-
- @SuppressWarnings("null")
- private static final @NonNull Collection<TmfEventTableColumn> LTTNG_COLUMNS =
- ImmutableList.<TmfEventTableColumn> of(
- new TmfEventTableColumn(ITmfEventAspect.BaseAspects.TIMESTAMP),
- new TmfEventTableColumn(new LttngChannelAspect()),
- new TmfEventTableColumn(ITmfEventAspect.BaseAspects.EVENT_TYPE),
- new TmfEventTableColumn(ITmfEventAspect.BaseAspects.CONTENTS));
-
- private static class LttngChannelAspect implements ITmfEventAspect {
-
- @Override
- public String getName() {
- return CHANNEL_HEADER;
- }
-
- @Override
- public String getHelpText() {
- return EMPTY_STRING;
- }
-
- @Override
- public String resolve(ITmfEvent event) {
- if (!(event instanceof CtfTmfEvent)) {
- return EMPTY_STRING;
- }
- String ret = ((CtfTmfEvent) event).getReference();
- return (ret == null ? EMPTY_STRING : ret);
- }
-
- @Override
- public String getFilterId() {
- return ITmfEvent.EVENT_FIELD_REFERENCE;
- }
- }
-
- // ------------------------------------------------------------------------
- // Constructor
- // ------------------------------------------------------------------------
-
- @Override
- public Collection<? extends TmfEventTableColumn> getEventTableColumns() {
- return LTTNG_COLUMNS;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tassé - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.lttng2.kernel.ui.viewers.events;
-
-import org.eclipse.osgi.util.NLS;
-
-@SuppressWarnings("javadoc")
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.lttng2.kernel.ui.viewers.events.messages"; //$NON-NLS-1$
- public static String EventsTable_channelColumn;
- public static String EventsTable_timestampColumn;
- public static String EventsTable_typeColumn;
- public static String EventsTable_contentColumn;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013 Ericsson
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-EventsTable_channelColumn=Channel
-EventsTable_timestampColumn=Timestamp
-EventsTable_typeColumn=Event Type
-EventsTable_contentColumn=Content
org.eclipse.tracecompass.internal.tmf.core.analysis;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
org.eclipse.tracecompass.internal.tmf.core.component;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
org.eclipse.tracecompass.internal.tmf.core.filter;x-friends:="org.eclipse.tracecompass.tmf.core.tests,org.eclipse.tracecompass.tmf.ui",
+ org.eclipse.tracecompass.internal.tmf.core.parsers.custom;x-friends:="org.eclipse.tracecompass.tmf.ui",
org.eclipse.tracecompass.internal.tmf.core.request;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
org.eclipse.tracecompass.internal.tmf.core.statesystem.backends.partial;x-friends:="org.eclipse.tracecompass.statesystem.core.tests",
org.eclipse.tracecompass.internal.tmf.core.statesystem.mipmap;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tasse - Initial API and implementation
+ * Alexandre Montplaisir - Update for TmfEventTableColumn
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.core.parsers.custom;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomEvent;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.OutputColumn;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Event aspects for Custom {Text|XML} traces.
+ *
+ * Since this definition will be different for every single custom trace, we
+ * cannot define specific {@link ITmfEventAspect}Â in advance.
+ *
+ * Instead, one has to call {@link #generateAspects(CustomTraceDefinition)}
+ * with the CustomTraceDefinition of the the particular trace to display.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class CustomEventAspects {
+
+ /**
+ * Aspects for custom events, which use an integer ID to represent each
+ * field.
+ */
+ private static final class CustomEventFieldAspect implements ITmfEventAspect {
+
+ private final @NonNull String fName;
+ private final int fIndex;
+
+ /**
+ * Constructor
+ *
+ * @param name
+ * The name of this aspect
+ * @param idx
+ * The index of this field in the event's content to display
+ */
+ public CustomEventFieldAspect(@NonNull String name, int idx) {
+ fName = name;
+ fIndex = idx;
+ }
+
+ @Override
+ public String getName() {
+ return fName;
+ }
+
+ @Override
+ public String getHelpText() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String resolve(ITmfEvent event) {
+ if (event instanceof CustomEvent) {
+ String ret = ((CustomEvent) event).getEventString(fIndex);
+ return (ret == null ? EMPTY_STRING : ret);
+ }
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String getFilterId() {
+ return fName;
+ }
+ }
+
+ /**
+ * Build a set of event aspects for a given trace definition
+ *
+ * @param definition
+ * The {@link CustomTraceDefinition} of the trace for which you
+ * want the aspects
+ * @return The set of event aspects for the given trace
+ */
+ public static Iterable<ITmfEventAspect> generateAspects(CustomTraceDefinition definition) {
+ ImmutableList.Builder<ITmfEventAspect> builder = new ImmutableList.Builder<>();
+ List<OutputColumn> outputs = definition.outputs;
+ for (int i = 0; i < outputs.size(); i++) {
+ String name = outputs.get(i).name;
+ if (name != null) {
+ builder.add(new CustomEventFieldAspect(name, i));
+ }
+ }
+ return builder.build();
+ }
+}
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.tracecompass.internal.tmf.core.Activator;
+import org.eclipse.tracecompass.internal.tmf.core.parsers.custom.CustomEventAspects;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.io.BufferedRandomAccessFile;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition.InputLine;
return super.getIndexer();
}
+ @Override
+ public Iterable<ITmfEventAspect> getEventAspects() {
+ return CustomEventAspects.generateAspects(fDefinition);
+ }
+
@Override
public synchronized TmfContext seekEvent(final ITmfLocation location) {
final CustomTxtTraceContext context = new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.tracecompass.internal.tmf.core.Activator;
+import org.eclipse.tracecompass.internal.tmf.core.parsers.custom.CustomEventAspects;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.io.BufferedRandomAccessFile;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
return super.getIndexer();
}
+ @Override
+ public Iterable<ITmfEventAspect> getEventAspects() {
+ return CustomEventAspects.generateAspects(fDefinition);
+ }
+
@Override
public synchronized TmfContext seekEvent(final ITmfLocation location) {
final CustomXmlTraceContext context = new CustomXmlTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
@NonNull
<T> Iterable<T> getAnalysisModulesOfClass(Class<T> moduleClass);
+ // ------------------------------------------------------------------------
+ // Aspect getters
+ // ------------------------------------------------------------------------
+
+ /**
+ * Return the pre-defined set of event aspects exposed by this trace.
+ *
+ * @return The event aspects for this trace
+ */
+ Iterable<ITmfEventAspect> getEventAspects();
+
// ------------------------------------------------------------------------
// Trace characteristics getters
// ------------------------------------------------------------------------
package org.eclipse.tracecompass.tmf.core.trace;
import java.io.File;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisManager;
import org.eclipse.tracecompass.tmf.core.component.TmfEventProvider;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
+import com.google.common.collect.ImmutableList;
+
/**
* Abstract implementation of ITmfTrace.
* <p>
public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace, ITmfTraceCompleteness {
// ------------------------------------------------------------------------
- // Attributes
+ // Class attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * Basic aspects that should be valid for all trace types.
+ */
+ public static final Collection<ITmfEventAspect> BASE_ASPECTS =
+ ImmutableList.of(
+ ITmfEventAspect.BaseAspects.TIMESTAMP,
+ ITmfEventAspect.BaseAspects.EVENT_TYPE,
+ ITmfEventAspect.BaseAspects.CONTENTS
+ );
+
+ // ------------------------------------------------------------------------
+ // Instance attributes
// ------------------------------------------------------------------------
// The resource used for persistent properties for this trace
return modules;
}
+ @Override
+ public Iterable<ITmfEventAspect> getEventAspects() {
+ /* By default we provide only the base aspects valid for all trace types */
+ return BASE_ASPECTS;
+ }
+
/**
* Clears the trace
*/
Export-Package: org.eclipse.tracecompass.internal.tmf.pcap.core;x-internal:=true,
org.eclipse.tracecompass.internal.tmf.pcap.core.analysis;x-friends:="org.eclipse.tracecompass.tmf.pcap.core.tests,org.eclipse.tracecompass.tmf.pcap.ui",
org.eclipse.tracecompass.internal.tmf.pcap.core.event;x-friends:="org.eclipse.tracecompass.tmf.pcap.core.tests,org.eclipse.tracecompass.tmf.pcap.ui",
+ org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect;x-internal:=true,
org.eclipse.tracecompass.internal.tmf.pcap.core.protocol;x-friends:="org.eclipse.tracecompass.tmf.pcap.core.tests,org.eclipse.tracecompass.tmf.pcap.ui",
org.eclipse.tracecompass.internal.tmf.pcap.core.signal;x-friends:="org.eclipse.tracecompass.tmf.pcap.ui",
org.eclipse.tracecompass.internal.tmf.pcap.core.trace;x-friends:="org.eclipse.tracecompass.tmf.pcap.core.tests,org.eclipse.tracecompass.tmf.pcap.ui,org.eclipse.tracecompass.tmf.pcap.ui.swtbot.tests",
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Perot - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.osgi.util.NLS;
+
+@SuppressWarnings("javadoc")
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME =
+ "org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect.messages"; //$NON-NLS-1$
+
+ public static @Nullable String PcapAspectName_Destination;
+ public static @Nullable String PcapAspectName_Protocol;
+ public static @Nullable String PcapAspectName_Reference;
+ public static @Nullable String PcapAspectName_Source;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+
+ /**
+ * Helper method to expose externalized strings as non-null objects.
+ */
+ static String getMessage(@Nullable String msg) {
+ if (msg == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return msg;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Perot - Initial API and implementation
+ * Alexandre Montplaisir - Update to new ITmfEventAspect API
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+
+/**
+ * The "packet destination" aspect for pcap events.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class PcapDestinationAspect implements ITmfEventAspect {
+
+ @Override
+ public String getName() {
+ return Messages.getMessage(Messages.PcapAspectName_Destination);
+ }
+
+ @Override
+ public String getHelpText() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String resolve(ITmfEvent event) {
+ if (!(event instanceof PcapEvent)) {
+ return EMPTY_STRING;
+ }
+ PcapEvent pcapEvent = (PcapEvent) event;
+ TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
+
+ String ret = pcapEvent.getDestinationEndpoint(protocol);
+ return (ret == null ? EMPTY_STRING : ret);
+ }
+
+ @Override
+ public @NonNull String getFilterId() {
+ return PcapEvent.EVENT_FIELD_PACKET_DESTINATION;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Perot - Initial API and implementation
+ * Alexandre Montplaisir - Update to new ITmfEventAspect API
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+
+/**
+ * The "packet protocol" aspect for pcap events
+ *
+ * @author Alexandre Montplaisir
+ */
+public class PcapProtocolAspect implements ITmfEventAspect {
+
+ @Override
+ public String getName() {
+ return Messages.getMessage(Messages.PcapAspectName_Protocol);
+ }
+
+ @Override
+ public String getHelpText() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String resolve(ITmfEvent event) {
+ if (!(event instanceof PcapEvent)) {
+ return EMPTY_STRING;
+ }
+ PcapEvent pcapEvent = (PcapEvent) event;
+ TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
+
+ @SuppressWarnings("null")
+ @NonNull String proto = protocol.getShortName().toUpperCase();
+ return proto;
+ }
+
+ @Override
+ public @Nullable String getFilterId() {
+ return PcapEvent.EVENT_FIELD_PACKET_PROTOCOL;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Perot - Initial API and implementation
+ * Alexandre Montplaisir - Update to new ITmfEventAspect API
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+
+/**
+ * The "packet reference" aspect for pcap events
+ *
+ * @author Alexandre Montplaisir
+ */
+public class PcapReferenceAspect implements ITmfEventAspect {
+
+ @Override
+ public String getName() {
+ return Messages.getMessage(Messages.PcapAspectName_Reference);
+ }
+
+ @Override
+ public String getHelpText() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String resolve(ITmfEvent event) {
+ if (!(event instanceof PcapEvent)) {
+ return EMPTY_STRING;
+ }
+ return ((PcapEvent) event).getReference();
+ }
+
+ @Override
+ public @Nullable String getFilterId() {
+ return ITmfEvent.EVENT_FIELD_REFERENCE;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Perot - Initial API and implementation
+ * Alexandre Montplaisir - Update to new ITmfEventAspect API
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+
+/**
+ * The packet source aspect for pcap events.
+ *
+ * This normally represents the source address of the packet, and the format
+ * depends on the protocol (e.g. source IP address, source port, etc.)
+ *
+ * @author Alexandre Montplaisir
+ */
+public class PcapSourceAspect implements ITmfEventAspect {
+
+ @Override
+ public String getName() {
+ return Messages.getMessage(Messages.PcapAspectName_Source);
+ }
+
+ @Override
+ public String getHelpText() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String resolve(ITmfEvent event) {
+ if (!(event instanceof PcapEvent)) {
+ return EMPTY_STRING;
+ }
+ PcapEvent pcapEvent = (PcapEvent) event;
+ TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
+
+ String ret = pcapEvent.getSourceEndpoint(protocol);
+ return (ret == null ? EMPTY_STRING : ret);
+ }
+
+ @Override
+ public @NonNull String getFilterId() {
+ return PcapEvent.EVENT_FIELD_PACKET_SOURCE;
+ }
+}
\ No newline at end of file
--- /dev/null
+###############################################################################
+# Copyright (c) 2014 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+PcapAspectName_Destination=Destination
+PcapAspectName_Protocol=Protocol
+PcapAspectName_Reference=Reference
+PcapAspectName_Source=Source
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ericsson - Initial API and implementation
+ *******************************************************************************/
+
+@org.eclipse.jdt.annotation.NonNullByDefault
+package org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect;
\ No newline at end of file
import java.nio.channels.ClosedChannelException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
+import java.util.Collection;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.tracecompass.internal.pcap.core.util.LinkTypeHelper;
import org.eclipse.tracecompass.internal.tmf.pcap.core.Activator;
import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect.PcapDestinationAspect;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect.PcapProtocolAspect;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect.PcapReferenceAspect;
+import org.eclipse.tracecompass.internal.tmf.pcap.core.event.aspect.PcapSourceAspect;
import org.eclipse.tracecompass.internal.tmf.pcap.core.util.PcapEventFactory;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
import org.eclipse.tracecompass.tmf.core.trace.ITmfEventParser;
import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
import org.eclipse.tracecompass.tmf.core.trace.location.TmfLongLocation;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
/**
*/
public class PcapTrace extends TmfTrace implements ITmfEventParser, ITmfTraceProperties, AutoCloseable {
+ @SuppressWarnings("null")
+ private static final @NonNull Collection<ITmfEventAspect> PCAP_ASPECTS = ImmutableList.of(
+ ITmfEventAspect.BaseAspects.TIMESTAMP,
+ new PcapSourceAspect(),
+ new PcapDestinationAspect(),
+ new PcapReferenceAspect(),
+ new PcapProtocolAspect(),
+ ITmfEventAspect.BaseAspects.CONTENTS
+ );
+
@SuppressWarnings("null")
private static final @NonNull Map<String, String> EMPTY_MAP = ImmutableMap.of();
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
}
}
+ @Override
+ public Iterable<ITmfEventAspect> getEventAspects() {
+ return PCAP_ASPECTS;
+ }
+
@Override
public synchronized @Nullable PcapEvent parseEvent(@Nullable ITmfContext context) {
if (context == null) {
org.eclipse.tracecompass.tmf.ui;bundle-version="0.1.0",
org.eclipse.tracecompass.tmf.pcap.core;bundle-version="0.1.0"
Export-Package: org.eclipse.tracecompass.internal.tmf.pcap.ui;x-friends:="org.eclipse.tracecompass.tmf.pcap.ui.swtbot.tests",
- org.eclipse.tracecompass.internal.tmf.pcap.ui.editor;x-internal:=true,
org.eclipse.tracecompass.internal.tmf.pcap.ui.stream;x-friends:="org.eclipse.tracecompass.tmf.pcap.ui.swtbot.tests"
Import-Package: com.google.common.collect
<type
icon="icons/pcap.png"
tracetype="org.eclipse.linuxtools.tmf.pcap.core.pcaptrace">
- <eventTableColumns
- class="org.eclipse.tracecompass.internal.tmf.pcap.ui.editor.PcapEventTableColumns">
- </eventTableColumns>
</type>
</extension>
<extension
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Perot - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.pcap.ui.editor;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.osgi.util.NLS;
-
-@SuppressWarnings("javadoc")
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.tmf.pcap.ui.editor.messages"; //$NON-NLS-1$
-
- public static @Nullable String PcapEventsTable_Content;
- public static @Nullable String PcapEventsTable_Destination;
- public static @Nullable String PcapEventsTable_Protocol;
- public static @Nullable String PcapEventsTable_Reference;
- public static @Nullable String PcapEventsTable_Source;
- public static @Nullable String PcapEventsTable_Timestamp;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Perot - Initial API and implementation
- * Alexandre Montplaisir - Update to new TmfEventTableColumn API
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.pcap.ui.editor;
-
-import java.util.Collection;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent;
-import org.eclipse.tracecompass.internal.tmf.pcap.core.protocol.TmfPcapProtocol;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.ITmfEventTableColumns;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Default event table for pcap traces.
- *
- * @author Vincent Perot
- */
-public class PcapEventTableColumns implements ITmfEventTableColumns {
-
- // ------------------------------------------------------------------------
- // Table data
- // ------------------------------------------------------------------------
-
- @SuppressWarnings("null")
- private static final @NonNull Collection<TmfEventTableColumn> PCAP_COLUMNS = ImmutableList.of(
- new TmfEventTableColumn(ITmfEventAspect.BaseAspects.TIMESTAMP),
- new TmfEventTableColumn(new PcapSourceAspect()),
- new TmfEventTableColumn(new PcapDestinationAspect()),
- new TmfEventTableColumn(new PcapReferenceAspect()),
- new TmfEventTableColumn(new PcapProtocolAspect()),
- new TmfEventTableColumn(ITmfEventAspect.BaseAspects.CONTENTS)
- );
-
- /**
- * The "packet source" column for pcap events
- */
- private static class PcapSourceAspect implements ITmfEventAspect {
-
- @Override
- public String getName() {
- return getString(Messages.PcapEventsTable_Source);
- }
-
- @Override
- public String getHelpText() {
- return EMPTY_STRING;
- }
-
- @Override
- public String resolve(ITmfEvent event) {
- if (!(event instanceof PcapEvent)) {
- return EMPTY_STRING;
- }
- PcapEvent pcapEvent = (PcapEvent) event;
- TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
-
- return getString(pcapEvent.getSourceEndpoint(protocol));
- }
-
- @Override
- public @NonNull String getFilterId() {
- return PcapEvent.EVENT_FIELD_PACKET_SOURCE;
- }
- }
-
- /**
- * The "packet destination" column for pcap events
- */
- private static class PcapDestinationAspect implements ITmfEventAspect {
-
- @Override
- public String getName() {
- return getString(Messages.PcapEventsTable_Destination);
- }
-
- @Override
- public String getHelpText() {
- return EMPTY_STRING;
- }
-
- @Override
- public String resolve(ITmfEvent event) {
- if (!(event instanceof PcapEvent)) {
- return EMPTY_STRING;
- }
- PcapEvent pcapEvent = (PcapEvent) event;
- TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
- return getString(pcapEvent.getDestinationEndpoint(protocol));
- }
-
- @Override
- public @NonNull String getFilterId() {
- return PcapEvent.EVENT_FIELD_PACKET_DESTINATION;
- }
- }
-
- /**
- * The "packet reference" column for pcap events
- */
- private static class PcapReferenceAspect implements ITmfEventAspect {
-
- @Override
- public String getName() {
- return getString(Messages.PcapEventsTable_Reference);
- }
-
- @Override
- public String getHelpText() {
- return EMPTY_STRING;
- }
-
- @Override
- public String resolve(ITmfEvent event) {
- if (!(event instanceof PcapEvent)) {
- return EMPTY_STRING;
- }
- return ((PcapEvent) event).getReference();
- }
-
- @Override
- public @Nullable String getFilterId() {
- return ITmfEvent.EVENT_FIELD_REFERENCE;
- }
- }
-
- /**
- * The "packet protocol" column for pcap events
- */
- private static class PcapProtocolAspect implements ITmfEventAspect {
-
- @Override
- public String getName() {
- return getString(Messages.PcapEventsTable_Protocol);
- }
-
- @Override
- public String getHelpText() {
- return EMPTY_STRING;
- }
-
- @Override
- public String resolve(ITmfEvent event) {
- if (!(event instanceof PcapEvent)) {
- return EMPTY_STRING;
- }
- PcapEvent pcapEvent = (PcapEvent) event;
- TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol();
-
- @SuppressWarnings("null")
- @NonNull String proto = protocol.getShortName().toUpperCase();
- return proto;
- }
-
- @Override
- public @Nullable String getFilterId() {
- return PcapEvent.EVENT_FIELD_PACKET_PROTOCOL;
- }
- }
-
- /**
- * Little convenience method to work around the incompatibilities between
- * null annotations and NLS files...
- */
- private static String getString(@Nullable String str) {
- return (str == null ? "" : str); //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------------------
- // ITmfEventTableColumns
- // ------------------------------------------------------------------------
-
- @Override
- public Collection<? extends TmfEventTableColumn> getEventTableColumns() {
- return PCAP_COLUMNS;
- }
-}
+++ /dev/null
-###############################################################################
-# Copyright (c) 2014 Ericsson
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-PcapEventsTable_Content=Content
-PcapEventsTable_Destination=Destination
-PcapEventsTable_Protocol=Protocol
-PcapEventsTable_Reference=Reference
-PcapEventsTable_Source=Source
-PcapEventsTable_Timestamp=Timestamp
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ericsson - Initial API and implementation
- *******************************************************************************/
-
-@org.eclipse.jdt.annotation.NonNullByDefault
-package org.eclipse.tracecompass.internal.tmf.pcap.ui.editor;
\ No newline at end of file
org.eclipse.tracecompass.internal.tmf.ui.commands;x-internal:=true,
org.eclipse.tracecompass.internal.tmf.ui.dialogs;x-internal:=true,
org.eclipse.tracecompass.internal.tmf.ui.editors.handlers;x-internal:=true,
- org.eclipse.tracecompass.internal.tmf.ui.parsers.custom;x-friends:="org.eclipse.tracecompass.tmf.ui.tests",
org.eclipse.tracecompass.internal.tmf.ui.parsers.wizards;x-friends:="org.eclipse.tracecompass.tmf.ui.tests",
org.eclipse.tracecompass.internal.tmf.ui.preferences;x-internal:=true,
org.eclipse.tracecompass.internal.tmf.ui.project.dialogs;x-internal:=true,
<sequence>
<element ref="eventsTableType" minOccurs="0" maxOccurs="1"/>
<element ref="defaultEditor" minOccurs="0" maxOccurs="1"/>
- <element ref="eventTableColumns" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="tracetype" type="string" use="required">
<annotation>
</complexType>
</element>
- <element name="eventTableColumns">
- <annotation>
- <documentation>
- The event table columns to use with this trace type.
-If omitted, the default columns will be used.
-
-If the "eventsTableType" element is present, we will first try to provide a table of that type (ignoring the contents of "eventTableColumns"). If the requested table type cannot be provided, then we will fall-back to using a default table with the columns defined in "eventTableColumns".
- </documentation>
- </annotation>
- <complexType>
- <attribute name="class" type="string">
- <annotation>
- <documentation>
- The fully qualified name of a class that implements <samp>ITmfEventTableColumns</samp> .
-If empty, the default columns will be used.
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.linuxtools.tmf.ui.viewers.events.columns.ITmfEventTableColumns"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
<annotation>
<appinfo>
<meta.section type="since"/>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tasse - Initial API and implementation
- * Alexandre Montplaisir - Update for TmfEventTableColumn
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.ui.parsers.custom;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomEvent;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.OutputColumn;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.TmfEventsTable;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.ITmfEventTableColumns;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Event table column definition for Custom {Text|XML} traces.
- *
- * Since this definition will be different for every single custom trace, this
- * does not work the same as with {@link ITmfEventTableColumns}.
- *
- * Instead, one has to call {@link #generateColumns(CustomTraceDefinition)} with
- * the CustomTraceDefinition of the the particular trace to display. Then the
- * returned collection can be passed to the constructor
- * {@link TmfEventsTable#TmfEventsTable(org.eclipse.swt.widgets.Composite, int, Collection)}
- * as usual.
- *
- * @author Alexandre Montplaisir
- */
-public class CustomEventTableColumns {
-
- /**
- * Column for custom events, which uses an integer ID to represent each
- * column.
- */
- private static final class CustomEventFieldAspect implements ITmfEventAspect {
-
- private final @NonNull String fName;
- private final int fIndex;
-
- /**
- * Constructor
- *
- * @param name
- * The name (title) of this aspect
- * @param idx
- * The "index" of this aspect, which should be the index of
- * the field in the event's content to display.
- */
- public CustomEventFieldAspect(@NonNull String name, int idx) {
- fName = name;
- fIndex = idx;
- }
-
- @Override
- public String getName() {
- return fName;
- }
-
- @Override
- public String getHelpText() {
- return EMPTY_STRING;
- }
-
- @Override
- public String resolve(ITmfEvent event) {
- if (event instanceof CustomEvent) {
- String ret = ((CustomEvent) event).getEventString(fIndex);
- return (ret == null ? EMPTY_STRING : ret);
- }
- return EMPTY_STRING;
- }
-
- @Override
- public String getFilterId() {
- return fName;
- }
- }
-
- /**
- * Get the event table columns for a given trace definition
- *
- * @param definition The {@link CustomTraceDefinition} of the trace for which you want the columns
- * @return The set of columns for the given trace.
- */
- public static Collection<TmfEventTableColumn> generateColumns(CustomTraceDefinition definition) {
- ImmutableList.Builder<TmfEventTableColumn> builder = new ImmutableList.Builder<>();
- List<OutputColumn> outputs = definition.outputs;
- for (int i = 0; i < outputs.size(); i++) {
- String name = outputs.get(i).name;
- if (name != null) {
- builder.add(new TmfEventTableColumn(new CustomEventFieldAspect(name, i)));
- }
- }
- return builder.build();
- }
-}
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.tracecompass.internal.tmf.core.parsers.custom.CustomEventAspects;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.ui.Messages;
-import org.eclipse.tracecompass.internal.tmf.ui.parsers.custom.CustomEventTableColumns;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.OutputColumn;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTrace;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.OutputColumn;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
tableLayout.marginHeight = 0;
tableLayout.marginWidth = 0;
tableContainer.setLayout(tableLayout);
- previewTable = new TmfEventsTable(tableContainer, 0, CustomEventTableColumns.generateColumns(new CustomTxtTraceDefinition()));
+ previewTable = new TmfEventsTable(tableContainer, 0, CustomEventAspects.generateAspects(new CustomTxtTraceDefinition()));
previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
if (wizard.definition != null) {
};
trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
previewTable.dispose();
- previewTable = new TmfEventsTable(tableContainer, CACHE_SIZE, CustomEventTableColumns.generateColumns(definition));
+ previewTable = new TmfEventsTable(tableContainer, CACHE_SIZE, CustomEventAspects.generateAspects(definition));
previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
previewTable.setTrace(trace, true);
} catch (final TmfTraceException e) {
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.tracecompass.internal.tmf.core.parsers.custom.CustomEventAspects;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.ui.Messages;
-import org.eclipse.tracecompass.internal.tmf.ui.parsers.custom.CustomEventTableColumns;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.OutputColumn;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.OutputColumn;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
tableLayout.marginHeight = 0;
tableLayout.marginWidth = 0;
tableContainer.setLayout(tableLayout);
- previewTable = new TmfEventsTable(tableContainer, 0, CustomEventTableColumns.generateColumns(new CustomXmlTraceDefinition()));
+ previewTable = new TmfEventsTable(tableContainer, 0, CustomEventAspects.generateAspects(new CustomXmlTraceDefinition()));
previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
if (wizard.definition != null) {
};
trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
previewTable.dispose();
- previewTable = new TmfEventsTable(tableContainer, CACHE_SIZE, CustomEventTableColumns.generateColumns(definition));
+ previewTable = new TmfEventsTable(tableContainer, CACHE_SIZE, CustomEventAspects.generateAspects(definition));
previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
previewTable.setTrace(trace, true);
} catch (final TmfTraceException e) {
package org.eclipse.tracecompass.tmf.ui.editors;
-import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import org.eclipse.swt.widgets.Display;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
import org.eclipse.tracecompass.tmf.core.signal.TmfTimestampFormatUpdateSignal;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceTypeUIUtils;
import org.eclipse.tracecompass.tmf.ui.viewers.events.TmfEventsTable;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
}
/*
- * The trace type did not specify an event table, we will use a default
- * table with the columns it asked for (if any).
+ * The trace type did not specify an event table, we will use a standard
+ * table with the trace's advertised aspects (if any).
*/
- Collection<? extends TmfEventTableColumn> columns = TmfTraceTypeUIUtils.getEventTableColumns(trace);
- if (columns != null) {
- return new TmfEventsTable(parent, cacheSize, columns);
+ Iterable<ITmfEventAspect> aspects = trace.getEventAspects();
+ if (aspects != null) {
+ return new TmfEventsTable(parent, cacheSize, aspects);
}
/*
* trace types.
*/
ITmfTrace[] traces = experiment.getTraces();
- Set<TmfEventTableColumn> cols = new LinkedHashSet<>();
+ Set<ITmfEventAspect> aspects = new LinkedHashSet<>();
for (ITmfTrace trace : traces) {
- Collection<? extends TmfEventTableColumn> traceCols =
- TmfTraceTypeUIUtils.getEventTableColumns(trace);
- if (traceCols == null) {
- cols.addAll(TmfEventsTable.DEFAULT_COLUMNS);
+ Iterable<ITmfEventAspect> traceAspects = trace.getEventAspects();
+ if (traceAspects == null) {
+ aspects.addAll(TmfTrace.BASE_ASPECTS);
} else {
- cols.addAll(traceCols);
+ for (ITmfEventAspect aspect : traceAspects) {
+ aspects.add(aspect);
+ }
}
}
- return new TmfEventsTable(parent, cacheSize, cols);
+ return new TmfEventsTable(parent, cacheSize, aspects);
}
/**
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tracecompass.internal.tmf.ui.parsers.custom.CustomEventTableColumns;
import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTrace;
import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceImportException;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType;
-import org.eclipse.tracecompass.tmf.core.project.model.TraceTypeHelper;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType.TraceElementType;
+import org.eclipse.tracecompass.tmf.core.project.model.TraceTypeHelper;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.util.Pair;
import org.eclipse.tracecompass.tmf.ui.viewers.events.TmfEventsTable;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.ITmfEventTableColumns;
-import org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn;
import org.osgi.framework.Bundle;
/**
return null;
}
- /**
- * Get the Event Table columns specified by the trace type's extension
- * point, if there are any.
- *
- * @param trace
- * The trace for which we want the columns.
- * @return The corresponding event table columns, or 'null' if this trace
- * type did not specify any.
- * @since 3.2
- */
- public static @Nullable Collection<? extends TmfEventTableColumn> getEventTableColumns(ITmfTrace trace) {
- final String traceType = getTraceType(trace);
- if (traceType == null) {
- return null;
- }
-
- /*
- * Custom traces are a special case : the columns are defined by the
- * trace definition.
- */
- if (traceType.startsWith(CustomTxtTrace.class.getCanonicalName())) {
- return CustomEventTableColumns.generateColumns(((CustomTxtTrace) trace).getDefinition());
- }
- if (traceType.startsWith(CustomXmlTrace.class.getCanonicalName())) {
- return CustomEventTableColumns.generateColumns(((CustomXmlTrace) trace).getDefinition());
- }
-
- /* For all other trace types, we will go look into the extension point */
- for (final IConfigurationElement ce : TmfTraceTypeUIUtils.getTypeUIElements(TraceElementType.TRACE)) {
- if (ce.getAttribute(TmfTraceTypeUIUtils.TRACETYPE_ATTR).equals(traceType)) {
- final IConfigurationElement[] eventTableColumnsCE = ce.getChildren(TmfTraceTypeUIUtils.EVENT_TABLE_COLUMNS);
-
- if (eventTableColumnsCE.length != 1) {
- break;
- }
- final String eventTableColumnsClass = eventTableColumnsCE[0].getAttribute(TmfTraceTypeUIUtils.CLASS_ATTR);
- if ((eventTableColumnsClass == null) || (eventTableColumnsClass.isEmpty())) {
- break;
- }
- try {
- final Bundle bundle = Platform.getBundle(ce.getContributor().getName());
- final Class<?> c = bundle.loadClass(eventTableColumnsClass);
- final Constructor<?> ctor = c.getConstructor();
- ITmfEventTableColumns cols = (ITmfEventTableColumns) ctor.newInstance();
- return cols.getEventTableColumns();
-
- } catch (NoSuchMethodException | ClassNotFoundException | InstantiationException |
- IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- return null;
- }
- }
- }
- return null;
- }
-
/**
* Get the trace type (as a String) for the given trace
*
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
import org.eclipse.tracecompass.tmf.ui.viewers.events.TmfEventsCache.CachedEvent;
private static final int FILTER_SUMMARY_INDEX = 1;
private static final int EVENT_COLUMNS_START_INDEX = MARGIN_COLUMN_INDEX + 1;
- /**
- * Default set of columns to use for trace types that do not specify
- * anything
- * @since 3.2
- */
- public static final Collection<TmfEventTableColumn> DEFAULT_COLUMNS = ImmutableList.of(
- new TmfEventTableColumn(ITmfEventAspect.BaseAspects.TIMESTAMP),
- new TmfEventTableColumn(ITmfEventAspect.BaseAspects.EVENT_TYPE),
- new TmfEventTableColumn(ITmfEventAspect.BaseAspects.CONTENTS)
- );
-
/**
* The events table search/filter keys
*
* The size of the event table cache
*/
public TmfEventsTable(final Composite parent, final int cacheSize) {
- this(parent, cacheSize, DEFAULT_COLUMNS);
+ this(parent, cacheSize, TmfTrace.BASE_ASPECTS);
}
/**
}
@Deprecated
- private static Collection<TmfEventTableColumn> convertFromColumnData(
+ private static Iterable<ITmfEventAspect> convertFromColumnData(
org.eclipse.tracecompass.tmf.ui.widgets.virtualtable.ColumnData[] columnData) {
- ImmutableList.Builder<TmfEventTableColumn> builder = new ImmutableList.Builder<>();
+ ImmutableList.Builder<ITmfEventAspect> builder = new ImmutableList.Builder<>();
for (org.eclipse.tracecompass.tmf.ui.widgets.virtualtable.ColumnData col : columnData) {
String fieldName = col.header;
if (fieldName != null) {
- builder.add(new TmfEventTableColumn(new TmfEventFieldAspect(fieldName, fieldName)));
+ builder.add(new TmfEventFieldAspect(fieldName, fieldName));
}
}
return builder.build();
* The parent composite UI object
* @param cacheSize
* The size of the event table cache
- * @param columns
- * The columns to use in this table.
+ * @param aspects
+ * The event aspects to display in this table. One column per
+ * aspect will be created.
* <p>
* The iteration order of this collection will correspond to the
- * initial ordering of this series of columns in the table.
+ * initial ordering of the columns in the table.
* </p>
* @since 3.1
*/
public TmfEventsTable(final Composite parent, int cacheSize,
- Collection<? extends TmfEventTableColumn> columns) {
+ Iterable<ITmfEventAspect> aspects) {
super("TmfEventsTable"); //$NON-NLS-1$
fComposite = new Composite(parent, SWT.NONE);
fTable.setLinesVisible(true);
// Setup the columns
- if (columns != null) {
- fColumns.addAll(columns);
+ if (aspects != null) {
+ for (ITmfEventAspect aspect : aspects) {
+ if (aspect != null) {
+ fColumns.add(new TmfEventTableColumn(aspect));
+ }
+ }
}
TmfMarginColumn collapseCol = new TmfMarginColumn();
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ui.viewers.events.columns;
-
-import java.util.Collection;
-
-import org.eclipse.jdt.annotation.NonNull;
-
-/**
- * This class allows a trace type to specify which columns it wants to display
- * in the Event Table. The "function" to populate the column for any given event
- * is defined in each {@link TmfEventTableColumn}.
- *
- * @author Alexandre Montplaisir
- * @since 3.2
- */
-public interface ITmfEventTableColumns {
-
- /**
- * Return the columns specified by this trace type.
- *
- * The iteration order of the returned collection will correspond to the
- * initial order of these columns in the view (from left to right).
- * <p>
- * Note to implementers:
- * <p>
- * Even if many traces of the same type can be opened at the same time, the
- * column objects can (and probably should) be singleton instances. This
- * means you do not need to create new column objects every time this method
- * is called.
- *
- * @return The Event Table columns advertised by this trace type
- */
- @NonNull Collection<? extends TmfEventTableColumn> getEventTableColumns();
-}