import { Event, Emitter, WaitUntilEvent } from '../../common/event'; import { DisposableCollection } from '../../common/disposable'; import { CancellationToken } from '../../common/cancellation'; import { ILogger } from '../../common/logger'; import { SelectionProvider } from '../../common/selection-service'; import { Tree, TreeNode, CompositeTreeNode } from './tree'; import { TreeSelectionService, SelectableTreeNode, TreeSelection } from './tree-selection'; import { TreeExpansionService, ExpandableTreeNode } from './tree-expansion'; import { TreeNavigationService } from './tree-navigation'; import { TreeIterator } from './tree-iterator'; import { TreeSearch } from './tree-search'; import { TreeFocusService } from './tree-focus-service'; /** * The tree model. */ export declare const TreeModel: unique symbol; export interface TreeModel extends Tree, TreeSelectionService, TreeExpansionService { /** * Expands the given node. If the `node` argument is `undefined`, then expands the currently selected tree node. * If multiple tree nodes are selected, expands the most recently selected tree node. */ expandNode(node?: Readonly): Promise | undefined>; /** * Collapses the given node. If the `node` argument is `undefined`, then collapses the currently selected tree node. * If multiple tree nodes are selected, collapses the most recently selected tree node. */ collapseNode(node?: Readonly): Promise; /** * Collapses recursively. If the `node` argument is `undefined`, then collapses the currently selected tree node. * If multiple tree nodes are selected, collapses the most recently selected tree node. */ collapseAll(node?: Readonly): Promise; /** * Toggles the expansion state of the given node. If not give, then it toggles the expansion state of the currently selected node. * If multiple nodes are selected, then the most recently selected tree node's expansion state will be toggled. */ toggleNodeExpansion(node?: Readonly): Promise; /** * Opens the given node or the currently selected on if the argument is `undefined`. * If multiple nodes are selected, open the most recently selected node. */ openNode(node?: Readonly | undefined): void; /** * Event when a node should be opened. */ readonly onOpenNode: Event>; /** * Selects the parent node relatively to the selected taking into account node expansion. */ selectParent(): void; /** * Navigates to the given node if it is defined. This method accepts both the tree node and its ID as an argument. * Navigation sets a node as a root node and expand it. Resolves to the node if the navigation was successful. Otherwise, * resolves to `undefined`. */ navigateTo(nodeOrId: Readonly | string | undefined): Promise; /** * Tests whether it is possible to navigate forward. */ canNavigateForward(): boolean; /** * Tests whether it is possible to navigate backward. */ canNavigateBackward(): boolean; /** * Navigates forward. */ navigateForward(): Promise; /** * Navigates backward. */ navigateBackward(): Promise; /** * Selects the previous node relatively to the currently selected one. This method takes the expansion state of the tree into consideration. */ selectPrevNode(type?: TreeSelection.SelectionType): void; /** * Returns the previous selectable tree node. */ getPrevSelectableNode(node?: TreeNode): SelectableTreeNode | undefined; /** * Selects the next node relatively to the currently selected one. This method takes the expansion state of the tree into consideration. */ selectNextNode(type?: TreeSelection.SelectionType): void; /** * Returns the next selectable tree node. */ getNextSelectableNode(node?: TreeNode): SelectableTreeNode | undefined; /** * Selects the given tree node. Has no effect when the node does not exist in the tree. Discards any previous selection state. */ selectNode(node: Readonly): void; /** * Selects the given node if it was not yet selected, or unselects it if it was. Keeps the previous selection state and updates it * with the current toggle selection. */ toggleNode(node: Readonly): void; /** * Selects a range of tree nodes. The target of the selection range is the argument, the from tree node is the previous selected node. * If no node was selected previously, invoking this method does nothing. */ selectRange(node: Readonly): void; /** * Returns the node currently in focus in this tree, or undefined if no node is focused. */ getFocusedNode(): SelectableTreeNode | undefined; } export declare class TreeModelImpl implements TreeModel, SelectionProvider>> { protected readonly logger: ILogger; protected readonly tree: Tree; protected readonly selectionService: TreeSelectionService; protected readonly expansionService: TreeExpansionService; protected readonly navigationService: TreeNavigationService; protected readonly focusService: TreeFocusService; protected readonly treeSearch: TreeSearch; protected readonly onChangedEmitter: Emitter; protected readonly onOpenNodeEmitter: Emitter; protected readonly toDispose: DisposableCollection; protected init(): void; dispose(): void; protected handleExpansion(node: Readonly): void; /** * Select the given node if it is the ancestor of a selected node. */ protected selectIfAncestorOfSelected(node: Readonly): void; get root(): TreeNode | undefined; set root(root: TreeNode | undefined); get onChanged(): Event; get onOpenNode(): Event; protected fireChanged(): void; get onNodeRefreshed(): Event & WaitUntilEvent>; getNode(id: string | undefined): TreeNode | undefined; getFocusedNode(): SelectableTreeNode | undefined; validateNode(node: TreeNode | undefined): TreeNode | undefined; refresh(parent?: Readonly): Promise; get selectedNodes(): readonly Readonly[]; get onSelectionChanged(): Event[]>; get onExpansionChanged(): Event>; expandNode(raw?: Readonly): Promise; protected getExpansionCandidates(raw?: Readonly): IterableIterator; collapseNode(raw?: Readonly): Promise; collapseAll(raw?: Readonly): Promise; toggleNodeExpansion(raw?: Readonly): Promise; selectPrevNode(type?: TreeSelection.SelectionType): void; getPrevSelectableNode(node?: TreeNode | undefined): SelectableTreeNode | undefined; selectNextNode(type?: TreeSelection.SelectionType): void; getNextSelectableNode(node?: TreeNode | undefined): SelectableTreeNode | undefined; protected doGetNextNode(iterator: TreeIterator, criterion: (node: TreeNode) => node is T): T | undefined; protected isVisibleSelectableNode(node: TreeNode): node is SelectableTreeNode; protected createBackwardIterator(node: TreeNode | undefined): TreeIterator | undefined; protected createIterator(node: TreeNode | undefined): TreeIterator | undefined; protected createForwardIteratorForNode(node: TreeNode): TreeIterator; openNode(raw?: TreeNode | undefined): void; protected doOpenNode(node: TreeNode): void; selectParent(): void; navigateTo(nodeOrId: TreeNode | string | undefined): Promise; canNavigateForward(): boolean; canNavigateBackward(): boolean; navigateForward(): Promise; navigateBackward(): Promise; protected doNavigate(node: TreeNode): Promise; addSelection(selectionOrTreeNode: TreeSelection | Readonly): void; clearSelection(): void; selectNode(node: Readonly): void; toggleNode(node: Readonly): void; selectRange(node: Readonly): void; storeState(): TreeModelImpl.State; restoreState(state: TreeModelImpl.State): void; get onDidChangeBusy(): Event; markAsBusy(node: Readonly, ms: number, token: CancellationToken): Promise; } export declare namespace TreeModelImpl { interface State { selection: object; } } //# sourceMappingURL=tree-model.d.ts.map