Theia-ide panel expand and collapse programmatically

Hi All,

I would like to know if there is a way to programmatically expand/collapse widgets in a viewcontainer for example debug panel, has several sub widgets , is there any example, as i tried applicationShell.activateWidget and revealWidget but this only shows the viewContainer when minimised.

Regards,
Abhishek

Hi @abchakra, thank you for your question.

It depends a bit what your starting point is. So in general, every widget inside of a view-container (i.e. the side-panel) is wrapped inside of a ViewContainerPart, which exposes methods to collapse them. You can simply use the collapsed boolean property to collapse/uncollapse them.

Now, to get to the ViewContainerPart you have multiple options: Assuming that you have the ViewContainer, you can simply call getParts on it and find the appropriate view part to collapse.

If you have the Widget, you can use the parent property to find the ViewContainerPart.

If you have none of that, you can use the getWidgets method (or the widgets property) of the ApplicationShell to get all widgets of the side panels, and iterate over them. Most of them should be ViewContainer instances, on which you can use getParts.

1 Like

Thanks this was helpful!!

1 Like