Skip to content

Provide reusable breadcrumb viewer implementations in JFace #4495 - #4496

Open
LukasHackl2 wants to merge 1 commit into
eclipse-platform:masterfrom
LukasHackl2:feature/jface-breadcrumb
Open

LukasHackl2 wants to merge 1 commit into
eclipse-platform:masterfrom
LukasHackl2:feature/jface-breadcrumb

Conversation

@LukasHackl2

@LukasHackl2 LukasHackl2 commented Oct 15, 2026 •

Copy link
Copy Markdown

This change provides reusable breadcrumb viewer implementations in JFace so they can be shared by multiple Eclipse clients.

The original implementation was extracted from the long-standing JDT breadcrumb code. While adapting Debug UI as an additional consumer, it became clear that the Debug breadcrumb uses a TreePath-based variant with different drop-down handling.

The change therefore provides two reusable variants in org.eclipse.jface.viewers:

  • the Breadcrumb* implementation used by JDT
  • the TreePathBreadcrumb* implementation used by Debug UI

Client-specific behavior remains outside JFace and is exposed through extension hooks where needed.

For JDT, this includes preserving:

  • the custom drop-down TreeViewer
  • Java-specific element openability
  • persistent dialog settings

For Debug UI, the corresponding duplicated TreePath breadcrumb implementation can now be removed and replaced with the JFace implementation.

Corresponding pull requests:

Issue:
#4495

LukasHackl2 added a commit to LukasHackl2/eclipse.jdt.ui that referenced this pull request Oct 15, 2026
Adapt the Java editor breadcrumb to use the generic JFace breadcrumb implementation. Preserve JDT-specific behavior through extension hooks for ProblemTreeViewer, Java element openability and persistent dialog settings. Remove the obsolete JDT breadcrumb implementation and messages resources, and bump the org.eclipse.jdt.ui bundle version.

Issue: eclipse-platform/eclipse.platform.ui#4495

Depends on: eclipse-platform/eclipse.platform.ui#4496

Assisted-by: OpenAI GPT-5.6 Sol
Signed-off-by: LukasHackl2 <lukas.h95@hotmail.de>
@LukasHackl2
LukasHackl2 force-pushed the feature/jface-breadcrumb branch from 7dcd2a2 to 8892f27 Compare October 15, 2026 16:17
LukasHackl2 added a commit to LukasHackl2/eclipse.jdt.ui that referenced this pull request Oct 15, 2026
Adapt the Java editor breadcrumb to use the generic JFace breadcrumb implementation. Preserve JDT-specific behavior through extension hooks for ProblemTreeViewer, Java element openability and persistent dialog settings. Remove the obsolete JDT breadcrumb implementation and messages resources, and bump the org.eclipse.jdt.ui bundle version.

Issue: eclipse-platform/eclipse.platform.ui#4495

Depends on: eclipse-platform/eclipse.platform.ui#4496

Assisted-by: OpenAI GPT-5.6 Sol
Signed-off-by: LukasHackl2 <lukas.h95@hotmail.de>
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   867 files  ±0     867 suites  ±0   44m 44s ⏱️ - 5m 12s
 8 543 tests ±0   8 303 ✅ ±0  240 💤 ±0  0 ❌ ±0 
21 501 runs  ±0  20 825 ✅ ±0  676 💤 ±0  0 ❌ ±0 

Results for commit 37670fd. ± Comparison against base commit c85dff6.

♻️ This comment has been updated with latest results.

@merks merks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think all the @since versions need attention.

@LukasHackl2
LukasHackl2 force-pushed the feature/jface-breadcrumb branch from 8892f27 to 981322e Compare October 15, 2026 22:55
@LukasHackl2

LukasHackl2 commented Oct 15, 2026 •

Copy link
Copy Markdown
Author

Thanks. org.eclipse.jface is already at 3.41.0.qualifier on the current PR base, so I kept BreadcrumbViewer at @since 3.41. I updated the @since 3.4 tags inherited from the JDT implementation to @since 3.41.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

org.eclipse.debug.ui also has a class called "BreadcrumbItem". Looks like we already have a copy of the JDT think there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It was so nice, we did it twice:

image

It will be even nicer when we do it only once in a reusable way. 😀

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

agree

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@LukasHackl2 : could you please check if you also can provide platform PR and replace classes added in eclipse-platform/eclipse.platform@56f6a79 to use new API?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I can check this. I see that the Debug UI breadcrumb implementation has diverged somewhat from the JDT version, in particular around the TreePath-based content/label providers and its custom drop-down handling. I’ll check what is needed to adapt it to the new JFace API and provide a corresponding Platform PR if feasible.

@merks merks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks good to me.

I assume this is literally just copied over from JDT with only package name changes so there is no need to review all the code in detail because it has been fully functional for a very long time, right?

@LukasHackl2

Copy link
Copy Markdown
Author

Yes, the implementation is based on the long-standing JDT breadcrumb code. It is not a pure package-name copy though: I removed the JDT-specific dependencies and added extension points needed to preserve the JDT-specific behavior, such as the custom drop-down viewer, element openability and dialog settings. The core breadcrumb viewer/item behavior itself is otherwise retained.

@merks

merks commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

I'm really personally all for merging this as soon as possible. I assume the plan is immediate follow up rework the two other copies to valid the utility of what's in JFace. (I think I already saw such a comment about JDT, but I get so many notifications is hard to keep track.)

