Skip to content

Public API getTrace() and getProviders() in the data provider class#417

Open
tuanvtdeptre199 wants to merge 2 commits into
eclipse-tracecompass:masterfrom
tuanvtdeptre199:publicchildproviderandtrace
Open

Public API getTrace() and getProviders() in the data provider class#417
tuanvtdeptre199 wants to merge 2 commits into
eclipse-tracecompass:masterfrom
tuanvtdeptre199:publicchildproviderandtrace

Conversation

@tuanvtdeptre199

@tuanvtdeptre199 tuanvtdeptre199 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What it does

Recently, I have wanted to improve my 3rd trace views to work with multiple trace packages from the different trace tools. So I want to public the API getProviders() from class TmfTreeCompositeDataProvider.java and getTrace() from class AbstractTmfTraceDataProvider.java

How to test

It does not change any logic code, just public some API, so all views in Trace Compass are expected to work normally.

Follow-ups

Review checklist

  • As an author, I have thoroughly tested my changes and carefully followed the instructions in this template

Summary by CodeRabbit

  • Refactor
    • Expanded the core data provider public API to allow retrieving the underlying trace instance directly.
    • Updated tree composite providers to expose the provider list through a public method while returning an immutable view to help prevent external modification.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5aef2619-3d63-49ec-852e-e9de9e00f7d7

📥 Commits

Reviewing files that changed from the base of the PR and between 33f098e and e26e7c0.

📒 Files selected for processing (2)
  • tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/AbstractTmfTraceDataProvider.java
  • tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/tree/TmfTreeCompositeDataProvider.java
🚧 Files skipped from review as they are similar to previous changes (2)
  • tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/tree/TmfTreeCompositeDataProvider.java
  • tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/AbstractTmfTraceDataProvider.java

📝 Walkthrough

Walkthrough

This PR makes two data provider accessor methods public: getTrace() on AbstractTmfTraceDataProvider and getProviders() on TmfTreeCompositeDataProvider; getProviders() now returns an unmodifiable list.

Changes

Data Provider Accessor Exposure

Layer / File(s) Summary
Data provider accessor visibility
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/AbstractTmfTraceDataProvider.java, tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/tree/TmfTreeCompositeDataProvider.java
getTrace() changed from protected to public; getProviders() changed from protected to public and now returns Collections.unmodifiableList(fProviders).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nibble lines and hop through keys,
Two methods blossom from hidden trees,
One reveals the trace I keep,
One guards the list for callers to peep,
A tiny change — the code feels breeze.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: making getTrace() and getProviders() methods public in data provider classes, which directly corresponds to the PR's core modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tuanvtdeptre199 tuanvtdeptre199 changed the title Public API in the data provider class Public API getTrace() and getProviders() in the data provider class Jun 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/tree/TmfTreeCompositeDataProvider.java`:
- Around line 191-193: The public getProviders() currently returns the mutable
backing field fProviders allowing external mutation and bypassing
removeProvider(...) lifecycle/disposal semantics; change getProviders() to
return a defensive/unmodifiable view or copy (e.g., an unmodifiableList or a new
ArrayList copy of fProviders) so callers cannot modify the internal list
directly and must use add/removeProvider(...) to manage provider lifecycle.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4d223a78-2c7d-42e3-a101-6e8a630d25ea

📥 Commits

Reviewing files that changed from the base of the PR and between 75e5dc8 and ee601ea.

📒 Files selected for processing (2)
  • tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/AbstractTmfTraceDataProvider.java
  • tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/tree/TmfTreeCompositeDataProvider.java

@arfio

arfio commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Can you please rebase your change so that your patch can run the CI completely?

@arfio

arfio commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Can you please explain in more detail why do you need to access the trace directly to manage multiple traces with one view?
In my mind, either you need to run an analysis and data provider with an ensemble of trace and you need to use an experiment. Or you have multiple analyses and you need to merge multiple data sources, and you don't need to access the trace only the different dataproviders.

@tuanvtdeptre199 tuanvtdeptre199 force-pushed the publicchildproviderandtrace branch from 35d88b0 to e26e7c0 Compare June 17, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants