@@ -27,6 +27,8 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
2727import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
2828import { PaneComposite } from 'vs/workbench/browser/panecomposite' ;
2929import { Separator } from 'vs/base/browser/ui/actionbar/actionbar' ;
30+ import { ContextSubMenu } from 'vs/base/browser/contextmenu' ;
31+ import { Event } from 'vs/base/common/event' ;
3032
3133export abstract class Viewlet extends PaneComposite implements IViewlet {
3234
@@ -43,6 +45,10 @@ export abstract class Viewlet extends PaneComposite implements IViewlet {
4345 @IConfigurationService protected configurationService : IConfigurationService
4446 ) {
4547 super ( id , viewPaneContainer , telemetryService , storageService , instantiationService , themeService , contextMenuService , extensionService , contextService ) ;
48+ this . _register ( Event . any ( viewPaneContainer . onDidAddViews , viewPaneContainer . onDidRemoveViews ) ( ( ) => {
49+ // Update title area since there is no better way to update secondary actions
50+ this . updateTitleArea ( ) ;
51+ } ) ) ;
4652 }
4753
4854 getContextMenuActions ( ) : IAction [ ] {
@@ -60,6 +66,24 @@ export abstract class Viewlet extends PaneComposite implements IViewlet {
6066 run : ( ) => this . layoutService . setSideBarHidden ( true )
6167 } ] ;
6268 }
69+
70+ getSecondaryActions ( ) : IAction [ ] {
71+ const viewSecondaryActions = this . viewPaneContainer . getViewsVisibilityActions ( ) ;
72+ const secondaryActions = this . viewPaneContainer . getSecondaryActions ( ) ;
73+ if ( viewSecondaryActions . length <= 1 ) {
74+ return secondaryActions ;
75+ }
76+
77+ if ( secondaryActions . length === 0 ) {
78+ return viewSecondaryActions ;
79+ }
80+
81+ return [
82+ new ContextSubMenu ( nls . localize ( 'views' , "Views" ) , viewSecondaryActions ) ,
83+ new Separator ( ) ,
84+ ...secondaryActions
85+ ] ;
86+ }
6387}
6488
6589/**
0 commit comments