提交 70924ef4 编写于 作者: B Benjamin Pasero

multi select - wire context keyservice properly

上级 b5170409
......@@ -104,8 +104,8 @@ export class WorkbenchList<T> extends List<T> {
@IThemeService themeService: IThemeService
) {
super(container, delegate, renderers, options);
this.listDoubleSelection = WorkbenchListDoubleSelection.bindTo(contextKeyService);
this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
this.listDoubleSelection = WorkbenchListDoubleSelection.bindTo(this.contextKeyService);
this.disposables.push(combinedDisposable([
this.contextKeyService,
......@@ -164,8 +164,8 @@ export class WorkbenchTree extends Tree {
) {
super(container, configuration, options);
this.listDoubleSelection = WorkbenchListDoubleSelection.bindTo(contextKeyService);
this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
this.listDoubleSelection = WorkbenchListDoubleSelection.bindTo(this.contextKeyService);
this.disposables.push(
this.contextKeyService,
......
......@@ -56,6 +56,7 @@ import { extractResources } from 'vs/workbench/browser/editor';
import { relative } from 'path';
import { DataTransfers } from 'vs/base/browser/dnd';
import { distinctParents } from 'vs/base/common/resources';
import { WorkbenchTree } from 'vs/platform/list/browser/listService';
export class FileDataSource implements IDataSource {
constructor(
......@@ -334,14 +335,12 @@ export class FileController extends DefaultController implements IDisposable {
constructor( @IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IContextMenuService private contextMenuService: IContextMenuService,
@ITelemetryService private telemetryService: ITelemetryService,
@IMenuService menuService: IMenuService,
@IMenuService private menuService: IMenuService,
@IContextKeyService contextKeyService: IContextKeyService
) {
super({ clickBehavior: ClickBehavior.ON_MOUSE_UP /* do not change to not break DND */, keyboardSupport: false /* handled via IListService */ });
this.toDispose = [];
this.contributedContextMenu = menuService.createMenu(MenuId.ExplorerContext, contextKeyService);
this.toDispose.push(this.contributedContextMenu);
}
public onLeftClick(tree: ITree, stat: FileStat | Model, event: IMouseEvent, origin: string = 'mouse'): boolean {
......@@ -427,7 +426,7 @@ export class FileController extends DefaultController implements IDisposable {
return true;
}
public onContextMenu(tree: ITree, stat: FileStat | Model, event: ContextMenuEvent): boolean {
public onContextMenu(tree: WorkbenchTree, stat: FileStat | Model, event: ContextMenuEvent): boolean {
if (event.target && event.target.tagName && event.target.tagName.toLowerCase() === 'input') {
return false;
}
......@@ -437,6 +436,11 @@ export class FileController extends DefaultController implements IDisposable {
tree.setFocus(stat);
if (!this.contributedContextMenu) {
this.contributedContextMenu = this.menuService.createMenu(MenuId.ExplorerContext, tree.contextKeyService);
this.toDispose.push(this.contributedContextMenu);
}
const anchor = { x: event.posx, y: event.posy };
const selection = tree.getSelection();
this.contextMenuService.showContextMenu({
......
......@@ -79,7 +79,7 @@ export class OpenEditorsView extends ViewsViewletPanel {
@IContextKeyService private contextKeyService: IContextKeyService,
@IThemeService private themeService: IThemeService,
@ITelemetryService private telemetryService: ITelemetryService,
@IMenuService menuService: IMenuService
@IMenuService private menuService: IMenuService
) {
super({
...(options as IViewOptions),
......@@ -98,8 +98,6 @@ export class OpenEditorsView extends ViewsViewletPanel {
}
this.needsRefresh = false;
}, this.structuralRefreshDelay);
this.contributedContextMenu = menuService.createMenu(MenuId.OpenEditorsContext, contextKeyService);
this.disposables.push(this.contributedContextMenu);
// update on model changes
this.disposables.push(this.model.onModelChanged(e => this.onEditorStacksModelChanged(e)));
......@@ -160,6 +158,9 @@ export class OpenEditorsView extends ViewsViewletPanel {
identityProvider: element => element instanceof OpenEditor ? element.getId() : element.id.toString()
}, this.contextKeyService, this.listService, this.themeService);
this.contributedContextMenu = this.menuService.createMenu(MenuId.OpenEditorsContext, this.list.contextKeyService);
this.disposables.push(this.contributedContextMenu);
this.updateSize();
// Bind context keys
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册