use of org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter in project tracecompass by tracecompass.
the class TmfFilteredXYChartViewer method createQueryParameters.
@Override
@NonNull
protected Map<String, Object> createQueryParameters(long start, long end, int nb) {
Map<@NonNull String, @NonNull Object> parameters = FetchParametersUtils.selectionTimeQueryToMap(new SelectionTimeQueryFilter(start, end, nb, fSelectedIds));
Multimap<@NonNull Integer, @NonNull String> regexesMap = getRegexes();
if (!regexesMap.isEmpty()) {
parameters.put(DataProviderParameterUtils.REGEX_MAP_FILTERS_KEY, regexesMap.asMap());
}
return parameters;
}
use of org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter in project tracecompass by tracecompass.
the class CounterChartViewer method createQueryParameters.
@Override
@NonNull
protected Map<String, Object> createQueryParameters(long start, long end, int nb) {
Map<@NonNull String, @NonNull Object> parameters = FetchParametersUtils.selectionTimeQueryToMap(new SelectionTimeQueryFilter(start, end, nb, getSelected()));
parameters.put(CounterDataProvider.CUMULATIVE_COUNTER_KEY, fIsCumulative);
return parameters;
}
use of org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter in project tracecompass by tracecompass.
the class CriticalPathDataProvider method fetchRowModel.
@Override
@NonNull
public TmfModelResponse<@NonNull TimeGraphModel> fetchRowModel(@NonNull Map<@NonNull String, @NonNull Object> fetchParameters, @Nullable IProgressMonitor monitor) {
IGraphWorker graphWorker = getCurrent();
if (graphWorker == null) {
return new TmfModelResponse<>(null, Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
CriticalPathVisitor visitor = fHorizontalVisitorCache.getIfPresent(graphWorker);
if (visitor == null) {
return new TmfModelResponse<>(null, Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
// TODO server: Parameters validation should be handle separately. It
// can be either in the data provider itself or before calling it. It
// will avoid the creation of filters and the content of the map can be
// use directly.
SelectionTimeQueryFilter filter = FetchParametersUtils.createSelectionTimeQuery(fetchParameters);
if (filter == null) {
return new TmfModelResponse<>(null, Status.FAILED, CommonStatusMessage.INCORRECT_QUERY_PARAMETERS);
}
Map<@NonNull Integer, @NonNull Predicate<@NonNull Multimap<@NonNull String, @NonNull Object>>> predicates = new HashMap<>();
Multimap<@NonNull Integer, @NonNull String> regexesMap = DataProviderParameterUtils.extractRegexFilter(fetchParameters);
if (regexesMap != null) {
predicates.putAll(computeRegexPredicate(regexesMap));
}
List<@NonNull ITimeGraphRowModel> rowModels = new ArrayList<>();
for (Long id : filter.getSelectedItems()) {
/*
* need to use asMap, so that we don't return a row for an ID that does not
* belong to this provider, else fStates.get(id) might return an empty
* collection for an id from another data provider.
*/
Collection<ITimeGraphState> states = visitor.fStates.asMap().get(id);
if (states != null) {
List<ITimeGraphState> filteredStates = new ArrayList<>();
for (ITimeGraphState state : states) {
if (overlaps(state.getStartTime(), state.getDuration(), filter.getTimesRequested())) {
// Reset the properties for this state before filtering
state.setActiveProperties(0);
applyFilterAndAddState(filteredStates, state, id, predicates, monitor);
}
}
rowModels.add(new TimeGraphRowModel(id, filteredStates));
}
}
return new TmfModelResponse<>(new TimeGraphModel(rowModels), Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
use of org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter in project tracecompass by tracecompass.
the class ResourcesStatusDataProvider method getFilterData.
@Override
@NonNull
public Multimap<@NonNull String, @NonNull Object> getFilterData(long entryId, long time, @Nullable IProgressMonitor monitor) {
Multimap<@NonNull String, @NonNull Object> data = HashMultimap.create();
data.putAll(super.getFilterData(entryId, time, monitor));
SelectionTimeQueryFilter filter = new SelectionTimeQueryFilter(Collections.singletonList(time), Collections.singleton(Objects.requireNonNull(entryId)));
TmfModelResponse<Map<String, String>> response = fetchTooltip(FetchParametersUtils.selectionTimeQueryToMap(filter), monitor);
Map<@NonNull String, @NonNull String> model = response.getModel();
if (model != null) {
for (Entry<String, String> entry : model.entrySet()) {
data.put(entry.getKey(), entry.getValue());
}
}
return data;
}
use of org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter in project tracecompass by tracecompass.
the class ControlFlowPresentationProvider method getEventHoverToolTipInfo.
@Override
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) {
Map<String, String> retMap = super.getEventHoverToolTipInfo(event, hoverTime);
if (retMap == null) {
retMap = new LinkedHashMap<>(1);
}
ThreadEntryModel entryModel = ControlFlowView.getThreadEntryModel(event.getEntry());
if (!(event instanceof TimeEvent) || !((TimeEvent) event).hasValue() || entryModel == null) {
return retMap;
}
ITimeGraphDataProvider<? extends TimeGraphEntryModel> dataProvider = BaseDataProviderTimeGraphView.getProvider((TimeGraphEntry) event.getEntry());
TmfModelResponse<@NonNull Map<@NonNull String, @NonNull String>> response = dataProvider.fetchTooltip(FetchParametersUtils.selectionTimeQueryToMap(new SelectionTimeQueryFilter(hoverTime, hoverTime, 1, Collections.singletonList(entryModel.getId()))), null);
Map<@NonNull String, @NonNull String> tooltipModel = response.getModel();
if (tooltipModel != null) {
retMap.putAll(tooltipModel);
}
return retMap;
}
Aggregations