Skip to content

Commit 1736c2f

Browse files
committed
timing: Fix SegmentStoreScatterDataProvider for empty segment store
For example, if a trace doesn't have any call stack events to populate the segment store and hence populate the view, the data provider should return an empty model instead of failed for fetchTree and fetchXy [Fixed] Fix SegmentStoreScatterDataProvider for empty segment store Signed-off-by: Bernd Hufmann <[email protected]>
1 parent 751b02c commit 1736c2f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/segmentstore/SegmentStoreScatterDataProvider.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,18 +254,22 @@ private SegmentStoreScatterDataProvider(ITmfTrace trace, ISegmentStoreProvider p
254254
@Override
255255
public TmfModelResponse<TmfTreeModel<TmfTreeDataModel>> fetchTree(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) {
256256
ISegmentStoreProvider provider = fProvider;
257+
boolean waitResult = true;
257258
if (provider instanceof IAnalysisModule) {
258259
IAnalysisModule module = (IAnalysisModule) provider;
259260
IProgressMonitor mon = monitor != null ? monitor : new NullProgressMonitor();
260-
module.waitForCompletion(mon);
261+
waitResult = module.waitForCompletion(mon);
261262
if (mon.isCanceled()) {
262263
return new TmfModelResponse<>(null, Status.CANCELLED, CommonStatusMessage.TASK_CANCELLED);
263264
}
264265
}
265266
ISegmentStore<ISegment> segStore = provider.getSegmentStore();
266267

267268
if (segStore == null) {
268-
return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.ANALYSIS_INITIALIZATION_FAILED);
269+
if (!waitResult) {
270+
return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.ANALYSIS_INITIALIZATION_FAILED);
271+
}
272+
return new TmfModelResponse<>(new TmfTreeModel<>(Collections.emptyList(), Collections.emptyList()), ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
269273
}
270274
TimeQueryFilter filter = FetchParametersUtils.createTimeQuery(fetchParameters);
271275
if (filter == null) {
@@ -333,8 +337,10 @@ public TmfModelResponse<ITmfXyModel> fetchXY(Map<String, Object> fetchParameters
333337
}
334338

335339
final ISegmentStore<ISegment> segStore = provider.getSegmentStore();
340+
336341
if (segStore == null) {
337-
return TmfXyResponseFactory.createFailedResponse(Objects.requireNonNull(Messages.SegmentStoreDataProvider_SegmentNotAvailable));
342+
return TmfXyResponseFactory.create(Objects.requireNonNull(Messages.SegmentStoreScatterGraphViewer_title),
343+
Collections.emptyList(), true);
338344
}
339345

340346
// TODO server: Parameters validation should be handle separately. It

0 commit comments

Comments
 (0)