use of org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver 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);
}
}
}
}
Aggregations