CTabFolder: support circular page traversal in MRU mode without chevron#3448
Conversation
Restores the standard focus-traversal behavior in TraversePageHandler by removing the special-casing that was added for CTabFolder (loop-to-first/ last-item logic, hidden-item detection, and the top-level CTabFolder lookup helpers introduced by eclipse-platform#2864 and the earlier fix for eclipse-platform#4135). This special-casing was a workaround for CTabFolder not looping over its own tabs when using Ctrl+PageUp/PageDown. That is now fixed directly in SWT's CTabFolder.onPageTraversal (see eclipse-platform/eclipse.platform.swt#3448), which makes this handler's workaround unnecessary and, in some cases, incorrect (e.g. it bypassed the chevron/drop-down list when tabs did not fit). Requires eclipse-platform/eclipse.platform.swt#3448 to be merged/available for the circular navigation behavior to still work correctly. Fixes eclipse-platform#4135 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
FTR I tested on Windows and Linux (using WSL) and it works es expected. If someone could test it on Mac before Wednesday EOD then we can have it in M2. |
HeikoKlare
left a comment
There was a problem hiding this comment.
I've tested on MacOS and it works as expected for me.
Regarding the snippet: if that is supposed to go into the codebase, it needs to be referenced in the Snippets.md and on the website snippets overview. I wonder if it wouldn't be even better to just extend the CTabFolder tab of the CustomControlExample with an option to activate MRU, as it would allow to test even more combinations easily (I just did when testing this PR) and can in general be more widely used than a quite case-specific snippet.
When setMRUVisible(true) and all tabs fit without a chevron, navigating past the last tab with Ctrl+PageDown (TRAVERSE_PAGE_NEXT) or before the first tab with Ctrl+PageUp (TRAVERSE_PAGE_PREVIOUS) had no effect. Now navigation wraps around to the first/last visible tab respectively, matching the existing behavior of the non-MRU traversal path. Adds a new option to the CTabFolder tab in the CustomControlExample (under: Other > Activate MRU) which demonstrates the before/after behavior. Fixes eclipse-platform/eclipse.platform.ui#4135 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
a335951 to
43eb2a3
Compare
|
This pull request changes some projects for the first time in this development cycle. An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patchFurther information are available in Common Build Issues - Missing version increments. |
|
Thank you for reviewing @HeikoKlare ! I removed the new snippet and added a new option to the The fix can be verified by setting the property to
|
Restores the standard focus-traversal behavior in TraversePageHandler by removing the special-casing that was added for CTabFolder (loop-to-first/ last-item logic, hidden-item detection, and the top-level CTabFolder lookup helpers introduced by #2864 and the earlier fix for #4135). This special-casing was a workaround for CTabFolder not looping over its own tabs when using Ctrl+PageUp/PageDown. That is now fixed directly in SWT's CTabFolder.onPageTraversal (see eclipse-platform/eclipse.platform.swt#3448), which makes this handler's workaround unnecessary and, in some cases, incorrect (e.g. it bypassed the chevron/drop-down list when tabs did not fit). Requires eclipse-platform/eclipse.platform.swt#3448 to be merged/available for the circular navigation behavior to still work correctly. Fixes #4135 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

What
Fixes eclipse-platform/eclipse.platform.ui#4135
CTabFolder.onPageTraversalnow supports circular keyboard page traversal whensetMRUVisible(true)is enabled and all tabs fit without a chevron:SWT.TRAVERSE_PAGE_NEXT) on the last tab now wraps around to the first tab.SWT.TRAVERSE_PAGE_PREVIOUS) on the first tab now wraps around to the last tab.Previously, in MRU mode with no chevron shown, traversing past the last/first tab had no effect at all (selection stayed put).
This only affects the MRU branch of
onPageTraversal. The non-MRU path already wrapped correctly via modulo arithmetic, so its behavior is unchanged. The chevron behavior is intentionally preserved: if there are more tabs than fit and the chevron is shown, traversing past the last/first visible tab still opens the chevron drop-down list exactly as before.How to test
Snippet395(added inexamples/org.eclipse.swt.snippets), which creates aCTabFolderwithsetMRUVisible(true)and 4 tabs that all fit without a chevron.CTabFolderfocus (click a tab) and select the last tab, then press Ctrl+PageDown: it should now wrap to the first tab.Files changed
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.javaexamples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet395.java(new)