mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-26 18:27:38 +01:00
tree: cleanup
This commit is contained in:
@@ -233,16 +233,16 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
||||
|
||||
// Tree navigation
|
||||
|
||||
getParentElement(ref: TRef | null = null): T | null {
|
||||
return this.model.getParentElement(ref);
|
||||
getParentElement(location: TRef | null = null): T | null {
|
||||
return this.model.getParentElement(location);
|
||||
}
|
||||
|
||||
getFirstElementChild(ref: TRef | null = null): T | null {
|
||||
return this.model.getFirstElementChild(ref);
|
||||
getFirstElementChild(location: TRef | null = null): T | null {
|
||||
return this.model.getFirstChildElement(location);
|
||||
}
|
||||
|
||||
getLastElementAncestor(ref: TRef | null = null): T | null {
|
||||
return this.model.getLastElementAncestor(ref);
|
||||
getLastElementAncestor(location: TRef | null = null): T | null {
|
||||
return this.model.getLastAncestorElement(location);
|
||||
}
|
||||
|
||||
// Tree
|
||||
@@ -259,20 +259,20 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
||||
return this.model.setCollapsed(location, false);
|
||||
}
|
||||
|
||||
toggleCollapsed(ref: TRef): void {
|
||||
this.model.toggleCollapsed(ref);
|
||||
toggleCollapsed(location: TRef): void {
|
||||
this.model.toggleCollapsed(location);
|
||||
}
|
||||
|
||||
collapseAll(): void {
|
||||
this.model.collapseAll();
|
||||
}
|
||||
|
||||
isCollapsed(ref: TRef): boolean {
|
||||
return this.model.isCollapsed(ref);
|
||||
isCollapsed(location: TRef): boolean {
|
||||
return this.model.isCollapsed(location);
|
||||
}
|
||||
|
||||
isExpanded(ref: TRef): boolean {
|
||||
return !this.isCollapsed(ref);
|
||||
isExpanded(location: TRef): boolean {
|
||||
return !this.isCollapsed(location);
|
||||
}
|
||||
|
||||
refilter(): void {
|
||||
|
||||
@@ -130,7 +130,7 @@ export class IndexTreeModel<T, TFilterData = void> implements ITreeModel<T, TFil
|
||||
}
|
||||
|
||||
collapseAll(): void {
|
||||
const queue = [...this.root.children]; // TODO@joao use a linked list
|
||||
const queue = [...this.root.children];
|
||||
let listIndex = 0;
|
||||
|
||||
this.eventBufferer.bufferEvents(() => {
|
||||
@@ -428,7 +428,7 @@ export class IndexTreeModel<T, TFilterData = void> implements ITreeModel<T, TFil
|
||||
return node === this.root ? null : node.element;
|
||||
}
|
||||
|
||||
getFirstElementChild(location: number[]): T | null {
|
||||
getFirstChildElement(location: number[]): T | null {
|
||||
const node = this.getTreeNode(location);
|
||||
|
||||
if (node.children.length === 0) {
|
||||
@@ -438,7 +438,7 @@ export class IndexTreeModel<T, TFilterData = void> implements ITreeModel<T, TFil
|
||||
return node.children[0].element;
|
||||
}
|
||||
|
||||
getLastElementAncestor(location: number[]): T | null {
|
||||
getLastAncestorElement(location: number[]): T | null {
|
||||
const node = this.getTreeNode(location);
|
||||
|
||||
if (node.children.length === 0) {
|
||||
|
||||
@@ -52,14 +52,14 @@ export class ObjectTreeModel<T extends NonNullable<any>, TFilterData = void> imp
|
||||
return this.model.getParentElement(location);
|
||||
}
|
||||
|
||||
getFirstElementChild(ref: T | null = null): T | null {
|
||||
getFirstChildElement(ref: T | null = null): T | null {
|
||||
const location = this.getElementLocation(ref);
|
||||
return this.model.getFirstElementChild(location);
|
||||
return this.model.getFirstChildElement(location);
|
||||
}
|
||||
|
||||
getLastElementAncestor(ref: T | null = null): T | null {
|
||||
getLastAncestorElement(ref: T | null = null): T | null {
|
||||
const location = this.getElementLocation(ref);
|
||||
return this.model.getLastElementAncestor(location);
|
||||
return this.model.getLastAncestorElement(location);
|
||||
}
|
||||
|
||||
getListIndex(element: T): number {
|
||||
|
||||
@@ -51,20 +51,21 @@ export interface ITreeModel<T, TFilterData, TRef> {
|
||||
readonly onDidChangeCollapseState: Event<ITreeNode<T, TFilterData>>;
|
||||
readonly onDidChangeRenderNodeCount: Event<ITreeNode<T, TFilterData>>;
|
||||
|
||||
getListIndex(ref: TRef): number;
|
||||
setCollapsed(ref: TRef, collapsed: boolean): boolean;
|
||||
toggleCollapsed(ref: TRef): void;
|
||||
collapseAll(): void;
|
||||
isCollapsed(ref: TRef): boolean;
|
||||
refilter(): void;
|
||||
|
||||
getListIndex(location: TRef): number;
|
||||
getNode(location?: TRef): ITreeNode<T, any>;
|
||||
getNodeLocation(node: ITreeNode<T, any>): TRef;
|
||||
getParentNodeLocation(location: TRef): TRef | null;
|
||||
|
||||
getParentElement(location: TRef): T | null;
|
||||
getFirstElementChild(location: TRef): T | null;
|
||||
getLastElementAncestor(location: TRef): T | null;
|
||||
getFirstChildElement(location: TRef): T | null;
|
||||
getLastAncestorElement(location: TRef): T | null;
|
||||
|
||||
isCollapsed(location: TRef): boolean;
|
||||
setCollapsed(location: TRef, collapsed: boolean): boolean;
|
||||
toggleCollapsed(location: TRef): void;
|
||||
collapseAll(): void;
|
||||
|
||||
refilter(): void;
|
||||
}
|
||||
|
||||
export interface ITreeRenderer<T, TFilterData, TTemplateData> extends IListRenderer<ITreeNode<T, TFilterData>, TTemplateData> {
|
||||
|
||||
Reference in New Issue
Block a user