@@ -9,7 +9,7 @@ import { ActionsOrientation, ActionBar } from 'vs/base/browser/ui/actionbar/acti
99import { GLOBAL_ACTIVITY_ID , IActivity } from 'vs/workbench/common/activity' ;
1010import { Registry } from 'vs/platform/registry/common/platform' ;
1111import { Part } from 'vs/workbench/browser/part' ;
12- import { GlobalActivityActionViewItem , ViewletActivityAction , ToggleViewletAction , PlaceHolderToggleCompositePinnedAction , PlaceHolderViewletActivityAction , AccountsActionViewItem } from 'vs/workbench/browser/parts/activitybar/activitybarActions' ;
12+ import { GlobalActivityActionViewItem , ViewletActivityAction , ToggleViewletAction , PlaceHolderToggleCompositePinnedAction , PlaceHolderViewletActivityAction , AccountsActionViewItem , HomeAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions' ;
1313import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet' ;
1414import { IBadge , NumberBadge } from 'vs/workbench/services/activity/common/activity' ;
1515import { IWorkbenchLayoutService , Parts , Position as SideBarPosition } from 'vs/workbench/services/layout/browser/layoutService' ;
@@ -20,7 +20,7 @@ import { IThemeService, IColorTheme } from 'vs/platform/theme/common/themeServic
2020import { ACTIVITY_BAR_BACKGROUND , ACTIVITY_BAR_BORDER , ACTIVITY_BAR_FOREGROUND , ACTIVITY_BAR_ACTIVE_BORDER , ACTIVITY_BAR_BADGE_BACKGROUND , ACTIVITY_BAR_BADGE_FOREGROUND , ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND , ACTIVITY_BAR_INACTIVE_FOREGROUND , ACTIVITY_BAR_ACTIVE_BACKGROUND } from 'vs/workbench/common/theme' ;
2121import { contrastBorder } from 'vs/platform/theme/common/colorRegistry' ;
2222import { CompositeBar , ICompositeBarItem , CompositeDragAndDrop } from 'vs/workbench/browser/parts/compositeBar' ;
23- import { Dimension , addClass , removeNode , addClasses } from 'vs/base/browser/dom' ;
23+ import { Dimension , addClass , removeNode } from 'vs/base/browser/dom' ;
2424import { IStorageService , StorageScope , IWorkspaceStorageChangeEvent } from 'vs/platform/storage/common/storage' ;
2525import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions' ;
2626import { URI , UriComponents } from 'vs/base/common/uri' ;
@@ -86,10 +86,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
8686
8787 private content : HTMLElement | undefined ;
8888
89- private homeIndicatorActionLabel : HTMLAnchorElement | undefined = undefined ;
90-
91- private menubar : CustomMenubarControl | undefined ;
92- private menubarContainer : HTMLElement | undefined ;
89+ private menuBar : CustomMenubarControl | undefined ;
90+ private menuBarContainer : HTMLElement | undefined ;
9391
9492 private compositeBar : CompositeBar ;
9593
@@ -297,25 +295,25 @@ export class ActivitybarPart extends Part implements IActivityBarService {
297295 }
298296
299297 private uninstallMenubar ( ) {
300- if ( this . menubar ) {
301- this . menubar . dispose ( ) ;
298+ if ( this . menuBar ) {
299+ this . menuBar . dispose ( ) ;
302300 }
303301
304- if ( this . menubarContainer ) {
305- removeNode ( this . menubarContainer ) ;
302+ if ( this . menuBarContainer ) {
303+ removeNode ( this . menuBarContainer ) ;
306304 }
307305 }
308306
309307 private installMenubar ( ) {
310- this . menubarContainer = document . createElement ( 'div' ) ;
311- addClass ( this . menubarContainer , 'menubar' ) ;
308+ this . menuBarContainer = document . createElement ( 'div' ) ;
309+ addClass ( this . menuBarContainer , 'menubar' ) ;
312310
313311 const content = assertIsDefined ( this . content ) ;
314- content . prepend ( this . menubarContainer ) ;
312+ content . prepend ( this . menuBarContainer ) ;
315313
316314 // Menubar: install a custom menu bar depending on configuration
317- this . menubar = this . _register ( this . instantiationService . createInstance ( CustomMenubarControl ) ) ;
318- this . menubar . create ( this . menubarContainer ) ;
315+ this . menuBar = this . _register ( this . instantiationService . createInstance ( CustomMenubarControl ) ) ;
316+ this . menuBar . create ( this . menuBarContainer ) ;
319317 }
320318
321319 createContentArea ( parent : HTMLElement ) : HTMLElement {
@@ -328,7 +326,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
328326 // Home action bar
329327 const homeIndicator = this . environmentService . options ?. homeIndicator ;
330328 if ( homeIndicator ) {
331- this . createHomeBar ( homeIndicator . href , homeIndicator . title , homeIndicator . icon ) ;
329+ this . createHomeBar ( homeIndicator . command , homeIndicator . title , homeIndicator . icon ) ;
332330 }
333331
334332 // Install menubar if compact
@@ -349,33 +347,28 @@ export class ActivitybarPart extends Part implements IActivityBarService {
349347 return this . content ;
350348 }
351349
352- private createHomeBar ( href : string , title : string , icon : string ) : void {
350+ private createHomeBar ( command : string , title : string , icon : string ) : void {
353351 const homeBarContainer = document . createElement ( 'div' ) ;
354352 homeBarContainer . setAttribute ( 'aria-label' , nls . localize ( 'homeIndicator' , "Home" ) ) ;
355353 homeBarContainer . setAttribute ( 'role' , 'toolbar' ) ;
356354 addClass ( homeBarContainer , 'home-bar' ) ;
357355
358- const content = assertIsDefined ( this . content ) ;
359- content . prepend ( homeBarContainer ) ;
356+ const homeActionBar = this . _register ( new ActionBar ( homeBarContainer , {
357+ orientation : ActionsOrientation . VERTICAL ,
358+ animated : false
359+ } ) ) ;
360360
361- this . homeIndicatorActionLabel = document . createElement ( 'a' ) ;
362- this . homeIndicatorActionLabel . tabIndex = 0 ;
363- this . homeIndicatorActionLabel . title = title ;
364- this . homeIndicatorActionLabel . setAttribute ( 'aria-label' , title ) ;
365- this . homeIndicatorActionLabel . setAttribute ( 'role' , 'button' ) ;
366- this . homeIndicatorActionLabel . href = href ;
367- addClasses ( this . homeIndicatorActionLabel , 'action-label' , 'codicon' , `codicon-${ icon } ` ) ;
361+ homeActionBar . push ( this . _register ( this . instantiationService . createInstance ( HomeAction , command , title , icon ) ) , { icon : true , label : false } ) ;
368362
369- homeBarContainer . appendChild ( this . homeIndicatorActionLabel ) ;
363+ const content = assertIsDefined ( this . content ) ;
364+ content . prepend ( homeBarContainer ) ;
370365 }
371366
372367 updateStyles ( ) : void {
373368 super . updateStyles ( ) ;
374369
375- // Part container
376370 const container = assertIsDefined ( this . getContainer ( ) ) ;
377371 const background = this . getColor ( ACTIVITY_BAR_BACKGROUND ) || '' ;
378- const forground = this . getColor ( ACTIVITY_BAR_FOREGROUND ) || '' ;
379372 container . style . backgroundColor = background ;
380373
381374 const borderColor = this . getColor ( ACTIVITY_BAR_BORDER ) || this . getColor ( contrastBorder ) || '' ;
@@ -387,11 +380,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
387380 container . style . borderLeftWidth = borderColor && ! isPositionLeft ? '1px' : '' ;
388381 container . style . borderLeftStyle = borderColor && ! isPositionLeft ? 'solid' : '' ;
389382 container . style . borderLeftColor = ! isPositionLeft ? borderColor : '' ;
390-
391- // Home action label
392- if ( this . homeIndicatorActionLabel ) {
393- this . homeIndicatorActionLabel . style . color = forground ;
394- }
395383 }
396384
397385 private getActivitybarItemColors ( theme : IColorTheme ) : ICompositeBarColors {
@@ -601,8 +589,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
601589 if ( this . globalActivityActionBar ) {
602590 availableHeight -= ( this . globalActivityActionBar . viewItems . length * ActivitybarPart . ACTION_HEIGHT ) ; // adjust height for global actions showing
603591 }
604- if ( this . menubarContainer ) {
605- availableHeight -= this . menubarContainer . clientHeight ;
592+ if ( this . menuBarContainer ) {
593+ availableHeight -= this . menuBarContainer . clientHeight ;
606594 }
607595 this . compositeBar . layout ( new Dimension ( width , availableHeight ) ) ;
608596 }
0 commit comments