提交 983a6909 编写于 作者: J Joao Moreno

fixes #39271

上级 da405b92
......@@ -15,6 +15,7 @@ import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { attachListStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { debounce } from 'vs/base/common/decorators';
import Event, { Emitter } from 'vs/base/common/event';
export type ListWidget = List<any> | PagedList<any> | ITree;
......@@ -142,6 +143,9 @@ export class WorkbenchPagedList<T> extends PagedList<T> {
export class WorkbenchTree extends Tree {
private _onFocusChange = new Emitter<boolean>();
readonly onFocusChange: Event<boolean> = this._onFocusChange.event;
readonly contextKeyService: IContextKeyService;
private workbenchListFocusContextKey: IContextKey<boolean>;
private disposables: IDisposable[] = [];
......@@ -172,7 +176,10 @@ export class WorkbenchTree extends Tree {
@debounce(50)
private updateContextKey(): void {
this.workbenchListFocusContextKey.set(document.activeElement === this.getHTMLElement());
const isFocused = document.activeElement === this.getHTMLElement();
this.workbenchListFocusContextKey.set(isFocused);
this._onFocusChange.fire(isFocused);
}
dispose(): void {
......
......@@ -425,8 +425,14 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
}, this.contextKeyService, this.listService, this.themeService);
// Bind context keys
FilesExplorerFocusedContext.bindTo(this.explorerViewer.contextKeyService);
ExplorerFocusedContext.bindTo(this.explorerViewer.contextKeyService);
const filesExplorerFocusedContextKey = FilesExplorerFocusedContext.bindTo(this.explorerViewer.contextKeyService);
const explorerFocusedContextKey = ExplorerFocusedContext.bindTo(this.explorerViewer.contextKeyService);
// Update context keys
this.disposables.push(this.explorerViewer.onFocusChange(focused => {
filesExplorerFocusedContextKey.set(focused);
explorerFocusedContextKey.set(focused);
}));
// Update Viewer based on File Change Events
this.disposables.push(this.fileService.onAfterOperation(e => this.onFileOperation(e)));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册