mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-30 18:46:00 +01:00
fix a couple of list/tree issues to enable testing
This commit is contained in:
@@ -253,7 +253,8 @@ class Controller extends WorkbenchTreeController {
|
||||
}
|
||||
|
||||
var result = super.onClick(tree, element, event);
|
||||
if (event.ctrlKey || event.metaKey || event.altKey) {
|
||||
var openToSide = event.ctrlKey || event.metaKey || event.altKey;
|
||||
if (openToSide && (isDoubleClick || this.openOnSingleClick)) {
|
||||
this._onDidOpenToSide.fire(element);
|
||||
} else if (isDoubleClick) {
|
||||
this._onDidSelect.fire(element);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { ITree, ITreeConfiguration, ITreeOptions } from 'vs/base/parts/tree/browser/tree';
|
||||
import { List, IListOptions, isSelectionRangeChangeEvent, isSelectionSingleChangeEvent, IMultipleSelectionController, IOpenController } from 'vs/base/browser/ui/list/listWidget';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { createDecorator, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IDisposable, toDisposable, combinedDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IContextKeyService, IContextKey, RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { PagedList, IPagedRenderer } from 'vs/base/browser/ui/list/listPaging';
|
||||
@@ -20,7 +20,7 @@ import { mixin } from 'vs/base/common/objects';
|
||||
import { localize } from 'vs/nls';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Extensions as ConfigurationExtensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { DefaultController, IControllerOptions, OpenMode } from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { DefaultController, IControllerOptions, OpenMode, ClickBehavior } from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
@@ -141,7 +141,7 @@ class OpenController implements IOpenController {
|
||||
}
|
||||
|
||||
function handleListControllers<T>(options: IListOptions<T>, configurationService: IConfigurationService): IListOptions<T> {
|
||||
if (options.multipleSelectionSupport === true && !options.multipleSelectionController) {
|
||||
if (options.multipleSelectionSupport !== false && !options.multipleSelectionController) {
|
||||
options.multipleSelectionController = new MultipleSelectionController(configurationService);
|
||||
}
|
||||
|
||||
@@ -150,6 +150,14 @@ function handleListControllers<T>(options: IListOptions<T>, configurationService
|
||||
return options;
|
||||
}
|
||||
|
||||
function handleTreeController(configuration: ITreeConfiguration, instantiationService: IInstantiationService): ITreeConfiguration {
|
||||
if (!configuration.controller) {
|
||||
configuration.controller = instantiationService.createInstance(WorkbenchTreeController, { clickBehavior: ClickBehavior.ON_MOUSE_UP });
|
||||
}
|
||||
|
||||
return configuration;
|
||||
}
|
||||
|
||||
export class WorkbenchList<T> extends List<T> {
|
||||
|
||||
readonly contextKeyService: IContextKeyService;
|
||||
@@ -266,9 +274,10 @@ export class WorkbenchTree extends Tree {
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IListService listService: IListService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IConfigurationService private configurationService: IConfigurationService
|
||||
) {
|
||||
super(container, configuration, mixin(options, { keyboardSupport: false } as ITreeOptions, false));
|
||||
super(container, handleTreeController(configuration, instantiationService), mixin(options, { keyboardSupport: false } as ITreeOptions, false));
|
||||
|
||||
this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
|
||||
this.listDoubleSelection = WorkbenchListDoubleSelection.bindTo(this.contextKeyService);
|
||||
|
||||
@@ -773,9 +773,10 @@ export class FileIconThemableWorkbenchTree extends WorkbenchTree {
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IListService listService: IListService,
|
||||
@IThemeService themeService: IWorkbenchThemeService,
|
||||
@IConfigurationService configurationService: IConfigurationService
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IInstantiationService instantiationService: IInstantiationService
|
||||
) {
|
||||
super(container, configuration, { ...options, ...{ showTwistie: false, twistiePixels: 12 } }, contextKeyService, listService, themeService, configurationService);
|
||||
super(container, configuration, { ...options, ...{ showTwistie: false, twistiePixels: 12 } }, contextKeyService, listService, themeService, instantiationService, configurationService);
|
||||
|
||||
DOM.addClass(container, 'file-icon-themable-tree');
|
||||
DOM.addClass(container, 'show-file-icons');
|
||||
|
||||
Reference in New Issue
Block a user