@iloveeclipse @BeckerWdf

Are you guys okay with merging this soonish so that the downstream work can proceed?

@iloveeclipse

Copy link
Copy Markdown
Member

Are you guys okay with merging this soonish so that the downstream work can proceed?

I would wait the check offered by @LukasHackl2 whether the new API copied from JDT fits the second platform debug implementation mentioned above. If it fits and no extra API change needed for that, I'm OK. Otherwise we will need to touch JDT again.

@merks

merks commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

@LukasHackl2

We still look forward to your progress.

@LukasHackl2

Copy link
Copy Markdown
Author

I’m still working on a good solution; unfortunately, it’s proving more difficult than expected.
I hope I can come up with one this week.

@merks

merks commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

FYI, with M3 coming soon, anything after November 11 will likely have to wait for the next release, and that's not just my decision to make...

@LukasHackl2

Copy link
Copy Markdown
Author

I’ve now also opened the corresponding Platform PR for adapting Debug UI to the new JFace breadcrumb API:

eclipse-platform/eclipse.platform#3061

While adapting Debug UI, I found that its breadcrumb implementation is not a direct drop-in consumer of the JDT-derived BreadcrumbViewer API. In particular, the TreePath-based viewer and drop-down handling differ enough that directly reusing the existing classes would require a more substantial change to either the JDT-derived API or the Debug implementation.

The current approach therefore adds a TreePathBreadcrumb* variant to JFace and removes the corresponding duplicated implementation from Debug UI.

This does introduce five additional JFace classes, so I’d especially appreciate feedback on whether this is the preferred abstraction or whether you would rather see further consolidation with the existing Breadcrumb* classes.

@LukasHackl2 LukasHackl2 changed the title Move generic breadcrumb implementation from JDT to JFace #4495 Provide reusable breadcrumb viewer implementations in JFace #4495 Nov 8, 2026
@iloveeclipse
iloveeclipse requested a balanced review from Copilot November 8, 2026 05:52

Copilot AI 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.

🟡 Changes recommended

Unresolved defects can cause runtime exceptions and incorrect breadcrumb selections, including stale selections, lost ancestor paths, and mismatched tree paths.

12 open issues
What changed in this PR

Adds reusable breadcrumb viewers to JFace, enabling JDT and Debug UI to replace duplicated implementations while retaining client-specific behavior.

Changes:

  • Introduces element-based and TreePath-based breadcrumb viewers.
  • Provides extension hooks for drop-down controls, element openability, and persistent dialog settings.
  • Adds supporting item controls, navigation, accessibility labels, and shared tooltip text.
File Description
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​viewers/​TreePathBreadcrumbViewer.java Adds the path-based viewer and selection handling.
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​viewers/​TreePathBreadcrumbItemDropDown.java Implements path-based popup controls and sizing.
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​viewers/​TreePathBreadcrumbItemDetails.java Adds path-based item labels and input handling.
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​viewers/​TreePathBreadcrumbItem.java Combines item controls with stored tree paths.
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​viewers/​TreePathBreadcrumbDropDownSite.java Defines callbacks for custom drop-down controls.
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​viewers/​BreadcrumbViewerRow.java Adapts breadcrumb items to the viewer-cell API.
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​viewers/​BreadcrumbViewer.java Adds the element-based viewer and customization hooks.
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​viewers/​BreadcrumbItemDropDown.java Implements tree-based popups and interaction handling.
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​viewers/​BreadcrumbItemDetails.java Adds item labels, focus, and navigation controls.
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​viewers/​BreadcrumbItem.java Combines labels and drop-downs into breadcrumb items.
bundles/​org.eclipse.jface/​src/​org/​eclipse/​jface/​messages.properties Adds shared “Show Children” tooltip text.

Review effort: Balanced

@merks

merks commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

@LukasHackl2

Could you please squash this to a single commit (rebase on master if need be) and force push that single commit? In general try to amend your original commit and force push it to maintain a single commit in the PR.

I'd really like to see this completed so that I can reuse it in the CBI aggregator's editor. I'd love to reuse it in other places too, once it has become API! This has always been a hidden gem...

Copilot AI 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.

Comment on lines +30 to +32
private Color fForeground;
private Font fFont;
private Color fBackground;
…latform#4495

Move the reusable breadcrumb implementations to org.eclipse.jface.viewers, providing both element-based and TreePath-based variants. Keep client-specific behavior configurable through extension hooks for drop-down handling, element openability and dialog settings.
@LukasHackl2
LukasHackl2 force-pushed the feature/jface-breadcrumb branch from 84f3583 to 37670fd Compare November 8, 2026 15:49
@LukasHackl2

Copy link
Copy Markdown
Author

The issues from the latest Copilot review have been addressed and the updated changes have been pushed. Could you please run another Copilot code review on the current version?

Copilot AI 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.

*/
@Override
public void setText(String string) {
super.setText(string);
return null;

for (BreadcrumbItem item : fBreadcrumbItems) {
if (item.getData() == element || element.equals(item.getData()))
Comment on lines +402 to +405
if (item == null || element == getRoot()) {
for (BreadcrumbItem item1 : fBreadcrumbItems) {
item1.refresh();
}

// Keep reused items mapped so update() can find them with hash lookup enabled.
if (equals(element, item.getData())) {
update(element, null);
update(element, null);
} else {
if (item.getData() != null)
unmapElement(item.getData());
x+= width;
}

int y = rect.y;
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.

5 participants