Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/editor/common/services/treeViewsDnd.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
export interface ITreeViewsDnDService<T> {
7
readonly _serviceBrand: undefined;
8
9
removeDragOperationTransfer(uuid: string | undefined): Promise<T | undefined> | undefined;
10
addDragOperationTransfer(uuid: string, transferPromise: Promise<T | undefined>): void;
11
}
12
13
export class TreeViewsDnDService<T> implements ITreeViewsDnDService<T> {
14
_serviceBrand: undefined;
15
private _dragOperations: Map<string, Promise<T | undefined>> = new Map();
16
17
removeDragOperationTransfer(uuid: string | undefined): Promise<T | undefined> | undefined {
18
if ((uuid && this._dragOperations.has(uuid))) {
19
const operation = this._dragOperations.get(uuid);
20
this._dragOperations.delete(uuid);
21
return operation;
22
}
23
return undefined;
24
}
25
26
addDragOperationTransfer(uuid: string, transferPromise: Promise<T | undefined>): void {
27
this._dragOperations.set(uuid, transferPromise);
28
}
29
}
30
31
32
export class DraggedTreeItemsIdentifier {
33
34
constructor(readonly identifier: string) { }
35
}
36
37