66
77import { ITree , ITreeConfiguration , ITreeOptions } from 'vs/base/parts/tree/browser/tree' ;
88import { List , IListOptions , isSelectionRangeChangeEvent , isSelectionSingleChangeEvent , IMultipleSelectionController , IOpenController } from 'vs/base/browser/ui/list/listWidget' ;
9- import { createDecorator } from 'vs/platform/instantiation/common/instantiation' ;
9+ import { createDecorator , IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
1010import { IDisposable , toDisposable , combinedDisposable , dispose , Disposable } from 'vs/base/common/lifecycle' ;
1111import { IContextKeyService , IContextKey , RawContextKey , ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
1212import { PagedList , IPagedRenderer } from 'vs/base/browser/ui/list/listPaging' ;
@@ -20,7 +20,7 @@ import { mixin } from 'vs/base/common/objects';
2020import { localize } from 'vs/nls' ;
2121import { Registry } from 'vs/platform/registry/common/platform' ;
2222import { Extensions as ConfigurationExtensions , IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry' ;
23- import { DefaultController , IControllerOptions , OpenMode } from 'vs/base/parts/tree/browser/treeDefaults' ;
23+ import { DefaultController , IControllerOptions , OpenMode , ClickBehavior } from 'vs/base/parts/tree/browser/treeDefaults' ;
2424import { isUndefinedOrNull } from 'vs/base/common/types' ;
2525import { IEditorOptions } from 'vs/platform/editor/common/editor' ;
2626import Event , { Emitter } from 'vs/base/common/event' ;
@@ -141,7 +141,7 @@ class OpenController implements IOpenController {
141141}
142142
143143function handleListControllers < T > ( options : IListOptions < T > , configurationService : IConfigurationService ) : IListOptions < T > {
144- if ( options . multipleSelectionSupport === true && ! options . multipleSelectionController ) {
144+ if ( options . multipleSelectionSupport !== false && ! options . multipleSelectionController ) {
145145 options . multipleSelectionController = new MultipleSelectionController ( configurationService ) ;
146146 }
147147
@@ -150,6 +150,14 @@ function handleListControllers<T>(options: IListOptions<T>, configurationService
150150 return options ;
151151}
152152
153+ function handleTreeController ( configuration : ITreeConfiguration , instantiationService : IInstantiationService ) : ITreeConfiguration {
154+ if ( ! configuration . controller ) {
155+ configuration . controller = instantiationService . createInstance ( WorkbenchTreeController , { clickBehavior : ClickBehavior . ON_MOUSE_UP } ) ;
156+ }
157+
158+ return configuration ;
159+ }
160+
153161export class WorkbenchList < T > extends List < T > {
154162
155163 readonly contextKeyService : IContextKeyService ;
@@ -266,9 +274,10 @@ export class WorkbenchTree extends Tree {
266274 @IContextKeyService contextKeyService : IContextKeyService ,
267275 @IListService listService : IListService ,
268276 @IThemeService themeService : IThemeService ,
277+ @IInstantiationService instantiationService : IInstantiationService ,
269278 @IConfigurationService private configurationService : IConfigurationService
270279 ) {
271- super ( container , configuration , mixin ( options , { keyboardSupport : false } as ITreeOptions , false ) ) ;
280+ super ( container , handleTreeController ( configuration , instantiationService ) , mixin ( options , { keyboardSupport : false } as ITreeOptions , false ) ) ;
272281
273282 this . contextKeyService = createScopedContextKeyService ( contextKeyService , this ) ;
274283 this . listDoubleSelection = WorkbenchListDoubleSelection . bindTo ( this . contextKeyService ) ;
0 commit comments