Skip to content

CTabFolder: support circular page traversal in MRU mode without chevron#3448

Merged
fedejeanne merged 2 commits into
eclipse-platform:masterfrom
fedejeanne:ctabfolder-circular-page-traversal
Jul 22, 2026
Merged

CTabFolder: support circular page traversal in MRU mode without chevron#3448
fedejeanne merged 2 commits into
eclipse-platform:masterfrom
fedejeanne:ctabfolder-circular-page-traversal

Conversation

@fedejeanne

@fedejeanne fedejeanne commented Jul 17, 2026

Copy link
Copy Markdown
Member

What

Fixes eclipse-platform/eclipse.platform.ui#4135

CTabFolder.onPageTraversal now supports circular keyboard page traversal when setMRUVisible(true) is enabled and all tabs fit without a chevron:

  • Pressing Ctrl+PageDown (SWT.TRAVERSE_PAGE_NEXT) on the last tab now wraps around to the first tab.
  • Pressing Ctrl+PageUp (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

  1. Run Snippet395 (added in examples/org.eclipse.swt.snippets), which creates a CTabFolder with setMRUVisible(true) and 4 tabs that all fit without a chevron.
  2. Give the CTabFolder focus (click a tab) and select the last tab, then press Ctrl+PageDown: it should now wrap to the first tab.
  3. Select the first tab and press Ctrl+PageUp: it should now wrap to the last tab.
  4. Resize the window (make it narrower) so that the chevron appears (more tabs than fit), and confirm this PR preserves the original behavior: traversing past the last/first visible tab opens the chevron drop-down list instead of wrapping around.

Files changed

  • bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
  • examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet395.java (new)

fedejeanne added a commit to fedejeanne/eclipse.platform.ui that referenced this pull request Jul 17, 2026
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>
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Test Results

  200 files  ±0    200 suites  ±0   28m 3s ⏱️ +31s
4 744 tests ±0  4 720 ✅ ±0   24 💤 ±0  0 ❌ ±0 
6 892 runs  ±0  6 724 ✅ ±0  168 💤 ±0  0 ❌ ±0 

Results for commit 0186ea6. ± Comparison against base commit c76abe1.

♻️ This comment has been updated with latest results.

@fedejeanne

Copy link
Copy Markdown
Member Author

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 HeikoKlare 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'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>
@fedejeanne
fedejeanne force-pushed the ctabfolder-circular-page-traversal branch from a335951 to 43eb2a3 Compare July 21, 2026 12:04
@eclipse-platform-bot

Copy link
Copy Markdown
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF

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 patch
From b919c02a45d31c478825518494981fd0a05e5192 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Tue, 21 Jul 2026 12:06:58 +0000
Subject: [PATCH] Version bump(s) for 4.41 stream


diff --git a/examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF b/examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF
index b7b9968fa3..c078217c52 100644
--- a/examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.swt.examples/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %plugin.SWTStandaloneExampleSet.name
 Bundle-SymbolicName: org.eclipse.swt.examples; singleton:=true
-Bundle-Version: 3.109.100.qualifier
+Bundle-Version: 3.109.200.qualifier
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Bundle-RequiredExecutionEnvironment: JavaSE-21
-- 
2.54.0

Further information are available in Common Build Issues - Missing version increments.

@fedejeanne

Copy link
Copy Markdown
Member Author

Thank you for reviewing @HeikoKlare ! I removed the new snippet and added a new option to the CTabFolder tab of the CustomControlExample instead.

The fix can be verified by setting the property to true:

image

@fedejeanne
fedejeanne merged commit 2cb22d1 into eclipse-platform:master Jul 22, 2026
31 of 32 checks passed
@fedejeanne
fedejeanne deleted the ctabfolder-circular-page-traversal branch July 22, 2026 09:38
fedejeanne added a commit to eclipse-platform/eclipse.platform.ui that referenced this pull request Jul 22, 2026
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>
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.

'Tab' navigatin Bug. Ctrl+PageUp -> Next Tab, Ctrl+PageDown -> Previous Tab.

3 participants