@@ -170,7 +170,6 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
170170
171171 private parts : Map < string , Part > = new Map < string , Part > ( ) ;
172172
173- private sidebarPart : SidebarPart ;
174173 private statusbarPart : StatusbarPart ;
175174
176175 constructor (
@@ -434,10 +433,6 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
434433 serviceCollection . set ( IContextMenuService , new SyncDescriptor ( NativeContextMenuService ) ) ;
435434 }
436435
437- // Viewlet service (sidebar part)
438- this . sidebarPart = this . instantiationService . createInstance ( SidebarPart ) ;
439- serviceCollection . set ( IViewletService , this . sidebarPart ) ; // TODO@Ben use SyncDescriptor
440-
441436 // Contributed services
442437 const contributedServices = getServices ( ) ;
443438 for ( let contributedService of contributedServices ) {
@@ -578,7 +573,7 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
578573 private createSidebarPart ( ) : void {
579574 const sidebarPartContainer = this . createPart ( Parts . SIDEBAR_PART , 'complementary' , 'sidebar' , this . state . sideBar . position === Position . LEFT ? 'left' : 'right' ) ;
580575
581- this . sidebarPart . create ( sidebarPartContainer ) ;
576+ this . parts . get ( Parts . SIDEBAR_PART ) . create ( sidebarPartContainer ) ;
582577 }
583578
584579 private createPanelPart ( ) : void {
@@ -774,6 +769,7 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
774769 private editorService : IEditorService ;
775770 private editorGroupService : IEditorGroupsService ;
776771 private panelService : IPanelService ;
772+ private viewletService : IViewletService ;
777773
778774 private readonly state = {
779775 fullscreen : false ,
@@ -928,6 +924,7 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
928924
929925 private setSideBarPosition ( position : Position ) : void {
930926 const activityBar = this . parts . get ( Parts . ACTIVITYBAR_PART ) ;
927+ const sideBar = this . parts . get ( Parts . SIDEBAR_PART ) ;
931928 const wasHidden = this . state . sideBar . hidden ;
932929
933930 if ( this . state . sideBar . hidden ) {
@@ -940,13 +937,13 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
940937
941938 // Adjust CSS
942939 removeClass ( activityBar . getContainer ( ) , oldPositionValue ) ;
943- removeClass ( this . sidebarPart . getContainer ( ) , oldPositionValue ) ;
940+ removeClass ( sideBar . getContainer ( ) , oldPositionValue ) ;
944941 addClass ( activityBar . getContainer ( ) , newPositionValue ) ;
945- addClass ( this . sidebarPart . getContainer ( ) , newPositionValue ) ;
942+ addClass ( sideBar . getContainer ( ) , newPositionValue ) ;
946943
947944 // Update Styles
948945 activityBar . updateStyles ( ) ;
949- this . sidebarPart . updateStyles ( ) ;
946+ sideBar . updateStyles ( ) ;
950947
951948 // Layout
952949 if ( this . workbenchGrid instanceof Grid ) {
@@ -1149,7 +1146,7 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
11491146 case Parts . ACTIVITYBAR_PART :
11501147 return this . parts . get ( Parts . ACTIVITYBAR_PART ) . getContainer ( ) ;
11511148 case Parts . SIDEBAR_PART :
1152- return this . sidebarPart . getContainer ( ) ;
1149+ return this . parts . get ( Parts . SIDEBAR_PART ) . getContainer ( ) ;
11531150 case Parts . PANEL_PART :
11541151 return this . parts . get ( Parts . PANEL_PART ) . getContainer ( ) ;
11551152 case Parts . EDITOR_PART :
@@ -1323,16 +1320,17 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
13231320 }
13241321
13251322 private createWorkbenchLayout ( ) : void {
1326- const titlePart = this . parts . get ( Parts . TITLEBAR_PART ) ;
1323+ const titleBar = this . parts . get ( Parts . TITLEBAR_PART ) ;
13271324 const editorPart = this . parts . get ( Parts . EDITOR_PART ) ;
13281325 const activityBar = this . parts . get ( Parts . ACTIVITYBAR_PART ) ;
13291326 const panelPart = this . parts . get ( Parts . PANEL_PART ) ;
1327+ const sideBar = this . parts . get ( Parts . SIDEBAR_PART ) ;
13301328
13311329 if ( this . configurationService . getValue ( 'workbench.useExperimentalGridLayout' ) ) {
13321330
13331331 // Create view wrappers for all parts
1334- this . titleBarPartView = new View ( titlePart ) ;
1335- this . sideBarPartView = new View ( this . sidebarPart ) ;
1332+ this . titleBarPartView = new View ( titleBar ) ;
1333+ this . sideBarPartView = new View ( sideBar ) ;
13361334 this . activityBarPartView = new View ( activityBar ) ;
13371335 this . editorPartView = new View ( editorPart ) ;
13381336 this . panelPartView = new View ( panelPart ) ;
@@ -1347,10 +1345,10 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
13471345 this . container ,
13481346 this . workbench ,
13491347 {
1350- titlebar : titlePart ,
1348+ titlebar : titleBar ,
13511349 activitybar : activityBar ,
13521350 editor : editorPart ,
1353- sidebar : this . sidebarPart ,
1351+ sidebar : sideBar ,
13541352 panel : panelPart ,
13551353 statusbar : this . statusbarPart ,
13561354 }
@@ -1557,8 +1555,8 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
15571555 }
15581556
15591557 // If sidebar becomes hidden, also hide the current active Viewlet if any
1560- if ( hidden && this . sidebarPart . getActiveViewlet ( ) ) {
1561- this . sidebarPart . hideActiveViewlet ( ) ;
1558+ if ( hidden && this . viewletService . getActiveViewlet ( ) ) {
1559+ this . viewletService . hideActiveViewlet ( ) ;
15621560
15631561 // Pass Focus to Editor or Panel if Sidebar is now hidden
15641562 const activePanel = this . panelService . getActivePanel ( ) ;
@@ -1570,12 +1568,12 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
15701568 }
15711569
15721570 // If sidebar becomes visible, show last active Viewlet or default viewlet
1573- else if ( ! hidden && ! this . sidebarPart . getActiveViewlet ( ) ) {
1574- const viewletToOpen = this . sidebarPart . getLastActiveViewletId ( ) ;
1571+ else if ( ! hidden && ! this . viewletService . getActiveViewlet ( ) ) {
1572+ const viewletToOpen = this . viewletService . getLastActiveViewletId ( ) ;
15751573 if ( viewletToOpen ) {
1576- const viewlet = this . sidebarPart . openViewlet ( viewletToOpen , true ) ;
1574+ const viewlet = this . viewletService . openViewlet ( viewletToOpen , true ) ;
15771575 if ( ! viewlet ) {
1578- this . sidebarPart . openViewlet ( this . sidebarPart . getDefaultViewletId ( ) , true ) ;
1576+ this . viewletService . openViewlet ( this . viewletService . getDefaultViewletId ( ) , true ) ;
15791577 }
15801578 }
15811579 }
0 commit comments