提交 cd120baa 编写于 作者: I isidor

context keys introduce "listMultiSelection"

fixes #43319
上级 73e104d1
......@@ -83,6 +83,7 @@ const RawWorkbenchListFocusContextKey = new RawContextKey<boolean>('listFocus',
export const WorkbenchListSupportsMultiSelectContextKey = new RawContextKey<boolean>('listSupportsMultiselect', true);
export const WorkbenchListFocusContextKey = ContextKeyExpr.and(RawWorkbenchListFocusContextKey, ContextKeyExpr.not(InputFocusedContextKey));
export const WorkbenchListDoubleSelection = new RawContextKey<boolean>('listDoubleSelection', false);
export const WorkbenchListMultiSelection = new RawContextKey<boolean>('listMultiSelection', false);
export type Widget = List<any> | PagedList<any> | ITree;
......@@ -166,6 +167,7 @@ export class WorkbenchList<T> extends List<T> {
readonly contextKeyService: IContextKeyService;
private listDoubleSelection: IContextKey<boolean>;
private listMultiSelection: IContextKey<boolean>;
private _useAltAsMultipleSelectionModifier: boolean;
......@@ -183,6 +185,7 @@ export class WorkbenchList<T> extends List<T> {
this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
this.listDoubleSelection = WorkbenchListDoubleSelection.bindTo(this.contextKeyService);
this.listMultiSelection = WorkbenchListMultiSelection.bindTo(this.contextKeyService);
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
......@@ -190,7 +193,11 @@ export class WorkbenchList<T> extends List<T> {
this.contextKeyService,
(listService as ListService).register(this),
attachListStyler(this, themeService),
this.onSelectionChange(() => this.listDoubleSelection.set(this.getSelection().length === 2))
this.onSelectionChange(() => {
const selection = this.getSelection();
this.listMultiSelection.set(selection.length > 1);
this.listDoubleSelection.set(selection.length === 2);
})
]));
this.registerListeners();
......@@ -266,6 +273,7 @@ export class WorkbenchTree extends Tree {
protected disposables: IDisposable[] = [];
private listDoubleSelection: IContextKey<boolean>;
private listMultiSelection: IContextKey<boolean>;
private _openOnSingleClick: boolean;
private _useAltAsMultipleSelectionModifier: boolean;
......@@ -284,6 +292,7 @@ export class WorkbenchTree extends Tree {
this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
this.listDoubleSelection = WorkbenchListDoubleSelection.bindTo(this.contextKeyService);
this.listMultiSelection = WorkbenchListMultiSelection.bindTo(this.contextKeyService);
this._openOnSingleClick = useSingleClickToOpen(configurationService);
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
......@@ -309,6 +318,7 @@ export class WorkbenchTree extends Tree {
this.disposables.push(this.onDidChangeSelection(() => {
const selection = this.getSelection();
this.listDoubleSelection.set(selection && selection.length === 2);
this.listMultiSelection.set(selection && selection.length > 1);
}));
this.disposables.push(this.configurationService.onDidChangeConfiguration(e => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册