@@ -13,7 +13,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
1313import { IMenuService , MenuId , MenuItemAction } from 'vs/platform/actions/common/actions' ;
1414import { ContextAwareMenuEntryActionViewItem , createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem' ;
1515import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
16- import { ITreeView , ITreeItem , TreeItemCollapsibleState , ITreeViewDataProvider , TreeViewItemHandleArg , ITreeViewDescriptor , IViewsRegistry , ViewContainer , ITreeItemLabel , Extensions , IViewDescriptorService , IViewContainersRegistry , ViewContainerLocation } from 'vs/workbench/common/views' ;
16+ import { ITreeView , ITreeItem , TreeItemCollapsibleState , ITreeViewDataProvider , TreeViewItemHandleArg , ITreeViewDescriptor , IViewsRegistry , ITreeItemLabel , Extensions , IViewDescriptorService , ViewContainer , ViewContainerLocation } from 'vs/workbench/common/views' ;
1717import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet' ;
1818import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
1919import { INotificationService } from 'vs/platform/notification/common/notification' ;
@@ -162,8 +162,8 @@ export class CustomTreeView extends Disposable implements ITreeView {
162162 @IProgressService private readonly progressService : IProgressService ,
163163 @IContextMenuService private readonly contextMenuService : IContextMenuService ,
164164 @IKeybindingService private readonly keybindingService : IKeybindingService ,
165- @IViewDescriptorService private readonly viewDescriptorService : IViewDescriptorService ,
166- @INotificationService private readonly notificationService : INotificationService
165+ @INotificationService private readonly notificationService : INotificationService ,
166+ @IViewDescriptorService private readonly viewDescriptorService : IViewDescriptorService
167167 ) {
168168 super ( ) ;
169169 this . root = new Root ( ) ;
@@ -174,10 +174,23 @@ export class CustomTreeView extends Disposable implements ITreeView {
174174 this . doRefresh ( [ this . root ] ) ; /** soft refresh **/
175175 }
176176 } ) ) ;
177+ this . _register ( this . viewDescriptorService . onDidChangeLocation ( ( { views, from, to } ) => {
178+ if ( views . some ( v => v . id === this . id ) ) {
179+ this . tree ?. updateOptions ( { overrideStyles : { listBackground : this . viewLocation === ViewContainerLocation . Sidebar ? SIDE_BAR_BACKGROUND : PANEL_BACKGROUND } } ) ;
180+ }
181+ } ) ) ;
177182
178183 this . create ( ) ;
179184 }
180185
186+ get viewContainer ( ) : ViewContainer {
187+ return this . viewDescriptorService . getViewContainer ( this . id ) ! ;
188+ }
189+
190+ get viewLocation ( ) : ViewContainerLocation {
191+ return this . viewDescriptorService . getViewLocation ( this . id ) ! ;
192+ }
193+
181194 private _dataProvider : ITreeViewDataProvider | undefined ;
182195 get dataProvider ( ) : ITreeViewDataProvider | undefined {
183196 return this . _dataProvider ;
@@ -356,7 +369,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
356369 } ,
357370 multipleSelectionSupport : this . canSelectMany ,
358371 overrideStyles : {
359- listBackground : SIDE_BAR_BACKGROUND
372+ listBackground : this . viewLocation === ViewContainerLocation . Sidebar ? SIDE_BAR_BACKGROUND : PANEL_BACKGROUND
360373 }
361374 } ) as WorkbenchAsyncDataTree < ITreeItem , ITreeItem , FuzzyScore > ) ;
362375 aligner . tree = this . tree ;
0 commit comments