NextTab action: allow Cycling when reaching the end #1874
+48
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Specifically for CTabFolders, this commit detects when the NextTab action has reached the last item and will cycle to the first item instead of doing nothing. It will load the item which is displayed in that page.
(achieved by pressing Ctrl + pgdown)
This fix only works for CTabFolders: the "traverse"-Method only returns whether it performed something or nothing. However, it also returns true if it effectively performed nothing but actually couldn't because it was on the last item.
For CTabFolders, I can check whether we are on the last item and manually jump to the second-to last item in the row. By jumping to the second-to-last item, I can still perform the "normal action" performed by SWT for traverse, which means that all Components are loaded correctly and the chevron is shown correctly.
I could not find a good general API which would allow to tell in general which tab I am on.
However, all of the "normal" views use a CTabFolder, so the loss of generality is minimal