Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ public final Object execute(final ExecutionEvent event) {
int traversalDirection = translateToTraversalDirection(forward);
Control control = focusControl;
do {
if (control instanceof CTabFolder folder && !isRootCTabFolder(folder)) {
// For multi-page editors, we want to skip inner CTabFolders
// If not skipped there are two issues:
// 1. loopToFirstOrLastItem would change the selection of the inner CTabFolder
// 2. control.traverse itself would navigate up to the outer CTabFolder and
// navigate there
control = control.getParent();
Copy link
Member

Choose a reason for hiding this comment

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

Just a guess, but I think you should have navigated all the way to the top with a loop, just to be sure you're navigating on the "Editor Area" and not inside a multi-page editor.

In any case, I plan to merge #3558 and added you and Matthias as co-authors :-)

continue;
}
if (control instanceof CTabFolder folder && isFinalItemInCTabFolder(folder, forward)
&& !hasHiddenItem(folder)) {
loopToFirstOrLastItem(folder, forward);
Expand All @@ -59,6 +68,15 @@ public final Object execute(final ExecutionEvent event) {
return null;
}

private boolean isRootCTabFolder(CTabFolder folder) {
for (var current = folder.getParent(); current != null; current = current.getParent()) {
if (current instanceof CTabFolder) {
return false;
}
}
return true;
}

private boolean hasHiddenItem(CTabFolder folder) {
return Arrays.stream(folder.getItems()).anyMatch(i -> !i.isShowing());
}
Expand Down
Loading