Search in sources :

Example 1 with TraceEntry

use of org.eclipse.tracecompass.tmf.ui.views.timegraph.BaseDataProviderTimeGraphView.TraceEntry in project tracecompass by tracecompass.

the class AbstractTimeGraphView method selectionChanged.

/**
 * Signal indicating a data model element was selected somewhere
 *
 * @param signal
 *            the signal carrying the select data model metadata
 * @since 4.2
 */
@TmfSignalHandler
public void selectionChanged(TmfDataModelSelectedSignal signal) {
    // Ignore signal from self
    if (signal.getSource() == this) {
        return;
    }
    Multimap<@NonNull String, @NonNull Object> metadata = signal.getMetadata();
    // See if the current selection intersects the metadata
    ITimeGraphEntry selection = getTimeGraphViewer().getSelection();
    if (selection instanceof IElementResolver && IElementResolver.commonIntersect(metadata, ((IElementResolver) selection).getMetadata())) {
        return;
    }
    // See if an entry intersects the metadata
    List<TimeGraphEntry> traceEntries = getEntryList(getTrace());
    if (traceEntries == null) {
        return;
    }
    for (TraceEntry traceEntry : Iterables.filter(traceEntries, TraceEntry.class)) {
        Iterable<TimeGraphEntry> unfiltered = Utils.flatten(traceEntry);
        for (TimeGraphEntry entry : unfiltered) {
            if (IElementResolver.commonIntersect(metadata, entry.getMetadata())) {
                getTimeGraphViewer().setSelection(entry, true);
            }
        }
    }
}
Also used : ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) IElementResolver(org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver) TraceEntry(org.eclipse.tracecompass.tmf.ui.views.timegraph.BaseDataProviderTimeGraphView.TraceEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Aggregations

IElementResolver (org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver)1 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)1 TraceEntry (org.eclipse.tracecompass.tmf.ui.views.timegraph.BaseDataProviderTimeGraphView.TraceEntry)1 ITimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)1 TimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)1