Opening a left panel widget in main area

Hi all,

I have a widget view that i registered in the ‘main’ area. But i want my widget to be accessible via left panel like when i register its area as ‘left’.

Question: Is it possible to open a widget in main area but have its icon always visible in left panel?

Thanks!

@fatihhtoker it is not possible by default, and would likely require you to customize the default behaviour in a custom extension to achieve the use-case.

Hey @vince-fugnitto

it is not possible by default

I thought so after spent hours to change the behaviour. :face_with_head_bandage:

I have something in my mind that i think it would work though. And i have few questions:

  • Do you think using a different widget in the SidePanel to open my main widget in main area would work?
  • To achieve that i need to customize the click event on my SidePanel widget so that it opens another widget. Is it possible? (If not, i think opening the main widget in side widget’s onInit and close itself might work.)
  • I’ve dug into the source code and looked into the settings widget. That’s almost what i want as a behaviour. But instead of a menu, i want to reach directly the click event. Does bottom of the SidePanel have an API that lets me put custom widget in there? (Putting the ‘always-visible’ widget to the bottom of the SidePanel would be even nicer!)
  • What would be your approach to such a use-case?

I know there is a lot of questions but all of them related to each other i guess. This is more important than it seems for me to unblock many other widgets i am working on.

Thanks!

@fatihhtoker you might be able to get around actually customizing the default behavior (likely application-shell) by making your widget a composition of a side-panel + main area component. Essentially, your widget would have two parts, a sidepanel part (which will show up docked in the sidepanel), and when opened it will have it’s main content in the main-area.

  • Do you think using a different widget in the SidePanel to open my main widget in main area would work?

I believe it may be what I described, having a widget that has both a side-panel + main area part.

  • To achieve that i need to customize the click event on my SidePanel widget so that it opens another widget. Is it possible? (If not, i think opening the main widget in side widget’s onInit and close itself might work.)

I think either or may work. The idea is that when the widget is opened (openView) it will handle opening both parts of the widget. You can then look what might be necessary when the widget is disposed (closed) to cleanup accordingly.

  • I’ve dug into the source code and looked into the settings widget. That’s almost what i want as a behaviour. But instead of a menu, i want to reach directly the click event. Does bottom of the SidePanel have an API that lets me put custom widget in there? (Putting the ‘always-visible’ widget to the bottom of the SidePanel would be even nicer!)

I’m not exactly sure what you’re referring to, perhaps a screencast or screenshot may help :slight_smile:
If you’re referring to the bottom of the sidebar (where we have the settings icon), then yes I believe you can add widgets there. You can look at how it was implemented if you’d like: https://github.com/eclipse-theia/theia/pull/8372/files.

If you’re referring to the bottom of the sidebar

Yes, that’s what i was referring to.

making your widget a composition of a side-panel + main area component.

I believe this is the way to go. I’ve also encountered Theia Trace Extension while researching that. It uses a composition of both areas for the widget like you described. But i couldn’t find the part that actaully opens the widget in the main area. Can you show me that part @vince-fugnitto ?

@fatihhtoker I’m not a maintainer on that project but it looks like they have both the explorer part (sidebar) and the viewer (main):

The explorer likely lists traces that are then opened in the main-area.

1 Like

Thanks, @vince-fugnitto. I’ll look into that.