@codingame/monaco-vscode-views-service-override 1.85.1 → 1.85.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -9
- package/tools/editor.js +1 -1
- package/views.js +1 -1
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +1 -1
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +3 -0
- package/vscode/src/vs/base/browser/ui/tree/treeDefaults.js +0 -16
- package/vscode/src/vs/workbench/browser/parts/views/checkbox.js +0 -107
- package/vscode/src/vs/workbench/browser/parts/views/media/views.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/views/treeView.js +0 -1604
|
@@ -1,1604 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { DataTransfers } from 'monaco-editor/esm/vs/base/browser/dnd.js';
|
|
3
|
-
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
4
|
-
import { renderMarkdownAsPlaintext } from 'monaco-editor/esm/vs/base/browser/markdownRenderer.js';
|
|
5
|
-
import { ActionBar } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js';
|
|
6
|
-
import { ActionViewItem } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js';
|
|
7
|
-
import { CollapseAllAction } from '../../../../base/browser/ui/tree/treeDefaults.js';
|
|
8
|
-
import { ActionRunner } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
9
|
-
import { timeout } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
10
|
-
import { CancellationTokenSource, CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
11
|
-
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
12
|
-
import { isCancellationError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
13
|
-
import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
14
|
-
import { createMatches } from 'monaco-editor/esm/vs/base/common/filters.js';
|
|
15
|
-
import { isMarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
|
|
16
|
-
import { Disposable, DisposableStore, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
17
|
-
import { Mimes } from 'monaco-editor/esm/vs/base/common/mime.js';
|
|
18
|
-
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
19
|
-
import { basename, dirname } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
20
|
-
import { isFalsyOrWhitespace } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
21
|
-
import { isString } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
22
|
-
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
23
|
-
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
24
|
-
import './media/views.css.js';
|
|
25
|
-
import { VSDataTransfer } from 'monaco-editor/esm/vs/base/common/dataTransfer.js';
|
|
26
|
-
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
27
|
-
import { createActionViewItem, createAndFillInContextMenuActions } from 'monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js';
|
|
28
|
-
import { MenuRegistry, MenuId, registerAction2, Action2, IMenuService } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
29
|
-
import { CommandsRegistry, ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
30
|
-
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
31
|
-
import { RawContextKey, IContextKeyService, ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
32
|
-
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
33
|
-
import { FileKind } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
34
|
-
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
35
|
-
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
36
|
-
import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
|
|
37
|
-
import { WorkbenchAsyncDataTree } from 'monaco-editor/esm/vs/platform/list/browser/listService.js';
|
|
38
|
-
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
39
|
-
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
40
|
-
import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
|
|
41
|
-
import { IProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
42
|
-
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
43
|
-
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
44
|
-
import { ColorScheme } from 'monaco-editor/esm/vs/platform/theme/common/theme.js';
|
|
45
|
-
import { FolderThemeIcon, FileThemeIcon, IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
46
|
-
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
47
|
-
import { fillEditorsDragData } from 'vscode/vscode/vs/workbench/browser/dnd';
|
|
48
|
-
import { ResourceLabels } from 'vscode/vscode/vs/workbench/browser/labels';
|
|
49
|
-
import { API_OPEN_EDITOR_COMMAND_ID, API_OPEN_DIFF_EDITOR_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
|
|
50
|
-
import { ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
51
|
-
import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from 'vscode/vscode/vs/workbench/common/theme';
|
|
52
|
-
import { ResolvableTreeItem, TreeItemCollapsibleState, Extensions, IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
|
|
53
|
-
import { NumberBadge, IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity';
|
|
54
|
-
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
55
|
-
import { IHoverService } from 'vscode/vscode/vs/workbench/services/hover/browser/hover';
|
|
56
|
-
import { ITreeViewsService } from 'vscode/vscode/vs/workbench/services/views/browser/treeViewsService';
|
|
57
|
-
import { LocalSelectionTransfer, CodeDataTransfers } from 'monaco-editor/esm/vs/platform/dnd/browser/dnd.js';
|
|
58
|
-
import { toExternalVSDataTransfer } from 'monaco-editor/esm/vs/editor/browser/dnd.js';
|
|
59
|
-
import { TreeItemCheckbox, CheckboxStateHandler } from './checkbox.js';
|
|
60
|
-
import { setTimeout0 } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
61
|
-
import { TelemetryTrustedValue } from 'vscode/vscode/vs/platform/telemetry/common/telemetryUtils';
|
|
62
|
-
import { ITreeViewsDnDService } from 'monaco-editor/esm/vs/editor/common/services/treeViewsDndService.js';
|
|
63
|
-
import { DraggedTreeItemsIdentifier } from 'monaco-editor/esm/vs/editor/common/services/treeViewsDnd.js';
|
|
64
|
-
import { MarkdownRenderer } from 'monaco-editor/esm/vs/editor/contrib/markdownRenderer/browser/markdownRenderer.js';
|
|
65
|
-
|
|
66
|
-
var TreeRenderer_1;
|
|
67
|
-
let TreeViewPane = class TreeViewPane extends ViewPane {
|
|
68
|
-
constructor(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService) {
|
|
69
|
-
super({ ...options, titleMenuId: MenuId.ViewTitle, donotForwardArgs: false }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
70
|
-
const { treeView } = ( Registry.as(Extensions.ViewsRegistry)).getView(options.id);
|
|
71
|
-
this.treeView = treeView;
|
|
72
|
-
this._register(this.treeView.onDidChangeActions(() => this.updateActions(), this));
|
|
73
|
-
this._register(this.treeView.onDidChangeTitle((newTitle) => this.updateTitle(newTitle)));
|
|
74
|
-
this._register(this.treeView.onDidChangeDescription((newDescription) => this.updateTitleDescription(newDescription)));
|
|
75
|
-
this._register(toDisposable(() => {
|
|
76
|
-
if (this._container && this.treeView.container && (this._container === this.treeView.container)) {
|
|
77
|
-
this.treeView.setVisibility(false);
|
|
78
|
-
}
|
|
79
|
-
}));
|
|
80
|
-
this._register(this.onDidChangeBodyVisibility(() => this.updateTreeVisibility()));
|
|
81
|
-
this._register(this.treeView.onDidChangeWelcomeState(() => this._onDidChangeViewWelcomeState.fire()));
|
|
82
|
-
if (options.title !== this.treeView.title) {
|
|
83
|
-
this.updateTitle(this.treeView.title);
|
|
84
|
-
}
|
|
85
|
-
if (options.titleDescription !== this.treeView.description) {
|
|
86
|
-
this.updateTitleDescription(this.treeView.description);
|
|
87
|
-
}
|
|
88
|
-
this._actionRunner = ( new MultipleSelectionActionRunner(notificationService, () => this.treeView.getSelection()));
|
|
89
|
-
this.updateTreeVisibility();
|
|
90
|
-
}
|
|
91
|
-
focus() {
|
|
92
|
-
super.focus();
|
|
93
|
-
this.treeView.focus();
|
|
94
|
-
}
|
|
95
|
-
renderBody(container) {
|
|
96
|
-
this._container = container;
|
|
97
|
-
super.renderBody(container);
|
|
98
|
-
this.renderTreeView(container);
|
|
99
|
-
}
|
|
100
|
-
shouldShowWelcome() {
|
|
101
|
-
return ((this.treeView.dataProvider === undefined) || !!this.treeView.dataProvider.isTreeEmpty) && ((this.treeView.message === undefined) || (this.treeView.message === ''));
|
|
102
|
-
}
|
|
103
|
-
layoutBody(height, width) {
|
|
104
|
-
super.layoutBody(height, width);
|
|
105
|
-
this.layoutTreeView(height, width);
|
|
106
|
-
}
|
|
107
|
-
getOptimalWidth() {
|
|
108
|
-
return this.treeView.getOptimalWidth();
|
|
109
|
-
}
|
|
110
|
-
renderTreeView(container) {
|
|
111
|
-
this.treeView.show(container);
|
|
112
|
-
}
|
|
113
|
-
layoutTreeView(height, width) {
|
|
114
|
-
this.treeView.layout(height, width);
|
|
115
|
-
}
|
|
116
|
-
updateTreeVisibility() {
|
|
117
|
-
this.treeView.setVisibility(this.isBodyVisible());
|
|
118
|
-
}
|
|
119
|
-
getActionRunner() {
|
|
120
|
-
return this._actionRunner;
|
|
121
|
-
}
|
|
122
|
-
getActionsContext() {
|
|
123
|
-
return { $treeViewId: this.id, $focusedTreeItem: true, $selectedTreeItems: true };
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
TreeViewPane = ( __decorate([
|
|
127
|
-
( __param(1, IKeybindingService)),
|
|
128
|
-
( __param(2, IContextMenuService)),
|
|
129
|
-
( __param(3, IConfigurationService)),
|
|
130
|
-
( __param(4, IContextKeyService)),
|
|
131
|
-
( __param(5, IViewDescriptorService)),
|
|
132
|
-
( __param(6, IInstantiationService)),
|
|
133
|
-
( __param(7, IOpenerService)),
|
|
134
|
-
( __param(8, IThemeService)),
|
|
135
|
-
( __param(9, ITelemetryService)),
|
|
136
|
-
( __param(10, INotificationService))
|
|
137
|
-
], TreeViewPane));
|
|
138
|
-
class Root {
|
|
139
|
-
constructor() {
|
|
140
|
-
this.label = { label: 'root' };
|
|
141
|
-
this.handle = '0';
|
|
142
|
-
this.parentHandle = undefined;
|
|
143
|
-
this.collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
144
|
-
this.children = undefined;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function isTreeCommandEnabled(treeCommand, contextKeyService) {
|
|
148
|
-
const command = CommandsRegistry.getCommand(treeCommand.originalId ? treeCommand.originalId : treeCommand.id);
|
|
149
|
-
if (command) {
|
|
150
|
-
const commandAction = MenuRegistry.getCommand(command.id);
|
|
151
|
-
const precondition = commandAction && commandAction.precondition;
|
|
152
|
-
if (precondition) {
|
|
153
|
-
return contextKeyService.contextMatchesRules(precondition);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
function isRenderedMessageValue(messageValue) {
|
|
159
|
-
return !!messageValue && typeof messageValue !== 'string' && 'element' in messageValue && 'dispose' in messageValue;
|
|
160
|
-
}
|
|
161
|
-
const noDataProviderMessage = ( localizeWithPath(
|
|
162
|
-
'vs/workbench/browser/parts/views/treeView',
|
|
163
|
-
'no-dataprovider',
|
|
164
|
-
"There is no data provider registered that can provide view data."
|
|
165
|
-
));
|
|
166
|
-
const RawCustomTreeViewContextKey = ( new RawContextKey('customTreeView', false));
|
|
167
|
-
class Tree extends WorkbenchAsyncDataTree {
|
|
168
|
-
}
|
|
169
|
-
let AbstractTreeView = class AbstractTreeView extends Disposable {
|
|
170
|
-
constructor(id, _title, themeService, instantiationService, commandService, configurationService, progressService, contextMenuService, keybindingService, notificationService, viewDescriptorService, hoverService, contextKeyService, activityService, logService) {
|
|
171
|
-
super();
|
|
172
|
-
this.id = id;
|
|
173
|
-
this._title = _title;
|
|
174
|
-
this.themeService = themeService;
|
|
175
|
-
this.instantiationService = instantiationService;
|
|
176
|
-
this.commandService = commandService;
|
|
177
|
-
this.configurationService = configurationService;
|
|
178
|
-
this.progressService = progressService;
|
|
179
|
-
this.contextMenuService = contextMenuService;
|
|
180
|
-
this.keybindingService = keybindingService;
|
|
181
|
-
this.notificationService = notificationService;
|
|
182
|
-
this.viewDescriptorService = viewDescriptorService;
|
|
183
|
-
this.hoverService = hoverService;
|
|
184
|
-
this.contextKeyService = contextKeyService;
|
|
185
|
-
this.activityService = activityService;
|
|
186
|
-
this.logService = logService;
|
|
187
|
-
this.isVisible = false;
|
|
188
|
-
this._hasIconForParentNode = false;
|
|
189
|
-
this._hasIconForLeafNode = false;
|
|
190
|
-
this.focused = false;
|
|
191
|
-
this._canSelectMany = false;
|
|
192
|
-
this._manuallyManageCheckboxes = false;
|
|
193
|
-
this.elementsToRefresh = [];
|
|
194
|
-
this.lastSelection = [];
|
|
195
|
-
this._onDidExpandItem = this._register(( new Emitter()));
|
|
196
|
-
this.onDidExpandItem = this._onDidExpandItem.event;
|
|
197
|
-
this._onDidCollapseItem = this._register(( new Emitter()));
|
|
198
|
-
this.onDidCollapseItem = this._onDidCollapseItem.event;
|
|
199
|
-
this._onDidChangeSelectionAndFocus = this._register(( new Emitter()));
|
|
200
|
-
this.onDidChangeSelectionAndFocus = this._onDidChangeSelectionAndFocus.event;
|
|
201
|
-
this._onDidChangeVisibility = this._register(( new Emitter()));
|
|
202
|
-
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
|
203
|
-
this._onDidChangeActions = this._register(( new Emitter()));
|
|
204
|
-
this.onDidChangeActions = this._onDidChangeActions.event;
|
|
205
|
-
this._onDidChangeWelcomeState = this._register(( new Emitter()));
|
|
206
|
-
this.onDidChangeWelcomeState = this._onDidChangeWelcomeState.event;
|
|
207
|
-
this._onDidChangeTitle = this._register(( new Emitter()));
|
|
208
|
-
this.onDidChangeTitle = this._onDidChangeTitle.event;
|
|
209
|
-
this._onDidChangeDescription = this._register(( new Emitter()));
|
|
210
|
-
this.onDidChangeDescription = this._onDidChangeDescription.event;
|
|
211
|
-
this._onDidChangeCheckboxState = this._register(( new Emitter()));
|
|
212
|
-
this.onDidChangeCheckboxState = this._onDidChangeCheckboxState.event;
|
|
213
|
-
this._onDidCompleteRefresh = this._register(( new Emitter()));
|
|
214
|
-
this._isInitialized = false;
|
|
215
|
-
this._height = 0;
|
|
216
|
-
this._width = 0;
|
|
217
|
-
this.refreshing = false;
|
|
218
|
-
this.root = ( new Root());
|
|
219
|
-
this.lastActive = this.root;
|
|
220
|
-
}
|
|
221
|
-
initialize() {
|
|
222
|
-
if (this._isInitialized) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
this._isInitialized = true;
|
|
226
|
-
this.contextKeyService.bufferChangeEvents(() => {
|
|
227
|
-
this.initializeShowCollapseAllAction();
|
|
228
|
-
this.initializeCollapseAllToggle();
|
|
229
|
-
this.initializeShowRefreshAction();
|
|
230
|
-
});
|
|
231
|
-
this.treeViewDnd = this.instantiationService.createInstance(CustomTreeViewDragAndDrop, this.id);
|
|
232
|
-
if (this._dragAndDropController) {
|
|
233
|
-
this.treeViewDnd.controller = this._dragAndDropController;
|
|
234
|
-
}
|
|
235
|
-
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
236
|
-
if (e.affectsConfiguration('explorer.decorations')) {
|
|
237
|
-
this.doRefresh([this.root]);
|
|
238
|
-
}
|
|
239
|
-
}));
|
|
240
|
-
this._register(this.viewDescriptorService.onDidChangeLocation(({ views, from, to }) => {
|
|
241
|
-
if (( views.some(v => v.id === this.id))) {
|
|
242
|
-
this.tree?.updateOptions({ overrideStyles: { listBackground: this.viewLocation === 1 ? PANEL_BACKGROUND : SIDE_BAR_BACKGROUND } });
|
|
243
|
-
}
|
|
244
|
-
}));
|
|
245
|
-
this.registerActions();
|
|
246
|
-
this.create();
|
|
247
|
-
}
|
|
248
|
-
get viewContainer() {
|
|
249
|
-
return this.viewDescriptorService.getViewContainerByViewId(this.id);
|
|
250
|
-
}
|
|
251
|
-
get viewLocation() {
|
|
252
|
-
return this.viewDescriptorService.getViewLocationById(this.id);
|
|
253
|
-
}
|
|
254
|
-
get dragAndDropController() {
|
|
255
|
-
return this._dragAndDropController;
|
|
256
|
-
}
|
|
257
|
-
set dragAndDropController(dnd) {
|
|
258
|
-
this._dragAndDropController = dnd;
|
|
259
|
-
if (this.treeViewDnd) {
|
|
260
|
-
this.treeViewDnd.controller = dnd;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
get dataProvider() {
|
|
264
|
-
return this._dataProvider;
|
|
265
|
-
}
|
|
266
|
-
set dataProvider(dataProvider) {
|
|
267
|
-
if (dataProvider) {
|
|
268
|
-
const self = this;
|
|
269
|
-
this._dataProvider = new (class {
|
|
270
|
-
constructor() {
|
|
271
|
-
this._isEmpty = true;
|
|
272
|
-
this._onDidChangeEmpty = ( new Emitter());
|
|
273
|
-
this.onDidChangeEmpty = this._onDidChangeEmpty.event;
|
|
274
|
-
}
|
|
275
|
-
get isTreeEmpty() {
|
|
276
|
-
return this._isEmpty;
|
|
277
|
-
}
|
|
278
|
-
async getChildren(node) {
|
|
279
|
-
let children;
|
|
280
|
-
const checkboxesUpdated = [];
|
|
281
|
-
if (node && node.children) {
|
|
282
|
-
children = node.children;
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
node = node ?? self.root;
|
|
286
|
-
node.children = await (node instanceof Root ? dataProvider.getChildren() : dataProvider.getChildren(node));
|
|
287
|
-
children = node.children ?? [];
|
|
288
|
-
children.forEach(child => {
|
|
289
|
-
child.parent = node;
|
|
290
|
-
if (!self.manuallyManageCheckboxes && (node?.checkbox?.isChecked === true) && (child.checkbox?.isChecked === false)) {
|
|
291
|
-
child.checkbox.isChecked = true;
|
|
292
|
-
checkboxesUpdated.push(child);
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
if (node instanceof Root) {
|
|
297
|
-
const oldEmpty = this._isEmpty;
|
|
298
|
-
this._isEmpty = children.length === 0;
|
|
299
|
-
if (oldEmpty !== this._isEmpty) {
|
|
300
|
-
this._onDidChangeEmpty.fire();
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
if (checkboxesUpdated.length > 0) {
|
|
304
|
-
self._onDidChangeCheckboxState.fire(checkboxesUpdated);
|
|
305
|
-
}
|
|
306
|
-
return children;
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
if (this._dataProvider.onDidChangeEmpty) {
|
|
310
|
-
this._register(this._dataProvider.onDidChangeEmpty(() => {
|
|
311
|
-
this.updateCollapseAllToggle();
|
|
312
|
-
this._onDidChangeWelcomeState.fire();
|
|
313
|
-
}));
|
|
314
|
-
}
|
|
315
|
-
this.updateMessage();
|
|
316
|
-
this.refresh();
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
this._dataProvider = undefined;
|
|
320
|
-
this.updateMessage();
|
|
321
|
-
}
|
|
322
|
-
this._onDidChangeWelcomeState.fire();
|
|
323
|
-
}
|
|
324
|
-
get message() {
|
|
325
|
-
return this._message;
|
|
326
|
-
}
|
|
327
|
-
set message(message) {
|
|
328
|
-
this._message = message;
|
|
329
|
-
this.updateMessage();
|
|
330
|
-
this._onDidChangeWelcomeState.fire();
|
|
331
|
-
}
|
|
332
|
-
get title() {
|
|
333
|
-
return this._title;
|
|
334
|
-
}
|
|
335
|
-
set title(name) {
|
|
336
|
-
this._title = name;
|
|
337
|
-
this._onDidChangeTitle.fire(this._title);
|
|
338
|
-
}
|
|
339
|
-
get description() {
|
|
340
|
-
return this._description;
|
|
341
|
-
}
|
|
342
|
-
set description(description) {
|
|
343
|
-
this._description = description;
|
|
344
|
-
this._onDidChangeDescription.fire(this._description);
|
|
345
|
-
}
|
|
346
|
-
get badge() {
|
|
347
|
-
return this._badge;
|
|
348
|
-
}
|
|
349
|
-
set badge(badge) {
|
|
350
|
-
if (this._badge?.value === badge?.value &&
|
|
351
|
-
this._badge?.tooltip === badge?.tooltip) {
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
if (this._badgeActivity) {
|
|
355
|
-
this._badgeActivity.dispose();
|
|
356
|
-
this._badgeActivity = undefined;
|
|
357
|
-
}
|
|
358
|
-
this._badge = badge;
|
|
359
|
-
if (badge) {
|
|
360
|
-
const activity = {
|
|
361
|
-
badge: ( new NumberBadge(badge.value, () => badge.tooltip)),
|
|
362
|
-
priority: 50
|
|
363
|
-
};
|
|
364
|
-
this._badgeActivity = this.activityService.showViewActivity(this.id, activity);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
get canSelectMany() {
|
|
368
|
-
return this._canSelectMany;
|
|
369
|
-
}
|
|
370
|
-
set canSelectMany(canSelectMany) {
|
|
371
|
-
const oldCanSelectMany = this._canSelectMany;
|
|
372
|
-
this._canSelectMany = canSelectMany;
|
|
373
|
-
if (this._canSelectMany !== oldCanSelectMany) {
|
|
374
|
-
this.tree?.updateOptions({ multipleSelectionSupport: this.canSelectMany });
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
get manuallyManageCheckboxes() {
|
|
378
|
-
return this._manuallyManageCheckboxes;
|
|
379
|
-
}
|
|
380
|
-
set manuallyManageCheckboxes(manuallyManageCheckboxes) {
|
|
381
|
-
this._manuallyManageCheckboxes = manuallyManageCheckboxes;
|
|
382
|
-
}
|
|
383
|
-
get hasIconForParentNode() {
|
|
384
|
-
return this._hasIconForParentNode;
|
|
385
|
-
}
|
|
386
|
-
get hasIconForLeafNode() {
|
|
387
|
-
return this._hasIconForLeafNode;
|
|
388
|
-
}
|
|
389
|
-
get visible() {
|
|
390
|
-
return this.isVisible;
|
|
391
|
-
}
|
|
392
|
-
initializeShowCollapseAllAction(startingValue = false) {
|
|
393
|
-
if (!this.collapseAllContext) {
|
|
394
|
-
this.collapseAllContextKey = ( new RawContextKey(`treeView.${this.id}.enableCollapseAll`, startingValue, ( localizeWithPath(
|
|
395
|
-
'vs/workbench/browser/parts/views/treeView',
|
|
396
|
-
'treeView.enableCollapseAll',
|
|
397
|
-
"Whether the the tree view with id {0} enables collapse all.",
|
|
398
|
-
this.id
|
|
399
|
-
))));
|
|
400
|
-
this.collapseAllContext = this.collapseAllContextKey.bindTo(this.contextKeyService);
|
|
401
|
-
}
|
|
402
|
-
return true;
|
|
403
|
-
}
|
|
404
|
-
get showCollapseAllAction() {
|
|
405
|
-
this.initializeShowCollapseAllAction();
|
|
406
|
-
return !!this.collapseAllContext?.get();
|
|
407
|
-
}
|
|
408
|
-
set showCollapseAllAction(showCollapseAllAction) {
|
|
409
|
-
this.initializeShowCollapseAllAction(showCollapseAllAction);
|
|
410
|
-
this.collapseAllContext?.set(showCollapseAllAction);
|
|
411
|
-
}
|
|
412
|
-
initializeShowRefreshAction(startingValue = false) {
|
|
413
|
-
if (!this.refreshContext) {
|
|
414
|
-
this.refreshContextKey = ( new RawContextKey(`treeView.${this.id}.enableRefresh`, startingValue, ( localizeWithPath(
|
|
415
|
-
'vs/workbench/browser/parts/views/treeView',
|
|
416
|
-
'treeView.enableRefresh',
|
|
417
|
-
"Whether the tree view with id {0} enables refresh.",
|
|
418
|
-
this.id
|
|
419
|
-
))));
|
|
420
|
-
this.refreshContext = this.refreshContextKey.bindTo(this.contextKeyService);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
get showRefreshAction() {
|
|
424
|
-
this.initializeShowRefreshAction();
|
|
425
|
-
return !!this.refreshContext?.get();
|
|
426
|
-
}
|
|
427
|
-
set showRefreshAction(showRefreshAction) {
|
|
428
|
-
this.initializeShowRefreshAction(showRefreshAction);
|
|
429
|
-
this.refreshContext?.set(showRefreshAction);
|
|
430
|
-
}
|
|
431
|
-
registerActions() {
|
|
432
|
-
const that = this;
|
|
433
|
-
this._register(registerAction2(class extends Action2 {
|
|
434
|
-
constructor() {
|
|
435
|
-
super({
|
|
436
|
-
id: `workbench.actions.treeView.${that.id}.refresh`,
|
|
437
|
-
title: ( localizeWithPath('vs/workbench/browser/parts/views/treeView', 'refresh', "Refresh")),
|
|
438
|
-
menu: {
|
|
439
|
-
id: MenuId.ViewTitle,
|
|
440
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', that.id)), that.refreshContextKey)),
|
|
441
|
-
group: 'navigation',
|
|
442
|
-
order: Number.MAX_SAFE_INTEGER - 1,
|
|
443
|
-
},
|
|
444
|
-
icon: Codicon.refresh
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
async run() {
|
|
448
|
-
return that.refresh();
|
|
449
|
-
}
|
|
450
|
-
}));
|
|
451
|
-
this._register(registerAction2(class extends Action2 {
|
|
452
|
-
constructor() {
|
|
453
|
-
super({
|
|
454
|
-
id: `workbench.actions.treeView.${that.id}.collapseAll`,
|
|
455
|
-
title: ( localizeWithPath('vs/workbench/browser/parts/views/treeView', 'collapseAll', "Collapse All")),
|
|
456
|
-
menu: {
|
|
457
|
-
id: MenuId.ViewTitle,
|
|
458
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', that.id)), that.collapseAllContextKey)),
|
|
459
|
-
group: 'navigation',
|
|
460
|
-
order: Number.MAX_SAFE_INTEGER,
|
|
461
|
-
},
|
|
462
|
-
precondition: that.collapseAllToggleContextKey,
|
|
463
|
-
icon: Codicon.collapseAll
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
async run() {
|
|
467
|
-
if (that.tree) {
|
|
468
|
-
return ( new CollapseAllAction(that.tree, true)).run();
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}));
|
|
472
|
-
}
|
|
473
|
-
setVisibility(isVisible) {
|
|
474
|
-
this.initialize();
|
|
475
|
-
isVisible = !!isVisible;
|
|
476
|
-
if (this.isVisible === isVisible) {
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
this.isVisible = isVisible;
|
|
480
|
-
if (this.tree) {
|
|
481
|
-
if (this.isVisible) {
|
|
482
|
-
dom.show(this.tree.getHTMLElement());
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
dom.hide(this.tree.getHTMLElement());
|
|
486
|
-
}
|
|
487
|
-
if (this.isVisible && this.elementsToRefresh.length && this.dataProvider) {
|
|
488
|
-
this.doRefresh(this.elementsToRefresh);
|
|
489
|
-
this.elementsToRefresh = [];
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
setTimeout0(() => {
|
|
493
|
-
if (this.dataProvider) {
|
|
494
|
-
this._onDidChangeVisibility.fire(this.isVisible);
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
if (this.visible) {
|
|
498
|
-
this.activate();
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
focus(reveal = true, revealItem) {
|
|
502
|
-
if (this.tree && this.root.children && this.root.children.length > 0) {
|
|
503
|
-
const element = revealItem ?? this.tree.getSelection()[0];
|
|
504
|
-
if (element && reveal) {
|
|
505
|
-
this.tree.reveal(element, 0.5);
|
|
506
|
-
}
|
|
507
|
-
this.tree.domFocus();
|
|
508
|
-
}
|
|
509
|
-
else if (this.tree && this.treeContainer && !this.treeContainer.classList.contains('hide')) {
|
|
510
|
-
this.tree.domFocus();
|
|
511
|
-
}
|
|
512
|
-
else {
|
|
513
|
-
this.domNode.focus();
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
show(container) {
|
|
517
|
-
this._container = container;
|
|
518
|
-
dom.append(container, this.domNode);
|
|
519
|
-
}
|
|
520
|
-
create() {
|
|
521
|
-
this.domNode = dom.$('.tree-explorer-viewlet-tree-view');
|
|
522
|
-
this.messageElement = dom.append(this.domNode, dom.$('.message'));
|
|
523
|
-
this.updateMessage();
|
|
524
|
-
this.treeContainer = dom.append(this.domNode, dom.$('.customview-tree'));
|
|
525
|
-
this.treeContainer.classList.add('file-icon-themable-tree', 'show-file-icons');
|
|
526
|
-
const focusTracker = this._register(dom.trackFocus(this.domNode));
|
|
527
|
-
this._register(focusTracker.onDidFocus(() => this.focused = true));
|
|
528
|
-
this._register(focusTracker.onDidBlur(() => this.focused = false));
|
|
529
|
-
}
|
|
530
|
-
createTree() {
|
|
531
|
-
const actionViewItemProvider = createActionViewItem.bind(undefined, this.instantiationService);
|
|
532
|
-
const treeMenus = this._register(this.instantiationService.createInstance(TreeMenus, this.id));
|
|
533
|
-
this.treeLabels = this._register(this.instantiationService.createInstance(ResourceLabels, this));
|
|
534
|
-
const dataSource = this.instantiationService.createInstance(TreeDataSource, this, (task) => this.progressService.withProgress({ location: this.id }, () => task));
|
|
535
|
-
const aligner = ( new Aligner(this.themeService));
|
|
536
|
-
const checkboxStateHandler = this._register(( new CheckboxStateHandler()));
|
|
537
|
-
const renderer = this.instantiationService.createInstance(TreeRenderer, this.id, treeMenus, this.treeLabels, actionViewItemProvider, aligner, checkboxStateHandler, () => this.manuallyManageCheckboxes);
|
|
538
|
-
this._register(renderer.onDidChangeCheckboxState(e => this._onDidChangeCheckboxState.fire(e)));
|
|
539
|
-
const widgetAriaLabel = this._title;
|
|
540
|
-
this.tree = this._register(this.instantiationService.createInstance(Tree, this.id, this.treeContainer, ( new TreeViewDelegate()), [renderer], dataSource, {
|
|
541
|
-
identityProvider: ( new TreeViewIdentityProvider()),
|
|
542
|
-
accessibilityProvider: {
|
|
543
|
-
getAriaLabel(element) {
|
|
544
|
-
if (element.accessibilityInformation) {
|
|
545
|
-
return element.accessibilityInformation.label;
|
|
546
|
-
}
|
|
547
|
-
if (isString(element.tooltip)) {
|
|
548
|
-
return element.tooltip;
|
|
549
|
-
}
|
|
550
|
-
else {
|
|
551
|
-
if (element.resourceUri && !element.label) {
|
|
552
|
-
return null;
|
|
553
|
-
}
|
|
554
|
-
let buildAriaLabel = '';
|
|
555
|
-
if (element.label) {
|
|
556
|
-
buildAriaLabel += element.label.label + ' ';
|
|
557
|
-
}
|
|
558
|
-
if (element.description) {
|
|
559
|
-
buildAriaLabel += element.description;
|
|
560
|
-
}
|
|
561
|
-
return buildAriaLabel;
|
|
562
|
-
}
|
|
563
|
-
},
|
|
564
|
-
getRole(element) {
|
|
565
|
-
return element.accessibilityInformation?.role ?? 'treeitem';
|
|
566
|
-
},
|
|
567
|
-
getWidgetAriaLabel() {
|
|
568
|
-
return widgetAriaLabel;
|
|
569
|
-
}
|
|
570
|
-
},
|
|
571
|
-
keyboardNavigationLabelProvider: {
|
|
572
|
-
getKeyboardNavigationLabel: (item) => {
|
|
573
|
-
return item.label ? item.label.label : (item.resourceUri ? basename(URI.revive(item.resourceUri)) : undefined);
|
|
574
|
-
}
|
|
575
|
-
},
|
|
576
|
-
expandOnlyOnTwistieClick: (e) => {
|
|
577
|
-
return !!e.command || !!e.checkbox || this.configurationService.getValue('workbench.tree.expandMode') === 'doubleClick';
|
|
578
|
-
},
|
|
579
|
-
collapseByDefault: (e) => {
|
|
580
|
-
return e.collapsibleState !== TreeItemCollapsibleState.Expanded;
|
|
581
|
-
},
|
|
582
|
-
multipleSelectionSupport: this.canSelectMany,
|
|
583
|
-
dnd: this.treeViewDnd,
|
|
584
|
-
overrideStyles: {
|
|
585
|
-
listBackground: this.viewLocation === 1 ? PANEL_BACKGROUND : SIDE_BAR_BACKGROUND
|
|
586
|
-
}
|
|
587
|
-
}));
|
|
588
|
-
treeMenus.setContextKeyService(this.tree.contextKeyService);
|
|
589
|
-
aligner.tree = this.tree;
|
|
590
|
-
const actionRunner = ( new MultipleSelectionActionRunner(this.notificationService, () => this.tree.getSelection()));
|
|
591
|
-
renderer.actionRunner = actionRunner;
|
|
592
|
-
this.tree.contextKeyService.createKey(this.id, true);
|
|
593
|
-
const customTreeKey = RawCustomTreeViewContextKey.bindTo(this.tree.contextKeyService);
|
|
594
|
-
customTreeKey.set(true);
|
|
595
|
-
this._register(this.tree.onContextMenu(e => this.onContextMenu(treeMenus, e, actionRunner)));
|
|
596
|
-
this._register(this.tree.onDidChangeSelection(e => {
|
|
597
|
-
this.lastSelection = e.elements;
|
|
598
|
-
this.lastActive = this.tree?.getFocus()[0] ?? this.lastActive;
|
|
599
|
-
this._onDidChangeSelectionAndFocus.fire({ selection: this.lastSelection, focus: this.lastActive });
|
|
600
|
-
}));
|
|
601
|
-
this._register(this.tree.onDidChangeFocus(e => {
|
|
602
|
-
if (e.elements.length && (e.elements[0] !== this.lastActive)) {
|
|
603
|
-
this.lastActive = e.elements[0];
|
|
604
|
-
this.lastSelection = this.tree?.getSelection() ?? this.lastSelection;
|
|
605
|
-
this._onDidChangeSelectionAndFocus.fire({ selection: this.lastSelection, focus: this.lastActive });
|
|
606
|
-
}
|
|
607
|
-
}));
|
|
608
|
-
this._register(this.tree.onDidChangeCollapseState(e => {
|
|
609
|
-
if (!e.node.element) {
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
const element = Array.isArray(e.node.element.element) ? e.node.element.element[0] : e.node.element.element;
|
|
613
|
-
if (e.node.collapsed) {
|
|
614
|
-
this._onDidCollapseItem.fire(element);
|
|
615
|
-
}
|
|
616
|
-
else {
|
|
617
|
-
this._onDidExpandItem.fire(element);
|
|
618
|
-
}
|
|
619
|
-
}));
|
|
620
|
-
this.tree.setInput(this.root).then(() => this.updateContentAreas());
|
|
621
|
-
this._register(this.tree.onDidOpen(async (e) => {
|
|
622
|
-
if (!e.browserEvent) {
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
if (e.browserEvent.target && e.browserEvent.target.classList.contains(TreeItemCheckbox.checkboxClass)) {
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
const selection = this.tree.getSelection();
|
|
629
|
-
const command = await this.resolveCommand(selection.length === 1 ? selection[0] : undefined);
|
|
630
|
-
if (command && isTreeCommandEnabled(command, this.contextKeyService)) {
|
|
631
|
-
let args = command.arguments || [];
|
|
632
|
-
if (command.id === API_OPEN_EDITOR_COMMAND_ID || command.id === API_OPEN_DIFF_EDITOR_COMMAND_ID) {
|
|
633
|
-
args = [...args, e];
|
|
634
|
-
}
|
|
635
|
-
try {
|
|
636
|
-
await this.commandService.executeCommand(command.id, ...args);
|
|
637
|
-
}
|
|
638
|
-
catch (err) {
|
|
639
|
-
this.notificationService.error(err);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
}));
|
|
643
|
-
this._register(treeMenus.onDidChange((changed) => {
|
|
644
|
-
if (this.tree?.hasNode(changed)) {
|
|
645
|
-
this.tree?.rerender(changed);
|
|
646
|
-
}
|
|
647
|
-
}));
|
|
648
|
-
}
|
|
649
|
-
async resolveCommand(element) {
|
|
650
|
-
let command = element?.command;
|
|
651
|
-
if (element && !command) {
|
|
652
|
-
if ((element instanceof ResolvableTreeItem) && element.hasResolve) {
|
|
653
|
-
await element.resolve(( new CancellationTokenSource()).token);
|
|
654
|
-
command = element.command;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
return command;
|
|
658
|
-
}
|
|
659
|
-
onContextMenu(treeMenus, treeEvent, actionRunner) {
|
|
660
|
-
this.hoverService.hideHover();
|
|
661
|
-
const node = treeEvent.element;
|
|
662
|
-
if (node === null) {
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
const event = treeEvent.browserEvent;
|
|
666
|
-
event.preventDefault();
|
|
667
|
-
event.stopPropagation();
|
|
668
|
-
this.tree.setFocus([node]);
|
|
669
|
-
const actions = treeMenus.getResourceContextActions(node);
|
|
670
|
-
if (!actions.length) {
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
this.contextMenuService.showContextMenu({
|
|
674
|
-
getAnchor: () => treeEvent.anchor,
|
|
675
|
-
getActions: () => actions,
|
|
676
|
-
getActionViewItem: (action) => {
|
|
677
|
-
const keybinding = this.keybindingService.lookupKeybinding(action.id);
|
|
678
|
-
if (keybinding) {
|
|
679
|
-
return ( new ActionViewItem(action, action, { label: true, keybinding: keybinding.getLabel() }));
|
|
680
|
-
}
|
|
681
|
-
return undefined;
|
|
682
|
-
},
|
|
683
|
-
onHide: (wasCancelled) => {
|
|
684
|
-
if (wasCancelled) {
|
|
685
|
-
this.tree.domFocus();
|
|
686
|
-
}
|
|
687
|
-
},
|
|
688
|
-
getActionsContext: () => ({ $treeViewId: this.id, $treeItemHandle: node.handle }),
|
|
689
|
-
actionRunner
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
updateMessage() {
|
|
693
|
-
if (this._message) {
|
|
694
|
-
this.showMessage(this._message);
|
|
695
|
-
}
|
|
696
|
-
else if (!this.dataProvider) {
|
|
697
|
-
this.showMessage(noDataProviderMessage);
|
|
698
|
-
}
|
|
699
|
-
else {
|
|
700
|
-
this.hideMessage();
|
|
701
|
-
}
|
|
702
|
-
this.updateContentAreas();
|
|
703
|
-
}
|
|
704
|
-
showMessage(message) {
|
|
705
|
-
if (isRenderedMessageValue(this._messageValue)) {
|
|
706
|
-
this._messageValue.dispose();
|
|
707
|
-
}
|
|
708
|
-
if (isMarkdownString(message) && !this.markdownRenderer) {
|
|
709
|
-
this.markdownRenderer = this.instantiationService.createInstance(MarkdownRenderer, {});
|
|
710
|
-
}
|
|
711
|
-
this._messageValue = isMarkdownString(message) ? this.markdownRenderer.render(message) : message;
|
|
712
|
-
if (!this.messageElement) {
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
this.messageElement.classList.remove('hide');
|
|
716
|
-
this.resetMessageElement();
|
|
717
|
-
if (typeof this._messageValue === 'string' && !isFalsyOrWhitespace(this._messageValue)) {
|
|
718
|
-
this.messageElement.textContent = this._messageValue;
|
|
719
|
-
}
|
|
720
|
-
else if (isRenderedMessageValue(this._messageValue)) {
|
|
721
|
-
this.messageElement.appendChild(this._messageValue.element);
|
|
722
|
-
}
|
|
723
|
-
this.layout(this._height, this._width);
|
|
724
|
-
}
|
|
725
|
-
hideMessage() {
|
|
726
|
-
this.resetMessageElement();
|
|
727
|
-
this.messageElement?.classList.add('hide');
|
|
728
|
-
this.layout(this._height, this._width);
|
|
729
|
-
}
|
|
730
|
-
resetMessageElement() {
|
|
731
|
-
if (this.messageElement) {
|
|
732
|
-
dom.clearNode(this.messageElement);
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
layout(height, width) {
|
|
736
|
-
if (height && width && this.messageElement && this.treeContainer) {
|
|
737
|
-
this._height = height;
|
|
738
|
-
this._width = width;
|
|
739
|
-
const treeHeight = height - dom.getTotalHeight(this.messageElement);
|
|
740
|
-
this.treeContainer.style.height = treeHeight + 'px';
|
|
741
|
-
this.tree?.layout(treeHeight, width);
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
getOptimalWidth() {
|
|
745
|
-
if (this.tree) {
|
|
746
|
-
const parentNode = this.tree.getHTMLElement();
|
|
747
|
-
const childNodes = [].slice.call(parentNode.querySelectorAll('.outline-item-label > a'));
|
|
748
|
-
return dom.getLargestChildWidth(parentNode, childNodes);
|
|
749
|
-
}
|
|
750
|
-
return 0;
|
|
751
|
-
}
|
|
752
|
-
async refresh(elements) {
|
|
753
|
-
if (this.dataProvider && this.tree) {
|
|
754
|
-
if (this.refreshing) {
|
|
755
|
-
await Event.toPromise(this._onDidCompleteRefresh.event);
|
|
756
|
-
}
|
|
757
|
-
if (!elements) {
|
|
758
|
-
elements = [this.root];
|
|
759
|
-
this.elementsToRefresh = [];
|
|
760
|
-
}
|
|
761
|
-
for (const element of elements) {
|
|
762
|
-
element.children = undefined;
|
|
763
|
-
}
|
|
764
|
-
if (this.isVisible) {
|
|
765
|
-
return this.doRefresh(elements);
|
|
766
|
-
}
|
|
767
|
-
else {
|
|
768
|
-
if (this.elementsToRefresh.length) {
|
|
769
|
-
const seen = ( new Set());
|
|
770
|
-
this.elementsToRefresh.forEach(element => seen.add(element.handle));
|
|
771
|
-
for (const element of elements) {
|
|
772
|
-
if (!( seen.has(element.handle))) {
|
|
773
|
-
this.elementsToRefresh.push(element);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
else {
|
|
778
|
-
this.elementsToRefresh.push(...elements);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
return undefined;
|
|
783
|
-
}
|
|
784
|
-
async expand(itemOrItems) {
|
|
785
|
-
const tree = this.tree;
|
|
786
|
-
if (!tree) {
|
|
787
|
-
return;
|
|
788
|
-
}
|
|
789
|
-
try {
|
|
790
|
-
itemOrItems = Array.isArray(itemOrItems) ? itemOrItems : [itemOrItems];
|
|
791
|
-
for (const element of itemOrItems) {
|
|
792
|
-
await tree.expand(element, false);
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
catch (e) {
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
isCollapsed(item) {
|
|
799
|
-
return !!this.tree?.isCollapsed(item);
|
|
800
|
-
}
|
|
801
|
-
setSelection(items) {
|
|
802
|
-
this.tree?.setSelection(items);
|
|
803
|
-
}
|
|
804
|
-
getSelection() {
|
|
805
|
-
return this.tree?.getSelection() ?? [];
|
|
806
|
-
}
|
|
807
|
-
setFocus(item) {
|
|
808
|
-
if (this.tree) {
|
|
809
|
-
if (item) {
|
|
810
|
-
this.focus(true, item);
|
|
811
|
-
this.tree.setFocus([item]);
|
|
812
|
-
}
|
|
813
|
-
else if (this.tree.getFocus().length === 0) {
|
|
814
|
-
this.tree.setFocus([]);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
async reveal(item) {
|
|
819
|
-
if (this.tree) {
|
|
820
|
-
return this.tree.reveal(item);
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
async doRefresh(elements) {
|
|
824
|
-
const tree = this.tree;
|
|
825
|
-
if (tree && this.visible) {
|
|
826
|
-
this.refreshing = true;
|
|
827
|
-
const oldSelection = tree.getSelection();
|
|
828
|
-
try {
|
|
829
|
-
await Promise.all(( elements.map(element => tree.updateChildren(element, true, true))));
|
|
830
|
-
}
|
|
831
|
-
catch (e) {
|
|
832
|
-
this.logService.error(e);
|
|
833
|
-
}
|
|
834
|
-
const newSelection = tree.getSelection();
|
|
835
|
-
if (oldSelection.length !== newSelection.length || ( oldSelection.some((value, index) => value.handle !== newSelection[index].handle))) {
|
|
836
|
-
this.lastSelection = newSelection;
|
|
837
|
-
this._onDidChangeSelectionAndFocus.fire({ selection: this.lastSelection, focus: this.lastActive });
|
|
838
|
-
}
|
|
839
|
-
this.refreshing = false;
|
|
840
|
-
this._onDidCompleteRefresh.fire();
|
|
841
|
-
this.updateContentAreas();
|
|
842
|
-
if (this.focused) {
|
|
843
|
-
this.focus(false);
|
|
844
|
-
}
|
|
845
|
-
this.updateCollapseAllToggle();
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
initializeCollapseAllToggle() {
|
|
849
|
-
if (!this.collapseAllToggleContext) {
|
|
850
|
-
this.collapseAllToggleContextKey = ( new RawContextKey(`treeView.${this.id}.toggleCollapseAll`, false, ( localizeWithPath(
|
|
851
|
-
'vs/workbench/browser/parts/views/treeView',
|
|
852
|
-
'treeView.toggleCollapseAll',
|
|
853
|
-
"Whether collapse all is toggled for the tree view with id {0}.",
|
|
854
|
-
this.id
|
|
855
|
-
))));
|
|
856
|
-
this.collapseAllToggleContext = this.collapseAllToggleContextKey.bindTo(this.contextKeyService);
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
updateCollapseAllToggle() {
|
|
860
|
-
if (this.showCollapseAllAction) {
|
|
861
|
-
this.initializeCollapseAllToggle();
|
|
862
|
-
this.collapseAllToggleContext?.set(!!this.root.children && (this.root.children.length > 0) &&
|
|
863
|
-
( this.root.children.some(value => value.collapsibleState !== TreeItemCollapsibleState.None)));
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
updateContentAreas() {
|
|
867
|
-
const isTreeEmpty = !this.root.children || this.root.children.length === 0;
|
|
868
|
-
if (this._messageValue && isTreeEmpty && !this.refreshing && this.treeContainer) {
|
|
869
|
-
if (!this.dragAndDropController) {
|
|
870
|
-
this.treeContainer.classList.add('hide');
|
|
871
|
-
}
|
|
872
|
-
this.domNode.setAttribute('tabindex', '0');
|
|
873
|
-
}
|
|
874
|
-
else if (this.treeContainer) {
|
|
875
|
-
this.treeContainer.classList.remove('hide');
|
|
876
|
-
if (this.domNode === dom.getActiveElement()) {
|
|
877
|
-
this.focus();
|
|
878
|
-
}
|
|
879
|
-
this.domNode.removeAttribute('tabindex');
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
get container() {
|
|
883
|
-
return this._container;
|
|
884
|
-
}
|
|
885
|
-
};
|
|
886
|
-
AbstractTreeView = ( __decorate([
|
|
887
|
-
( __param(2, IThemeService)),
|
|
888
|
-
( __param(3, IInstantiationService)),
|
|
889
|
-
( __param(4, ICommandService)),
|
|
890
|
-
( __param(5, IConfigurationService)),
|
|
891
|
-
( __param(6, IProgressService)),
|
|
892
|
-
( __param(7, IContextMenuService)),
|
|
893
|
-
( __param(8, IKeybindingService)),
|
|
894
|
-
( __param(9, INotificationService)),
|
|
895
|
-
( __param(10, IViewDescriptorService)),
|
|
896
|
-
( __param(11, IHoverService)),
|
|
897
|
-
( __param(12, IContextKeyService)),
|
|
898
|
-
( __param(13, IActivityService)),
|
|
899
|
-
( __param(14, ILogService))
|
|
900
|
-
], AbstractTreeView));
|
|
901
|
-
class TreeViewIdentityProvider {
|
|
902
|
-
getId(element) {
|
|
903
|
-
return element.handle;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
class TreeViewDelegate {
|
|
907
|
-
getHeight(element) {
|
|
908
|
-
return TreeRenderer.ITEM_HEIGHT;
|
|
909
|
-
}
|
|
910
|
-
getTemplateId(element) {
|
|
911
|
-
return TreeRenderer.TREE_TEMPLATE_ID;
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
class TreeDataSource {
|
|
915
|
-
constructor(treeView, withProgress) {
|
|
916
|
-
this.treeView = treeView;
|
|
917
|
-
this.withProgress = withProgress;
|
|
918
|
-
}
|
|
919
|
-
hasChildren(element) {
|
|
920
|
-
return !!this.treeView.dataProvider && (element.collapsibleState !== TreeItemCollapsibleState.None);
|
|
921
|
-
}
|
|
922
|
-
async getChildren(element) {
|
|
923
|
-
let result = [];
|
|
924
|
-
if (this.treeView.dataProvider) {
|
|
925
|
-
try {
|
|
926
|
-
result = (await this.withProgress(this.treeView.dataProvider.getChildren(element))) ?? [];
|
|
927
|
-
}
|
|
928
|
-
catch (e) {
|
|
929
|
-
if (!e.message.startsWith('Bad progress location:')) {
|
|
930
|
-
throw e;
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
return result;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
let TreeRenderer = class TreeRenderer extends Disposable {
|
|
938
|
-
static { TreeRenderer_1 = this; }
|
|
939
|
-
static { this.ITEM_HEIGHT = 22; }
|
|
940
|
-
static { this.TREE_TEMPLATE_ID = 'treeExplorer'; }
|
|
941
|
-
constructor(treeViewId, menus, labels, actionViewItemProvider, aligner, checkboxStateHandler, manuallyManageCheckboxes, themeService, configurationService, labelService, hoverService, treeViewsService, contextKeyService) {
|
|
942
|
-
super();
|
|
943
|
-
this.treeViewId = treeViewId;
|
|
944
|
-
this.menus = menus;
|
|
945
|
-
this.labels = labels;
|
|
946
|
-
this.actionViewItemProvider = actionViewItemProvider;
|
|
947
|
-
this.aligner = aligner;
|
|
948
|
-
this.checkboxStateHandler = checkboxStateHandler;
|
|
949
|
-
this.manuallyManageCheckboxes = manuallyManageCheckboxes;
|
|
950
|
-
this.themeService = themeService;
|
|
951
|
-
this.configurationService = configurationService;
|
|
952
|
-
this.labelService = labelService;
|
|
953
|
-
this.hoverService = hoverService;
|
|
954
|
-
this.treeViewsService = treeViewsService;
|
|
955
|
-
this.contextKeyService = contextKeyService;
|
|
956
|
-
this._onDidChangeCheckboxState = this._register(( new Emitter()));
|
|
957
|
-
this.onDidChangeCheckboxState = this._onDidChangeCheckboxState.event;
|
|
958
|
-
this._hasCheckbox = false;
|
|
959
|
-
this._renderedElements = ( new Map());
|
|
960
|
-
this._hoverDelegate = {
|
|
961
|
-
showHover: (options) => this.hoverService.showHover(options),
|
|
962
|
-
delay: this.configurationService.getValue('workbench.hover.delay')
|
|
963
|
-
};
|
|
964
|
-
this._register(this.themeService.onDidFileIconThemeChange(() => this.rerender()));
|
|
965
|
-
this._register(this.themeService.onDidColorThemeChange(() => this.rerender()));
|
|
966
|
-
this._register(checkboxStateHandler.onDidChangeCheckboxState(items => {
|
|
967
|
-
this.updateCheckboxes(items);
|
|
968
|
-
}));
|
|
969
|
-
}
|
|
970
|
-
get templateId() {
|
|
971
|
-
return TreeRenderer_1.TREE_TEMPLATE_ID;
|
|
972
|
-
}
|
|
973
|
-
set actionRunner(actionRunner) {
|
|
974
|
-
this._actionRunner = actionRunner;
|
|
975
|
-
}
|
|
976
|
-
renderTemplate(container) {
|
|
977
|
-
container.classList.add('custom-view-tree-node-item');
|
|
978
|
-
const checkboxContainer = dom.append(container, dom.$(''));
|
|
979
|
-
const resourceLabel = this.labels.create(container, { supportHighlights: true, hoverDelegate: this._hoverDelegate });
|
|
980
|
-
const icon = dom.prepend(resourceLabel.element, dom.$('.custom-view-tree-node-item-icon'));
|
|
981
|
-
const actionsContainer = dom.append(resourceLabel.element, dom.$('.actions'));
|
|
982
|
-
const actionBar = ( new ActionBar(actionsContainer, {
|
|
983
|
-
actionViewItemProvider: this.actionViewItemProvider
|
|
984
|
-
}));
|
|
985
|
-
return { resourceLabel, icon, checkboxContainer, actionBar, container, elementDisposable: ( new DisposableStore()) };
|
|
986
|
-
}
|
|
987
|
-
getHover(label, resource, node) {
|
|
988
|
-
if (!(node instanceof ResolvableTreeItem) || !node.hasResolve) {
|
|
989
|
-
if (resource && !node.tooltip) {
|
|
990
|
-
return undefined;
|
|
991
|
-
}
|
|
992
|
-
else if (node.tooltip === undefined) {
|
|
993
|
-
return label;
|
|
994
|
-
}
|
|
995
|
-
else if (!isString(node.tooltip)) {
|
|
996
|
-
return { markdown: node.tooltip, markdownNotSupportedFallback: resource ? undefined : renderMarkdownAsPlaintext(node.tooltip) };
|
|
997
|
-
}
|
|
998
|
-
else if (node.tooltip !== '') {
|
|
999
|
-
return node.tooltip;
|
|
1000
|
-
}
|
|
1001
|
-
else {
|
|
1002
|
-
return undefined;
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
return {
|
|
1006
|
-
markdown: typeof node.tooltip === 'string' ? node.tooltip :
|
|
1007
|
-
(token) => {
|
|
1008
|
-
return ( new Promise((resolve) => {
|
|
1009
|
-
node.resolve(token).then(() => resolve(node.tooltip));
|
|
1010
|
-
}));
|
|
1011
|
-
},
|
|
1012
|
-
markdownNotSupportedFallback: resource ? undefined : (label ?? '')
|
|
1013
|
-
};
|
|
1014
|
-
}
|
|
1015
|
-
renderElement(element, index, templateData) {
|
|
1016
|
-
const node = element.element;
|
|
1017
|
-
const resource = node.resourceUri ? URI.revive(node.resourceUri) : null;
|
|
1018
|
-
const treeItemLabel = node.label ? node.label : (resource ? { label: basename(resource) } : undefined);
|
|
1019
|
-
const description = isString(node.description) ? node.description : resource && node.description === true ? this.labelService.getUriLabel(dirname(resource), { relative: true }) : undefined;
|
|
1020
|
-
const label = treeItemLabel ? treeItemLabel.label : undefined;
|
|
1021
|
-
const matches = (treeItemLabel && treeItemLabel.highlights && label) ? ( treeItemLabel.highlights.map(([start, end]) => {
|
|
1022
|
-
if (start < 0) {
|
|
1023
|
-
start = label.length + start;
|
|
1024
|
-
}
|
|
1025
|
-
if (end < 0) {
|
|
1026
|
-
end = label.length + end;
|
|
1027
|
-
}
|
|
1028
|
-
if ((start >= label.length) || (end > label.length)) {
|
|
1029
|
-
return ({ start: 0, end: 0 });
|
|
1030
|
-
}
|
|
1031
|
-
if (start > end) {
|
|
1032
|
-
const swap = start;
|
|
1033
|
-
start = end;
|
|
1034
|
-
end = swap;
|
|
1035
|
-
}
|
|
1036
|
-
return ({ start, end });
|
|
1037
|
-
})) : undefined;
|
|
1038
|
-
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
|
|
1039
|
-
const iconUrl = icon ? URI.revive(icon) : undefined;
|
|
1040
|
-
const title = this.getHover(label, resource, node);
|
|
1041
|
-
templateData.actionBar.clear();
|
|
1042
|
-
templateData.icon.style.color = '';
|
|
1043
|
-
let commandEnabled = true;
|
|
1044
|
-
if (node.command) {
|
|
1045
|
-
commandEnabled = isTreeCommandEnabled(node.command, this.contextKeyService);
|
|
1046
|
-
}
|
|
1047
|
-
this.renderCheckbox(node, templateData);
|
|
1048
|
-
if (resource) {
|
|
1049
|
-
const fileDecorations = this.configurationService.getValue('explorer.decorations');
|
|
1050
|
-
const labelResource = resource ? resource : ( URI.parse('missing:_icon_resource'));
|
|
1051
|
-
templateData.resourceLabel.setResource({ name: label, description, resource: labelResource }, {
|
|
1052
|
-
fileKind: this.getFileKind(node),
|
|
1053
|
-
title,
|
|
1054
|
-
hideIcon: this.shouldHideResourceLabelIcon(iconUrl, node.themeIcon),
|
|
1055
|
-
fileDecorations,
|
|
1056
|
-
extraClasses: ['custom-view-tree-node-item-resourceLabel'],
|
|
1057
|
-
matches: matches ? matches : createMatches(element.filterData),
|
|
1058
|
-
strikethrough: treeItemLabel?.strikethrough,
|
|
1059
|
-
disabledCommand: !commandEnabled,
|
|
1060
|
-
labelEscapeNewLines: true,
|
|
1061
|
-
forceLabel: !!node.label
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1064
|
-
else {
|
|
1065
|
-
templateData.resourceLabel.setResource({ name: label, description }, {
|
|
1066
|
-
title,
|
|
1067
|
-
hideIcon: true,
|
|
1068
|
-
extraClasses: ['custom-view-tree-node-item-resourceLabel'],
|
|
1069
|
-
matches: matches ? matches : createMatches(element.filterData),
|
|
1070
|
-
strikethrough: treeItemLabel?.strikethrough,
|
|
1071
|
-
disabledCommand: !commandEnabled,
|
|
1072
|
-
labelEscapeNewLines: true
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
if (iconUrl) {
|
|
1076
|
-
templateData.icon.className = 'custom-view-tree-node-item-icon';
|
|
1077
|
-
templateData.icon.style.backgroundImage = dom.asCSSUrl(iconUrl);
|
|
1078
|
-
}
|
|
1079
|
-
else {
|
|
1080
|
-
let iconClass;
|
|
1081
|
-
if (this.shouldShowThemeIcon(!!resource, node.themeIcon)) {
|
|
1082
|
-
iconClass = ThemeIcon.asClassName(node.themeIcon);
|
|
1083
|
-
if (node.themeIcon.color) {
|
|
1084
|
-
templateData.icon.style.color = this.themeService.getColorTheme().getColor(node.themeIcon.color.id)?.toString() ?? '';
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
templateData.icon.className = iconClass ? `custom-view-tree-node-item-icon ${iconClass}` : '';
|
|
1088
|
-
templateData.icon.style.backgroundImage = '';
|
|
1089
|
-
}
|
|
1090
|
-
if (!commandEnabled) {
|
|
1091
|
-
templateData.icon.className = templateData.icon.className + ' disabled';
|
|
1092
|
-
if (templateData.container.parentElement) {
|
|
1093
|
-
templateData.container.parentElement.className = templateData.container.parentElement.className + ' disabled';
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
templateData.actionBar.context = { $treeViewId: this.treeViewId, $treeItemHandle: node.handle };
|
|
1097
|
-
const menuActions = this.menus.getResourceActions(node, templateData.elementDisposable);
|
|
1098
|
-
templateData.actionBar.push(menuActions.actions, { icon: true, label: false });
|
|
1099
|
-
if (this._actionRunner) {
|
|
1100
|
-
templateData.actionBar.actionRunner = this._actionRunner;
|
|
1101
|
-
}
|
|
1102
|
-
this.setAlignment(templateData.container, node);
|
|
1103
|
-
this.treeViewsService.addRenderedTreeItemElement(node, templateData.container);
|
|
1104
|
-
const renderedItems = this._renderedElements.get(element.element.handle) ?? [];
|
|
1105
|
-
this._renderedElements.set(element.element.handle, [...renderedItems, { original: element, rendered: templateData }]);
|
|
1106
|
-
}
|
|
1107
|
-
rerender() {
|
|
1108
|
-
const keys = ( new Set(( this._renderedElements.keys())));
|
|
1109
|
-
for (const key of keys) {
|
|
1110
|
-
const values = this._renderedElements.get(key) ?? [];
|
|
1111
|
-
for (const value of values) {
|
|
1112
|
-
this.disposeElement(value.original, 0, value.rendered);
|
|
1113
|
-
this.renderElement(value.original, 0, value.rendered);
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
renderCheckbox(node, templateData) {
|
|
1118
|
-
if (node.checkbox) {
|
|
1119
|
-
if (!this._hasCheckbox) {
|
|
1120
|
-
this._hasCheckbox = true;
|
|
1121
|
-
this.rerender();
|
|
1122
|
-
}
|
|
1123
|
-
if (!templateData.checkbox) {
|
|
1124
|
-
const checkbox = ( new TreeItemCheckbox(
|
|
1125
|
-
templateData.checkboxContainer,
|
|
1126
|
-
this.checkboxStateHandler,
|
|
1127
|
-
this._hoverDelegate
|
|
1128
|
-
));
|
|
1129
|
-
templateData.checkbox = checkbox;
|
|
1130
|
-
}
|
|
1131
|
-
templateData.checkbox.render(node);
|
|
1132
|
-
}
|
|
1133
|
-
else if (templateData.checkbox) {
|
|
1134
|
-
templateData.checkbox.dispose();
|
|
1135
|
-
templateData.checkbox = undefined;
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
setAlignment(container, treeItem) {
|
|
1139
|
-
container.parentElement.classList.toggle('align-icon-with-twisty', !this._hasCheckbox && this.aligner.alignIconWithTwisty(treeItem));
|
|
1140
|
-
}
|
|
1141
|
-
shouldHideResourceLabelIcon(iconUrl, icon) {
|
|
1142
|
-
return (!!iconUrl || (!!icon && !this.isFileKindThemeIcon(icon)));
|
|
1143
|
-
}
|
|
1144
|
-
shouldShowThemeIcon(hasResource, icon) {
|
|
1145
|
-
if (!icon) {
|
|
1146
|
-
return false;
|
|
1147
|
-
}
|
|
1148
|
-
return !(hasResource && this.isFileKindThemeIcon(icon));
|
|
1149
|
-
}
|
|
1150
|
-
isFolderThemeIcon(icon) {
|
|
1151
|
-
return icon?.id === FolderThemeIcon.id;
|
|
1152
|
-
}
|
|
1153
|
-
isFileKindThemeIcon(icon) {
|
|
1154
|
-
if (icon) {
|
|
1155
|
-
return icon.id === FileThemeIcon.id || this.isFolderThemeIcon(icon);
|
|
1156
|
-
}
|
|
1157
|
-
else {
|
|
1158
|
-
return false;
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
getFileKind(node) {
|
|
1162
|
-
if (node.themeIcon) {
|
|
1163
|
-
switch (node.themeIcon.id) {
|
|
1164
|
-
case FileThemeIcon.id:
|
|
1165
|
-
return FileKind.FILE;
|
|
1166
|
-
case FolderThemeIcon.id:
|
|
1167
|
-
return FileKind.FOLDER;
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
return node.collapsibleState === TreeItemCollapsibleState.Collapsed || node.collapsibleState === TreeItemCollapsibleState.Expanded ? FileKind.FOLDER : FileKind.FILE;
|
|
1171
|
-
}
|
|
1172
|
-
updateCheckboxes(items) {
|
|
1173
|
-
const additionalItems = [];
|
|
1174
|
-
if (!this.manuallyManageCheckboxes()) {
|
|
1175
|
-
for (const item of items) {
|
|
1176
|
-
if (item.checkbox !== undefined) {
|
|
1177
|
-
function checkChildren(currentItem) {
|
|
1178
|
-
for (const child of (currentItem.children ?? [])) {
|
|
1179
|
-
if ((child.checkbox !== undefined) && (currentItem.checkbox !== undefined) && (child.checkbox.isChecked !== currentItem.checkbox.isChecked)) {
|
|
1180
|
-
child.checkbox.isChecked = currentItem.checkbox.isChecked;
|
|
1181
|
-
additionalItems.push(child);
|
|
1182
|
-
checkChildren(child);
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
checkChildren(item);
|
|
1187
|
-
const visitedParents = ( new Set());
|
|
1188
|
-
function checkParents(currentItem) {
|
|
1189
|
-
if (currentItem.parent && (currentItem.parent.checkbox !== undefined) && currentItem.parent.children) {
|
|
1190
|
-
if (( visitedParents.has(currentItem.parent))) {
|
|
1191
|
-
return;
|
|
1192
|
-
}
|
|
1193
|
-
else {
|
|
1194
|
-
visitedParents.add(currentItem.parent);
|
|
1195
|
-
}
|
|
1196
|
-
let someUnchecked = false;
|
|
1197
|
-
let someChecked = false;
|
|
1198
|
-
for (const child of currentItem.parent.children) {
|
|
1199
|
-
if (someUnchecked && someChecked) {
|
|
1200
|
-
break;
|
|
1201
|
-
}
|
|
1202
|
-
if (child.checkbox !== undefined) {
|
|
1203
|
-
if (child.checkbox.isChecked) {
|
|
1204
|
-
someChecked = true;
|
|
1205
|
-
}
|
|
1206
|
-
else {
|
|
1207
|
-
someUnchecked = true;
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
if (someChecked && !someUnchecked && (currentItem.parent.checkbox.isChecked !== true)) {
|
|
1212
|
-
currentItem.parent.checkbox.isChecked = true;
|
|
1213
|
-
additionalItems.push(currentItem.parent);
|
|
1214
|
-
checkParents(currentItem.parent);
|
|
1215
|
-
}
|
|
1216
|
-
else if (someUnchecked && (currentItem.parent.checkbox.isChecked !== false)) {
|
|
1217
|
-
currentItem.parent.checkbox.isChecked = false;
|
|
1218
|
-
additionalItems.push(currentItem.parent);
|
|
1219
|
-
checkParents(currentItem.parent);
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
checkParents(item);
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
items = items.concat(additionalItems);
|
|
1228
|
-
items.forEach(item => {
|
|
1229
|
-
const renderedItems = this._renderedElements.get(item.handle);
|
|
1230
|
-
if (renderedItems) {
|
|
1231
|
-
renderedItems.forEach(renderedItems => renderedItems.rendered.checkbox?.render(item));
|
|
1232
|
-
}
|
|
1233
|
-
});
|
|
1234
|
-
this._onDidChangeCheckboxState.fire(items);
|
|
1235
|
-
}
|
|
1236
|
-
disposeElement(resource, index, templateData) {
|
|
1237
|
-
templateData.elementDisposable.clear();
|
|
1238
|
-
const itemRenders = this._renderedElements.get(resource.element.handle) ?? [];
|
|
1239
|
-
const renderedIndex = itemRenders.findIndex(renderedItem => templateData === renderedItem.rendered);
|
|
1240
|
-
if (renderedIndex < 0) {
|
|
1241
|
-
throw new Error('Disposing unknown element');
|
|
1242
|
-
}
|
|
1243
|
-
if (itemRenders.length === 1) {
|
|
1244
|
-
this._renderedElements.delete(resource.element.handle);
|
|
1245
|
-
}
|
|
1246
|
-
else {
|
|
1247
|
-
itemRenders.splice(renderedIndex, 1);
|
|
1248
|
-
}
|
|
1249
|
-
this.treeViewsService.removeRenderedTreeItemElement(resource.element);
|
|
1250
|
-
templateData.checkbox?.dispose();
|
|
1251
|
-
templateData.checkbox = undefined;
|
|
1252
|
-
}
|
|
1253
|
-
disposeTemplate(templateData) {
|
|
1254
|
-
templateData.resourceLabel.dispose();
|
|
1255
|
-
templateData.actionBar.dispose();
|
|
1256
|
-
templateData.elementDisposable.dispose();
|
|
1257
|
-
}
|
|
1258
|
-
};
|
|
1259
|
-
TreeRenderer = TreeRenderer_1 = ( __decorate([
|
|
1260
|
-
( __param(7, IThemeService)),
|
|
1261
|
-
( __param(8, IConfigurationService)),
|
|
1262
|
-
( __param(9, ILabelService)),
|
|
1263
|
-
( __param(10, IHoverService)),
|
|
1264
|
-
( __param(11, ITreeViewsService)),
|
|
1265
|
-
( __param(12, IContextKeyService))
|
|
1266
|
-
], TreeRenderer));
|
|
1267
|
-
class Aligner extends Disposable {
|
|
1268
|
-
constructor(themeService) {
|
|
1269
|
-
super();
|
|
1270
|
-
this.themeService = themeService;
|
|
1271
|
-
}
|
|
1272
|
-
set tree(tree) {
|
|
1273
|
-
this._tree = tree;
|
|
1274
|
-
}
|
|
1275
|
-
alignIconWithTwisty(treeItem) {
|
|
1276
|
-
if (treeItem.collapsibleState !== TreeItemCollapsibleState.None) {
|
|
1277
|
-
return false;
|
|
1278
|
-
}
|
|
1279
|
-
if (!this.hasIcon(treeItem)) {
|
|
1280
|
-
return false;
|
|
1281
|
-
}
|
|
1282
|
-
if (this._tree) {
|
|
1283
|
-
const parent = this._tree.getParentElement(treeItem) || this._tree.getInput();
|
|
1284
|
-
if (this.hasIcon(parent)) {
|
|
1285
|
-
return !!parent.children && ( parent.children.some(
|
|
1286
|
-
c => c.collapsibleState !== TreeItemCollapsibleState.None && !this.hasIcon(c)
|
|
1287
|
-
));
|
|
1288
|
-
}
|
|
1289
|
-
return !!parent.children && parent.children.every(c => c.collapsibleState === TreeItemCollapsibleState.None || !this.hasIcon(c));
|
|
1290
|
-
}
|
|
1291
|
-
else {
|
|
1292
|
-
return false;
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
hasIcon(node) {
|
|
1296
|
-
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
|
|
1297
|
-
if (icon) {
|
|
1298
|
-
return true;
|
|
1299
|
-
}
|
|
1300
|
-
if (node.resourceUri || node.themeIcon) {
|
|
1301
|
-
const fileIconTheme = this.themeService.getFileIconTheme();
|
|
1302
|
-
const isFolder = node.themeIcon ? node.themeIcon.id === FolderThemeIcon.id : node.collapsibleState !== TreeItemCollapsibleState.None;
|
|
1303
|
-
if (isFolder) {
|
|
1304
|
-
return fileIconTheme.hasFileIcons && fileIconTheme.hasFolderIcons;
|
|
1305
|
-
}
|
|
1306
|
-
return fileIconTheme.hasFileIcons;
|
|
1307
|
-
}
|
|
1308
|
-
return false;
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
class MultipleSelectionActionRunner extends ActionRunner {
|
|
1312
|
-
constructor(notificationService, getSelectedResources) {
|
|
1313
|
-
super();
|
|
1314
|
-
this.getSelectedResources = getSelectedResources;
|
|
1315
|
-
this._register(this.onDidRun(e => {
|
|
1316
|
-
if (e.error && !isCancellationError(e.error)) {
|
|
1317
|
-
notificationService.error(( localizeWithPath(
|
|
1318
|
-
'vs/workbench/browser/parts/views/treeView',
|
|
1319
|
-
'command-error',
|
|
1320
|
-
'Error running command {1}: {0}. This is likely caused by the extension that contributes {1}.',
|
|
1321
|
-
e.error.message,
|
|
1322
|
-
e.action.id
|
|
1323
|
-
)));
|
|
1324
|
-
}
|
|
1325
|
-
}));
|
|
1326
|
-
}
|
|
1327
|
-
async runAction(action, context) {
|
|
1328
|
-
const selection = this.getSelectedResources();
|
|
1329
|
-
let selectionHandleArgs = undefined;
|
|
1330
|
-
let actionInSelected = false;
|
|
1331
|
-
if (selection.length > 1) {
|
|
1332
|
-
selectionHandleArgs = ( selection.map(selected => {
|
|
1333
|
-
if ((selected.handle === context.$treeItemHandle) || context.$selectedTreeItems) {
|
|
1334
|
-
actionInSelected = true;
|
|
1335
|
-
}
|
|
1336
|
-
return { $treeViewId: context.$treeViewId, $treeItemHandle: selected.handle };
|
|
1337
|
-
}));
|
|
1338
|
-
}
|
|
1339
|
-
if (!actionInSelected) {
|
|
1340
|
-
selectionHandleArgs = undefined;
|
|
1341
|
-
}
|
|
1342
|
-
await action.run(context, selectionHandleArgs);
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
let TreeMenus = class TreeMenus {
|
|
1346
|
-
constructor(id, menuService) {
|
|
1347
|
-
this.id = id;
|
|
1348
|
-
this.menuService = menuService;
|
|
1349
|
-
this._onDidChange = ( new Emitter());
|
|
1350
|
-
this.onDidChange = this._onDidChange.event;
|
|
1351
|
-
}
|
|
1352
|
-
getResourceActions(element, disposableStore) {
|
|
1353
|
-
const actions = this.getActions(MenuId.ViewItemContext, element, disposableStore);
|
|
1354
|
-
return { menu: actions.menu, actions: actions.primary };
|
|
1355
|
-
}
|
|
1356
|
-
getResourceContextActions(element) {
|
|
1357
|
-
return this.getActions(MenuId.ViewItemContext, element).secondary;
|
|
1358
|
-
}
|
|
1359
|
-
setContextKeyService(service) {
|
|
1360
|
-
this.contextKeyService = service;
|
|
1361
|
-
}
|
|
1362
|
-
getActions(menuId, element, listen) {
|
|
1363
|
-
if (!this.contextKeyService) {
|
|
1364
|
-
return { primary: [], secondary: [] };
|
|
1365
|
-
}
|
|
1366
|
-
const contextKeyService = this.contextKeyService.createOverlay([
|
|
1367
|
-
['view', this.id],
|
|
1368
|
-
['viewItem', element.contextValue]
|
|
1369
|
-
]);
|
|
1370
|
-
const menu = this.menuService.createMenu(menuId, contextKeyService);
|
|
1371
|
-
const primary = [];
|
|
1372
|
-
const secondary = [];
|
|
1373
|
-
const result = { primary, secondary, menu };
|
|
1374
|
-
createAndFillInContextMenuActions(menu, { shouldForwardArgs: true }, result, 'inline');
|
|
1375
|
-
if (listen) {
|
|
1376
|
-
listen.add(menu.onDidChange(() => this._onDidChange.fire(element)));
|
|
1377
|
-
listen.add(menu);
|
|
1378
|
-
}
|
|
1379
|
-
else {
|
|
1380
|
-
menu.dispose();
|
|
1381
|
-
}
|
|
1382
|
-
return result;
|
|
1383
|
-
}
|
|
1384
|
-
dispose() {
|
|
1385
|
-
this.contextKeyService = undefined;
|
|
1386
|
-
}
|
|
1387
|
-
};
|
|
1388
|
-
TreeMenus = ( __decorate([
|
|
1389
|
-
( __param(1, IMenuService))
|
|
1390
|
-
], TreeMenus));
|
|
1391
|
-
let CustomTreeView = class CustomTreeView extends AbstractTreeView {
|
|
1392
|
-
constructor(id, title, extensionId, themeService, instantiationService, commandService, configurationService, progressService, contextMenuService, keybindingService, notificationService, viewDescriptorService, contextKeyService, hoverService, extensionService, activityService, telemetryService, logService) {
|
|
1393
|
-
super(id, title, themeService, instantiationService, commandService, configurationService, progressService, contextMenuService, keybindingService, notificationService, viewDescriptorService, hoverService, contextKeyService, activityService, logService);
|
|
1394
|
-
this.extensionId = extensionId;
|
|
1395
|
-
this.extensionService = extensionService;
|
|
1396
|
-
this.telemetryService = telemetryService;
|
|
1397
|
-
this.activated = false;
|
|
1398
|
-
}
|
|
1399
|
-
activate() {
|
|
1400
|
-
if (!this.activated) {
|
|
1401
|
-
this.telemetryService.publicLog2('Extension:ViewActivate', {
|
|
1402
|
-
extensionId: ( new TelemetryTrustedValue(this.extensionId)),
|
|
1403
|
-
id: this.id,
|
|
1404
|
-
});
|
|
1405
|
-
this.createTree();
|
|
1406
|
-
this.progressService.withProgress({ location: this.id }, () => this.extensionService.activateByEvent(`onView:${this.id}`))
|
|
1407
|
-
.then(() => timeout(2000))
|
|
1408
|
-
.then(() => {
|
|
1409
|
-
this.updateMessage();
|
|
1410
|
-
});
|
|
1411
|
-
this.activated = true;
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
};
|
|
1415
|
-
CustomTreeView = ( __decorate([
|
|
1416
|
-
( __param(3, IThemeService)),
|
|
1417
|
-
( __param(4, IInstantiationService)),
|
|
1418
|
-
( __param(5, ICommandService)),
|
|
1419
|
-
( __param(6, IConfigurationService)),
|
|
1420
|
-
( __param(7, IProgressService)),
|
|
1421
|
-
( __param(8, IContextMenuService)),
|
|
1422
|
-
( __param(9, IKeybindingService)),
|
|
1423
|
-
( __param(10, INotificationService)),
|
|
1424
|
-
( __param(11, IViewDescriptorService)),
|
|
1425
|
-
( __param(12, IContextKeyService)),
|
|
1426
|
-
( __param(13, IHoverService)),
|
|
1427
|
-
( __param(14, IExtensionService)),
|
|
1428
|
-
( __param(15, IActivityService)),
|
|
1429
|
-
( __param(16, ITelemetryService)),
|
|
1430
|
-
( __param(17, ILogService))
|
|
1431
|
-
], CustomTreeView));
|
|
1432
|
-
let CustomTreeViewDragAndDrop = class CustomTreeViewDragAndDrop {
|
|
1433
|
-
constructor(treeId, labelService, instantiationService, treeViewsDragAndDropService, logService) {
|
|
1434
|
-
this.treeId = treeId;
|
|
1435
|
-
this.labelService = labelService;
|
|
1436
|
-
this.instantiationService = instantiationService;
|
|
1437
|
-
this.treeViewsDragAndDropService = treeViewsDragAndDropService;
|
|
1438
|
-
this.logService = logService;
|
|
1439
|
-
this.treeItemsTransfer = LocalSelectionTransfer.getInstance();
|
|
1440
|
-
this.treeMimeType = `application/vnd.code.tree.${treeId.toLowerCase()}`;
|
|
1441
|
-
}
|
|
1442
|
-
set controller(controller) {
|
|
1443
|
-
this.dndController = controller;
|
|
1444
|
-
}
|
|
1445
|
-
handleDragAndLog(dndController, itemHandles, uuid, dragCancellationToken) {
|
|
1446
|
-
return dndController.handleDrag(itemHandles, uuid, dragCancellationToken).then(additionalDataTransfer => {
|
|
1447
|
-
if (additionalDataTransfer) {
|
|
1448
|
-
const unlistedTypes = [];
|
|
1449
|
-
for (const item of additionalDataTransfer) {
|
|
1450
|
-
if ((item[0] !== this.treeMimeType) && (dndController.dragMimeTypes.findIndex(value => value === item[0]) < 0)) {
|
|
1451
|
-
unlistedTypes.push(item[0]);
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
if (unlistedTypes.length) {
|
|
1455
|
-
this.logService.warn(`Drag and drop controller for tree ${this.treeId} adds the following data transfer types but does not declare them in dragMimeTypes: ${unlistedTypes.join(', ')}`);
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
return additionalDataTransfer;
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
addExtensionProvidedTransferTypes(originalEvent, itemHandles) {
|
|
1462
|
-
if (!originalEvent.dataTransfer || !this.dndController) {
|
|
1463
|
-
return;
|
|
1464
|
-
}
|
|
1465
|
-
const uuid = generateUuid();
|
|
1466
|
-
this.dragCancellationToken = ( new CancellationTokenSource());
|
|
1467
|
-
this.treeViewsDragAndDropService.addDragOperationTransfer(uuid, this.handleDragAndLog(this.dndController, itemHandles, uuid, this.dragCancellationToken.token));
|
|
1468
|
-
this.treeItemsTransfer.setData([( new DraggedTreeItemsIdentifier(uuid))], DraggedTreeItemsIdentifier.prototype);
|
|
1469
|
-
originalEvent.dataTransfer.clearData(Mimes.text);
|
|
1470
|
-
if (this.dndController.dragMimeTypes.find((element) => element === Mimes.uriList)) {
|
|
1471
|
-
originalEvent.dataTransfer?.setData(DataTransfers.RESOURCES, '');
|
|
1472
|
-
}
|
|
1473
|
-
this.dndController.dragMimeTypes.forEach(supportedType => {
|
|
1474
|
-
originalEvent.dataTransfer?.setData(supportedType, '');
|
|
1475
|
-
});
|
|
1476
|
-
}
|
|
1477
|
-
addResourceInfoToTransfer(originalEvent, resources) {
|
|
1478
|
-
if (resources.length && originalEvent.dataTransfer) {
|
|
1479
|
-
this.instantiationService.invokeFunction(accessor => fillEditorsDragData(accessor, resources, originalEvent));
|
|
1480
|
-
const fileResources = ( resources.filter(s => s.scheme === Schemas.file).map(r => r.fsPath));
|
|
1481
|
-
if (fileResources.length) {
|
|
1482
|
-
originalEvent.dataTransfer.setData(CodeDataTransfers.FILES, JSON.stringify(fileResources));
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
onDragStart(data, originalEvent) {
|
|
1487
|
-
if (originalEvent.dataTransfer) {
|
|
1488
|
-
const treeItemsData = data.getData();
|
|
1489
|
-
const resources = [];
|
|
1490
|
-
const sourceInfo = {
|
|
1491
|
-
id: this.treeId,
|
|
1492
|
-
itemHandles: []
|
|
1493
|
-
};
|
|
1494
|
-
treeItemsData.forEach(item => {
|
|
1495
|
-
sourceInfo.itemHandles.push(item.handle);
|
|
1496
|
-
if (item.resourceUri) {
|
|
1497
|
-
resources.push(URI.revive(item.resourceUri));
|
|
1498
|
-
}
|
|
1499
|
-
});
|
|
1500
|
-
this.addResourceInfoToTransfer(originalEvent, resources);
|
|
1501
|
-
this.addExtensionProvidedTransferTypes(originalEvent, sourceInfo.itemHandles);
|
|
1502
|
-
originalEvent.dataTransfer.setData(this.treeMimeType, JSON.stringify(sourceInfo));
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
debugLog(types) {
|
|
1506
|
-
if (types.size) {
|
|
1507
|
-
this.logService.debug(`TreeView dragged mime types: ${Array.from(types).join(', ')}`);
|
|
1508
|
-
}
|
|
1509
|
-
else {
|
|
1510
|
-
this.logService.debug(`TreeView dragged with no supported mime types.`);
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
onDragOver(data, targetElement, targetIndex, originalEvent) {
|
|
1514
|
-
const dataTransfer = toExternalVSDataTransfer(originalEvent.dataTransfer);
|
|
1515
|
-
const types = ( new Set(Array.from(dataTransfer, x => x[0])));
|
|
1516
|
-
if (originalEvent.dataTransfer) {
|
|
1517
|
-
for (const item of originalEvent.dataTransfer.items) {
|
|
1518
|
-
if (item.kind === 'file' || item.type === DataTransfers.RESOURCES.toLowerCase()) {
|
|
1519
|
-
types.add(Mimes.uriList);
|
|
1520
|
-
break;
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
this.debugLog(types);
|
|
1525
|
-
const dndController = this.dndController;
|
|
1526
|
-
if (!dndController || !originalEvent.dataTransfer || (dndController.dropMimeTypes.length === 0)) {
|
|
1527
|
-
return false;
|
|
1528
|
-
}
|
|
1529
|
-
const dragContainersSupportedType = ( Array.from(types).some((value, index) => {
|
|
1530
|
-
if (value === this.treeMimeType) {
|
|
1531
|
-
return true;
|
|
1532
|
-
}
|
|
1533
|
-
else {
|
|
1534
|
-
return dndController.dropMimeTypes.indexOf(value) >= 0;
|
|
1535
|
-
}
|
|
1536
|
-
}));
|
|
1537
|
-
if (dragContainersSupportedType) {
|
|
1538
|
-
return { accept: true, bubble: 0 , autoExpand: true };
|
|
1539
|
-
}
|
|
1540
|
-
return false;
|
|
1541
|
-
}
|
|
1542
|
-
getDragURI(element) {
|
|
1543
|
-
if (!this.dndController) {
|
|
1544
|
-
return null;
|
|
1545
|
-
}
|
|
1546
|
-
return element.resourceUri ? ( URI.revive(element.resourceUri).toString()) : element.handle;
|
|
1547
|
-
}
|
|
1548
|
-
getDragLabel(elements) {
|
|
1549
|
-
if (!this.dndController) {
|
|
1550
|
-
return undefined;
|
|
1551
|
-
}
|
|
1552
|
-
if (elements.length > 1) {
|
|
1553
|
-
return String(elements.length);
|
|
1554
|
-
}
|
|
1555
|
-
const element = elements[0];
|
|
1556
|
-
return element.label ? element.label.label : (element.resourceUri ? this.labelService.getUriLabel(URI.revive(element.resourceUri)) : undefined);
|
|
1557
|
-
}
|
|
1558
|
-
async drop(data, targetNode, targetIndex, originalEvent) {
|
|
1559
|
-
const dndController = this.dndController;
|
|
1560
|
-
if (!originalEvent.dataTransfer || !dndController) {
|
|
1561
|
-
return;
|
|
1562
|
-
}
|
|
1563
|
-
let treeSourceInfo;
|
|
1564
|
-
let willDropUuid;
|
|
1565
|
-
if (this.treeItemsTransfer.hasData(DraggedTreeItemsIdentifier.prototype)) {
|
|
1566
|
-
willDropUuid = this.treeItemsTransfer.getData(DraggedTreeItemsIdentifier.prototype)[0].identifier;
|
|
1567
|
-
}
|
|
1568
|
-
const originalDataTransfer = toExternalVSDataTransfer(originalEvent.dataTransfer, true);
|
|
1569
|
-
const outDataTransfer = ( new VSDataTransfer());
|
|
1570
|
-
for (const [type, item] of originalDataTransfer) {
|
|
1571
|
-
if (type === this.treeMimeType || dndController.dropMimeTypes.includes(type) || (item.asFile() && dndController.dropMimeTypes.includes(DataTransfers.FILES.toLowerCase()))) {
|
|
1572
|
-
outDataTransfer.append(type, item);
|
|
1573
|
-
if (type === this.treeMimeType) {
|
|
1574
|
-
try {
|
|
1575
|
-
treeSourceInfo = JSON.parse(await item.asString());
|
|
1576
|
-
}
|
|
1577
|
-
catch {
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
const additionalDataTransfer = await this.treeViewsDragAndDropService.removeDragOperationTransfer(willDropUuid);
|
|
1583
|
-
if (additionalDataTransfer) {
|
|
1584
|
-
for (const [type, item] of additionalDataTransfer) {
|
|
1585
|
-
outDataTransfer.append(type, item);
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
return dndController.handleDrop(outDataTransfer, targetNode, CancellationToken.None, willDropUuid, treeSourceInfo?.id, treeSourceInfo?.itemHandles);
|
|
1589
|
-
}
|
|
1590
|
-
onDragEnd(originalEvent) {
|
|
1591
|
-
if (originalEvent.dataTransfer?.dropEffect === 'none') {
|
|
1592
|
-
this.dragCancellationToken?.cancel();
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
dispose() { }
|
|
1596
|
-
};
|
|
1597
|
-
CustomTreeViewDragAndDrop = ( __decorate([
|
|
1598
|
-
( __param(1, ILabelService)),
|
|
1599
|
-
( __param(2, IInstantiationService)),
|
|
1600
|
-
( __param(3, ITreeViewsDnDService)),
|
|
1601
|
-
( __param(4, ILogService))
|
|
1602
|
-
], CustomTreeViewDragAndDrop));
|
|
1603
|
-
|
|
1604
|
-
export { CustomTreeView, CustomTreeViewDragAndDrop, RawCustomTreeViewContextKey, TreeViewPane };
|