-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathexplorerNode.ts
38 lines (27 loc) · 1009 Bytes
/
explorerNode.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import { Command, ProviderResult, TreeItem } from "vscode";
export abstract class ExplorerNode {
constructor(private _parent?: ExplorerNode) {
}
public getParent(): ExplorerNode | undefined {
return this._parent;
}
public isItselfOrAncestorOf(node: ExplorerNode | undefined | null, levelToCheck: number = Number.MAX_VALUE) {
while (node && levelToCheck >= 0) {
if (this === node) {
return true;
}
node = node.getParent();
levelToCheck--;
}
return false;
}
protected get command(): Command | undefined {
return undefined;
}
public abstract getChildren(): ProviderResult<ExplorerNode[]>;
public abstract getTreeItem(): TreeItem | Promise<TreeItem>;
public abstract computeContextValue(): string | undefined;
public abstract getDisplayName(): string;
}