Can i register a toolbar item which can open a widget in the main area?

Yes, that is what i want. So can i do that? Please tell me how? Thx.

You should be able to achieve it by implementing TabBarToolbarContribution. Search theia repo for implementation about how to use it.

I implemented TabBarToolbarContribution and add the below function

registerToolbarItems(toolbarRegistry: TabBarToolbarRegistry): void {

              toolbarRegistry.registerItem({

                id: GettingStartedCommand.id,

                command: GettingStartedCommand.id,

                tooltip: 'Collapse All',

                priority: 0,

            });

  }

, but it doesn’t work. It doesn’t register to the toolbar.

Only if i change the area to ‘left/right’ in the constructor, it works. But that it isn’t what i want? Can i open the widget in the main area and register it to the toolbar in the same time?

constructor() {

        super({

            widgetId: HilensGettingStartedWidget.ID,

            widgetName: HilensGettingStartedWidget.LABEL,

            defaultWidgetOptions: {

                area: 'main',

            },

            toggleCommandId: GettingStartedCommand.id

        });

    }

Could you share the reproducible repo? It is hard to deduce from snippets above what is going wrong. Maybe a command is bogus, or something else.