Repository navigation
Name a raised pane by its canonical name, not its title - #19300
Conversation
A pane that raises itself during a zoom of another pane names itself in an ActivatePaneEvent, and the zoom moves to the tab that event selects. Only Help's raise was covered. Add Go To Working Directory, a new plot, a page in the Viewer, Clear Workspace and Clear History during a Console zoom, each checking that the zoom lands on its own tab, and check that entering the debugger selects the Environment tab. Addresses #19234
WorkbenchPane.bringToFront() fired ActivatePaneEvent with the pane's
display title, which is localized ("Aide" for Help in French).
PaneManager only knows the canonical names (HELP_PANE etc.), so it
dropped the event, and a zoom the raise moved took the previously
activated tab. WorkbenchPane now takes the canonical name alongside the
title and fires that. Entering the debugger named Environment by its
localized title the same way and now uses ENVIRONMENT_PANE.
The Help menu commands no longer fire Help's own ActivatePaneEvent
before raising HelpPane, since the raise now names Help itself.
The English titles equal the canonical names except Chat ("Posit
Assistant"), and ChatPane never raises itself, so English behavior is
unchanged.
Addresses #19234
Clear History is disabled while History shows search results or a command's context, and an earlier test (history_a11y) can leave it in either. The Clear History raise test now runs historyDismissResults first, which returns it to the recent list from both. Passes with history_a11y run before it in the same worker. Addresses #19234
The Viewer raise test assigned `f` in the global environment and left its page in the Viewer. It now runs in local() and clears the Viewer afterwards. Also list the debugger-entry test in debugger_extras's header. Addresses #19234
gtritchie
left a comment
There was a problem hiding this comment.
Five findings, three of them inline. One that doesn't fit inline:
Presentation2Pane still raises without naming itself (pre-existing, same class of bug). Presentation2.onPresentationPreview calls display_.activate() (Presentation2.java:140), which calls bringToFront() (Presentation2Pane.java:167). The pane uses the one-argument constructor (Presentation2Pane.java:65), so no ActivatePaneEvent fires. WorkbenchTabPanel passes EnsureVisible up (WorkbenchTabPanel.java:284) before it selects the tab (:286), so PaneManager moves the zoom with whatever lastSelectedTab_ holds (PaneManager.java:546). During a Console zoom that is Console: the quadrant holding Presentation gets maximized while Zoom Console stays checked. Giving the pane PaneManager.PRESENTATIONS_PANE and the event bus would fix it, or see the note on WorkbenchPane.java:108.
Help.onShowHelp activates Help twice (Help.java:187). HelpPane doesn't override bringToFront(), so view_.showHelp() (HelpPane.java:842) now fires ActivatePaneEvent(HELP_PANE) as it raises the pane. The presenter's bringToFront() after it (Help.java:190) fires the same event again. Before this PR, that call was the only one that named Help in a non-English UI; now it can go. (See also the inline note on onHelpHome.)
| if (events_ != null && !StringUtil.isNullOrEmpty(title_)) | ||
| events_.fireEvent(new ActivatePaneEvent(title_)); | ||
| if (events_ != null && !StringUtil.isNullOrEmpty(paneName_)) | ||
| events_.fireEvent(new ActivatePaneEvent(paneName_)); |
There was a problem hiding this comment.
Each subclass now has to pass a name that tabForName (PaneManager.java:3311) recognizes, and a pane that leaves it out or mistypes it fails silently: the zoom moves with a stale lastSelectedTab_ (Presentation2 today; see the review body). The EnsureVisible handler in WorkbenchTabPanel (WorkbenchTabPanel.java:279) already holds the raised WorkbenchTab, and PaneManager maps WorkbenchTab to Tab in wbTabToTab_ (PaneManager.java:3272). Reporting the raised tab through that path would cover every pane without a string per pane.
Moving tabPanel_.selectTab(widget) ahead of the upward fireEvent wouldn't be enough on its own: TabLayoutPanel.selectTab returns early when the tab is already selected, so no selection event would update lastSelectedTab_.
| } | ||
| // Commands handled by Shim for activation from main menu context. These raise | ||
| // the pane itself, as a help topic does, so it can take over a zoom or reopen | ||
| // a shut column; bringToFront() only activates the tab. |
There was a problem hiding this comment.
Nit: "bringToFront() only activates the tab" means the presenter's Help.bringToFront(), but it sits directly above four calls to view_.bringToFront(), which does raise the pane. Writing "the presenter's bringToFront()" would remove the ambiguity.
| // Commands handled by Shim for activation from main menu context. These raise | ||
| // the pane itself, as a help topic does, so it can take over a zoom or reopen | ||
| // a shut column; bringToFront() only activates the tab. | ||
| public void onHelpHome() { view_.bringToFront(); home(); } |
There was a problem hiding this comment.
home() goes through showHelp() to HelpPane.showHelp(), which already calls bringToFront() (HelpPane.java:845). So the leading view_.bringToFront() raises the pane a second time. This predates the PR (the old raise() did the same), but this line is being rewritten anyway.
| WorkbenchServerOperations server) | ||
| { | ||
| super(constants_.terminalText(), events); | ||
| super(constants_.terminalText(), PaneManager.TERMINAL_PANE, events); |
There was a problem hiding this comment.
tabForName has no TERMINAL_PANE case, so the ActivatePaneEvent this pane fires is always dropped. That's harmless: Terminal lives in the Console window, and a zoom that moves there is Console's either way. But it reads as if Terminal's raise selects a tab by name like the others. The one-argument constructor, as ConsolePane uses, would make that explicit.
HelpPane.showHelp() raises the pane, which now names it as Help. So onShowHelp no longer fires Help's ActivatePaneEvent after it, and Help Home no longer raises the pane before home() raises it again. The comment above the Help commands now says it is the presenter's bringToFront() that only activates the tab. All tests under tests/panes/help and the Help and Console-zoom tests in zoom_inert pass (17 passed). Addresses #19234
PaneManager has no tab for Terminal, so the TERMINAL_PANE name it fired was always dropped, as its "Terminal" title was before. Pass null so the pane fires no ActivatePaneEvent, which says so. It keeps the event bus, which it uses for its own handlers. Addresses #19234
The History tab's shim forwards only Load and Save History, so Clear History has no handler until the History pane has loaded. The test only passed when an earlier test in the run (history()) had loaded it; run on its own, the command did nothing and no confirmation appeared. It now activates History first, then reselects Environment so the raise still has to select History. Passes run alone with the other raise tests, twice. Addresses #19234
Help Home now relies on home() to raise the Help pane, so check that it moves a Console zoom to Help like the other pane raises. Addresses #19234
History is delay-loaded, so activateHistory can return before the History presenter has bound its command handlers, and the commands that follow would do nothing. The Clear History test now waits for the pane's Console History list, which renders only once the presenter exists, before running historyDismissResults and clearHistory. It waits for the list to be attached rather than visible, since an earlier test can leave History showing search results. Passes alone and after history_a11y in the same worker. Addresses #19234
…se-canonical-name
RStudio E2E - all platforms4 test(s) failed
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
When a pane raises itself,
WorkbenchPane.bringToFront()fires anActivatePaneEventnaming the pane, and a zoom of another pane moves to the tab that event selects. The event carried the pane's display title, which is localized ("Aide" for Help in French).PaneManager.tabForName()only knows the canonical names, so it dropped the event, and the moved zoom took whichever tab was activated before.WorkbenchPanetakes the pane's canonical name (PaneManager.HELP_PANEetc.) alongside its title, and names itself with it. Panes without an event bus use the one-argument constructor, asConsolePanenow does.TerminalPanepasses no name, sincePaneManagerhas no tab for it.ENVIRONMENT_PANErather than its localized title.ActivatePaneEventalongside a raise ofHelpPane(the Help menu commands, a help topic), and Help Home no longer raises the pane beforehome()raises it, since the raise now names Help itself.The English titles equal the canonical names except Chat ("Posit Assistant"), and nothing raises
ChatPane, so English behavior is unchanged.Tests: during a Console zoom, Help Home, Go To Working Directory, a new plot, a page in the Viewer, Clear Workspace and Clear History each move the zoom to their own tab; entering the debugger selects the Environment tab. With seven panes given a wrong canonical name, these tests fail; all pass on this branch, as does the existing French Search R Help test.
Fixes #19234.