You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The side panel toolbars do not update as expect on onDidChange events associated with the toolbar items currently displayed when the widget occupying the side panel is a ViewContainer.
Steps to Reproduce:
Add a stateful flag to a widget that is displayed as part of a ViewContainer (e.g. the navigator)
Create two commands that manipulate that state and then fire an event.
Make the visibility/enabled functions of the commands depend on the flag on the widget so that exactly one command should always be visible.
Create two tabbar items, one for each of the commands and add an onDidChange for the event fired in step 2.
Open the widget on whose state the commands depend. You should see one tabbar item displayed in the top bar.
Activate the command.
Observe that the visible command disappears, but the other command does not immediately appear.
Focus the widget.
Observe that the second command appears after focus.
Additional Information
What's happening is this:
Under certain conditions, a ViewContainer runs updateTitle
During that function, if it detects that it has only one visible child, it determines what toolbar items would be visible for that child widget at that moment and registers new commands and toolbar items associated with the ViewContainer itself.
When a didChange event is fired by the TabbarToolbarRegistry, that event is not handled by the ViewContainer but by the SidePanelToolbar
The SidePanelToolbar doesn't know about the gymnastics that the ViewContainer has performed, and since the ViewContainer didn't register a handler for the command that wasn't visible at the moment it set the toolbar up, the side panel can't find such a command, and the second command doesn't appear.
Focusing the visible part of the ViewContainer triggers another run of ViewContainer.updateTitle, and the command that should be visible finally gets registered and does appear.
What should probably happen is that if the ViewContainer detects that it has only one visible child, it delegates its toolbar duties completely to the child, rather than simulating delegation by retrieving items from the TabbarToolbarRegistry on the widget's behalf.
An associated problem is that the SCM widget works around this by extracting the widget from the ViewContainer. This is undesirable because it means that even if another widget is added to the ViewContainer, the icons associated with the SCMTreeWidget will always appear in the top sidebar, rather than in the toolbar associated with that widget as part of the view container.
Operating System: RHEL
Theia Version: master (1.9.0)
The text was updated successfully, but these errors were encountered:
In the end, the most straightforward solution (is just to handle TabbarToolbarRegistry.onDidChange in the ViewContainer itself. It might still be desirable to delegate rather than register new commands, but that would require significant rethinking of the current code. I've added the listener to the code in #8966.
Adding that listener causes circular events, so another solution is called for.
Bug Description:
The side panel toolbars do not update as expect on
onDidChange
events associated with the toolbar items currently displayed when the widget occupying the side panel is aViewContainer
.Steps to Reproduce:
onDidChange
for the event fired in step 2.Additional Information
What's happening is this:
ViewContainer
runsupdateTitle
ViewContainer
itself.didChange
event is fired by theTabbarToolbarRegistry
, that event is not handled by theViewContainer
but by theSidePanelToolbar
SidePanelToolbar
doesn't know about the gymnastics that theViewContainer
has performed, and since theViewContainer
didn't register a handler for the command that wasn't visible at the moment it set the toolbar up, the side panel can't find such a command, and the second command doesn't appear.ViewContainer
triggers another run ofViewContainer.updateTitle
, and the command that should be visible finally gets registered and does appear.What should probably happen is that if the
ViewContainer
detects that it has only one visible child, it delegates its toolbar duties completely to the child, rather than simulating delegation by retrieving items from theTabbarToolbarRegistry
on the widget's behalf.An associated problem is that the SCM widget works around this by extracting the widget from the
ViewContainer
. This is undesirable because it means that even if another widget is added to theViewContainer
, the icons associated with theSCMTreeWidget
will always appear in the top sidebar, rather than in the toolbar associated with that widget as part of the view container.master
(1.9.0)The text was updated successfully, but these errors were encountered: