#91603 Allign list and tree methods and events

This commit is contained in:
Sandeep Somavarapu
2020-03-04 09:26:25 +01:00
parent ff4ad75aba
commit 210bca1cd9
10 changed files with 23 additions and 23 deletions
+7 -7
View File
@@ -114,16 +114,16 @@ export class PagedList<T> implements IDisposable {
return this.list.onDidDispose;
}
get onFocusChange(): Event<IListEvent<T>> {
return Event.map(this.list.onFocusChange, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
get onDidChangeFocus(): Event<IListEvent<T>> {
return Event.map(this.list.onDidChangeFocus, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
}
get onOpen(): Event<IListEvent<T>> {
get onDidOpen(): Event<IListEvent<T>> {
return Event.map(this.list.onDidOpen, ({ elements, indexes, browserEvent }) => ({ elements: elements.map(e => this._model.get(e)), indexes, browserEvent }));
}
get onSelectionChange(): Event<IListEvent<T>> {
return Event.map(this.list.onSelectionChange, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
get onDidChangeSelection(): Event<IListEvent<T>> {
return Event.map(this.list.onDidChangeSelection, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
}
get onPin(): Event<IListEvent<T>> {
@@ -191,8 +191,8 @@ export class PagedList<T> implements IDisposable {
return this.list.getFocus();
}
setSelection(indexes: number[]): void {
this.list.setSelection(indexes);
setSelection(indexes: number[], browserEvent?: UIEvent): void {
this.list.setSelection(indexes, browserEvent);
}
getSelection(): number[] {
+4 -4
View File
@@ -1123,11 +1123,11 @@ export class List<T> implements ISpliceable<T>, IDisposable {
protected readonly disposables = new DisposableStore();
@memoize get onFocusChange(): Event<IListEvent<T>> {
@memoize get onDidChangeFocus(): Event<IListEvent<T>> {
return Event.map(this.eventBufferer.wrapEvent(this.focus.onChange), e => this.toListEvent(e));
}
@memoize get onSelectionChange(): Event<IListEvent<T>> {
@memoize get onDidChangeSelection(): Event<IListEvent<T>> {
return Event.map(this.eventBufferer.wrapEvent(this.selection.onChange), e => this.toListEvent(e));
}
@@ -1266,8 +1266,8 @@ export class List<T> implements ISpliceable<T>, IDisposable {
this.disposables.add(this.createMouseController(_options));
this.onFocusChange(this._onFocusChange, this, this.disposables);
this.onSelectionChange(this._onSelectionChange, this, this.disposables);
this.onDidChangeFocus(this._onFocusChange, this, this.disposables);
this.onDidChangeSelection(this._onSelectionChange, this, this.disposables);
if (_options.ariaLabel) {
this.view.domNode.setAttribute('aria-label', localize('aria list', "{0}. Use the navigation keys to navigate.", _options.ariaLabel));
@@ -750,7 +750,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
.on(e => this.onMouseUp(e), this));
this._register(this.selectList.onMouseOver(e => typeof e.index !== 'undefined' && this.selectList.setFocus([e.index])));
this._register(this.selectList.onFocusChange(e => this.onListFocus(e)));
this._register(this.selectList.onDidChangeFocus(e => this.onListFocus(e)));
this._register(dom.addDisposableListener(this.selectDropDownContainer, dom.EventType.FOCUS_OUT, e => {
if (!this._isVisible || dom.isAncestor(e.relatedTarget as HTMLElement, this.selectDropDownContainer)) {
@@ -295,12 +295,12 @@ export class QuickInputList {
@memoize
get onDidChangeFocus() {
return Event.map(this.list.onFocusChange, e => e.elements.map(e => e.item));
return Event.map(this.list.onDidChangeFocus, e => e.elements.map(e => e.item));
}
@memoize
get onDidChangeSelection() {
return Event.map(this.list.onSelectionChange, e => e.elements.map(e => e.item));
return Event.map(this.list.onDidChangeSelection, e => e.elements.map(e => e.item));
}
getAllVisibleChecked() {
@@ -631,8 +631,8 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this.toDispose.add(editor.onDidLayoutChange(() => this.onEditorLayoutChange()));
this.toDispose.add(this.list.onMouseDown(e => this.onListMouseDownOrTap(e)));
this.toDispose.add(this.list.onTap(e => this.onListMouseDownOrTap(e)));
this.toDispose.add(this.list.onSelectionChange(e => this.onListSelection(e)));
this.toDispose.add(this.list.onFocusChange(e => this.onListFocus(e)));
this.toDispose.add(this.list.onDidChangeSelection(e => this.onListSelection(e)));
this.toDispose.add(this.list.onDidChangeFocus(e => this.onListFocus(e)));
this.toDispose.add(this.editor.onDidChangeCursorSelection(() => this.onCursorSelectionChanged()));
this.toDispose.add(this.editor.onDidChangeConfiguration(e => {
if (e.hasChanged(EditorOption.suggest)) {
+2 -2
View File
@@ -298,7 +298,7 @@ export class WorkbenchList<T> extends List<T> {
this.updateStyles(options.overrideStyles);
}
this.disposables.add(this.onSelectionChange(() => {
this.disposables.add(this.onDidChangeSelection(() => {
const selection = this.getSelection();
const focus = this.getFocus();
@@ -306,7 +306,7 @@ export class WorkbenchList<T> extends List<T> {
this.listMultiSelection.set(selection.length > 1);
this.listDoubleSelection.set(selection.length === 2);
}));
this.disposables.add(this.onFocusChange(() => {
this.disposables.add(this.onDidChangeFocus(() => {
const selection = this.getSelection();
const focus = this.getFocus();
@@ -125,7 +125,7 @@ export class NotificationsList extends Themable {
// Only allow for focus in notifications, as the
// selection is too strong over the contents of
// the notification
this._register(list.onSelectionChange(e => {
this._register(list.onDidChangeSelection(e => {
if (e.indexes.length > 0) {
list.setSelection([]);
}
@@ -247,7 +247,7 @@ export class OpenEditorsView extends ViewPane {
this.readonlyEditorFocusedContext = ReadonlyEditorContext.bindTo(this.contextKeyService);
this._register(this.list.onContextMenu(e => this.onListContextMenu(e)));
this.list.onFocusChange(e => {
this.list.onDidChangeFocus(e => {
this.resourceContext.reset();
this.groupFocusedContext.reset();
this.dirtyEditorFocusedContext.reset();
@@ -463,7 +463,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditorP
}
})) as WorkbenchList<IListEntry>;
this._register(this.keybindingsList.onContextMenu(e => this.onContextMenu(e)));
this._register(this.keybindingsList.onFocusChange(e => this.onFocusChange(e)));
this._register(this.keybindingsList.onDidChangeFocus(e => this.onFocusChange(e)));
this._register(this.keybindingsList.onDidFocus(() => {
DOM.addClass(this.keybindingsList.getHTMLElement(), 'focused');
}));
@@ -212,8 +212,8 @@ export class MainPane extends ViewPane {
});
this._register(renderer.onDidRenderElement(e => this.list.updateWidth(this.viewModel.repositories.indexOf(e)), null));
this._register(this.list.onSelectionChange(this.onListSelectionChange, this));
this._register(this.list.onFocusChange(this.onListFocusChange, this));
this._register(this.list.onDidChangeSelection(this.onListSelectionChange, this));
this._register(this.list.onDidChangeFocus(this.onListFocusChange, this));
this._register(this.list.onContextMenu(this.onListContextMenu, this));
this._register(this.viewModel.onDidChangeVisibleRepositories(this.updateListSelection, this));