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 public API to allow retrieving the underlying trace instance from core data providers.
    • Exposed provider lists via the public API and now return an immutable view to 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: a8df88dd-c0a5-4d68-922c-3960e2660f52

📥 Commits

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

📒 Files selected for processing (1)
  • tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/tree/TmfTreeCompositeDataProvider.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 and directly summarizes the main change: making getTrace() and getProviders() public API methods in the data provider classes.
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

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.

1 participant