Repository navigation
Provide reusable breadcrumb viewer implementations in JFace #4495 - #4496
LukasHackl2 wants to merge 1 commit into
Conversation
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>
7dcd2a2 to
8892f27
Compare
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>
merks
left a comment
There was a problem hiding this comment.
I think all the @since versions need attention.
8892f27 to
981322e
Compare
|
Thanks. org.eclipse.jface is already at 3.41.0.qualifier on the current PR base, so I kept BreadcrumbViewer at |
There was a problem hiding this comment.
org.eclipse.debug.ui also has a class called "BreadcrumbItem". Looks like we already have a copy of the JDT think there.
There was a problem hiding this comment.
@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?
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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?
|
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. |
|
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.) 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. |
|
We still look forward to your progress. |
|
I’m still working on a good solution; unfortunately, it’s proving more difficult than expected. |
|
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... |
981322e to
d76af17
Compare
|
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 The current approach therefore adds a 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 |
There was a problem hiding this comment.
🟡 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
Support standard ILabelProvider implementations · New Reset the selected item when selection is cleared · New Preserve the full path for vertical breadcrumb items · New Match tree selections by path, not terminal element · New Dispose drop-down shells when items or viewers are disposed · New Update existing items when providers change · New Capture the shell associated with the queued callback · New Refresh the full viewer when refreshing the root · New Avoid registering the text composite listener twice · New Apply popup relocation before updating cached dimensions · New Propagate refresh results to trigger layout updates · New Guard the last-item lookup when the input is empty · New
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
|
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... |
802545c to
84f3583
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved breadcrumb UI defects can leave labels stale or clipped, discard provider styling, incorrectly hide vertical ancestor labels, misplace drop-downs, and prevent disposed popups from reopening.
8 open issues
Reset drop-down state when its shell is disposed · New Anchor vertical drop-downs using item-local coordinates · New Relayout after label or image presentation changes · New Update reused ancestors before remapping in hash-lookup mode · New Measure vertical breadcrumb width by the widest item · New Persist and apply label-provider foreground, background, and font · New Relayout when element-specific label updates change item width · New Update existing items when providers change
11 resolved since last review
Match tree selections by path, not terminal element Preserve the full path for vertical breadcrumb items Reset the selected item when selection is cleared Support standard ILabelProvider implementations Guard the last-item lookup when the input is empty Propagate refresh results to trigger layout updates Apply popup relocation before updating cached dimensions Avoid registering the text composite listener twice Refresh the full viewer when refreshing the root Capture the shell associated with the queued callback Dispose drop-down shells when items or viewers are disposed
Review effort: Balanced
| 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.
84f3583 to
37670fd
Compare
|
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? |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved breadcrumb defects can leave labels and chains stale, skip visible-item updates, break custom-comparer selection, and throw exceptions for valid null labels.
7 open issues
Normalize null labels before calling SWT setText · New Respect custom comparers in item and path lookups · New Full refresh leaves the breadcrumb chain stale · New Ancestor labels are not refreshed with hash lookup · New Rebuilding chains can erase retained item mappings · New Drop-down position double-counts the item's vertical offset · New Persist and apply label-provider foreground, background, and font
7 resolved since last review
Relayout when element-specific label updates change item width Measure vertical breadcrumb width by the widest item Update reused ancestors before remapping in hash-lookup mode Relayout after label or image presentation changes Anchor vertical drop-downs using item-local coordinates Reset drop-down state when its shell is disposed Update existing items when providers change
Review effort: Balanced
| */ | ||
| @Override | ||
| public void setText(String string) { | ||
| super.setText(string); |
| return null; | ||
|
|
||
| for (BreadcrumbItem item : fBreadcrumbItems) { | ||
| if (item.getData() == element || element.equals(item.getData())) |
| 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; |



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:Breadcrumb*implementation used by JDTTreePathBreadcrumb*implementation used by Debug UIClient-specific behavior remains outside JFace and is exposed through extension hooks where needed.
For JDT, this includes preserving:
TreeViewerFor Debug UI, the corresponding duplicated TreePath breadcrumb implementation can now be removed and replaced with the JFace implementation.
Corresponding pull requests:
Issue:
#4495