@codingame/monaco-vscode-user-data-profile-service-override 7.1.0 → 7.1.1
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 +2 -2
- package/vscode/src/vs/base/browser/ui/radio/radio.css.js +6 -0
- package/vscode/src/vs/base/browser/ui/radio/radio.js +69 -0
- package/vscode/src/vs/platform/userDataSync/common/keybindingsSync.js +5 -8
- package/vscode/src/vs/platform/userDataSync/common/settingsSync.js +28 -11
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +96 -60
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +13 -15
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +744 -349
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +114 -70
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +7 -9
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +2 -3
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +2 -3
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +2 -3
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +4 -6
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +2 -3
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +93 -130
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +12 -16
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import './media/userDataProfilesEditor.css.js';
|
|
3
|
-
import { append, $, Dimension, trackFocus, addDisposableListener, EventType, EventHelper } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
+
import { append, $, Dimension, trackFocus, addDisposableListener, EventType, EventHelper, clearNode } from 'vscode/vscode/vs/base/browser/dom';
|
|
4
4
|
import { SubmenuAction, Separator, Action } from 'vscode/vscode/vs/base/common/actions';
|
|
5
|
-
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
5
|
+
import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
6
6
|
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
7
|
-
import {
|
|
7
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
8
8
|
import { IContextMenuService, IContextViewService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
|
|
9
9
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
10
10
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
@@ -15,14 +15,13 @@ import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProf
|
|
|
15
15
|
import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
16
16
|
import { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
|
|
17
17
|
import { PROFILE_FILTER, defaultUserDataProfileIcon } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
|
|
18
|
-
import { IUserDataProfileManagementService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
19
18
|
import { SplitView, Sizing } from 'vscode/vscode/vs/base/browser/ui/splitview/splitview';
|
|
20
19
|
import { ButtonWithDropdown, Button } from 'vscode/vscode/vs/base/browser/ui/button/button';
|
|
21
|
-
import { defaultButtonStyles,
|
|
20
|
+
import { getListStyles, defaultButtonStyles, getInputBoxStyle, defaultInputBoxStyles, defaultCheckboxStyles, defaultSelectBoxStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
22
21
|
import { registerColor } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
23
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
22
|
+
import { foreground } from 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
24
23
|
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
25
|
-
import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
24
|
+
import { editorBackground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
26
25
|
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
27
26
|
import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
28
27
|
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
@@ -32,7 +31,8 @@ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
|
32
31
|
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
33
32
|
import { PANEL_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
|
|
34
33
|
import { WorkbenchList, WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
35
|
-
import {
|
|
34
|
+
import { CachedListVirtualDelegate } from 'vscode/vscode/vs/base/browser/ui/list/list';
|
|
35
|
+
import { DisposableStore, Disposable, MutableDisposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
36
36
|
import { InputBox, MessageType } from 'vscode/vscode/vs/base/browser/ui/inputbox/inputBox';
|
|
37
37
|
import { Checkbox } from 'vscode/vscode/vs/base/browser/ui/toggle/toggle';
|
|
38
38
|
import { DEFAULT_ICON, ICONS } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfileIcons';
|
|
@@ -45,32 +45,52 @@ import { HoverPosition } from 'vscode/vscode/vs/base/browser/ui/hover/hoverWidge
|
|
|
45
45
|
import { SelectBox } from 'vscode/vscode/vs/base/browser/ui/selectBox/selectBox';
|
|
46
46
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
47
47
|
import { IEditorProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
|
|
48
|
-
import { isUndefined } from 'vscode/vscode/vs/base/common/types';
|
|
48
|
+
import { isUndefined, isString } from 'vscode/vscode/vs/base/common/types';
|
|
49
49
|
import { basename } from 'vscode/vscode/vs/base/common/resources';
|
|
50
50
|
import { RenderIndentGuides } from 'vscode/vscode/vs/base/browser/ui/tree/abstractTree';
|
|
51
51
|
import { ResourceLabels, DEFAULT_LABELS_CONTAINER } from 'vscode/vscode/vs/workbench/browser/labels';
|
|
52
52
|
import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
53
53
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
54
54
|
import { UserDataProfileElement, AbstractUserDataProfileElement, NewProfileElement, isProfileResourceTypeElement, isProfileResourceChildElement, UserDataProfilesEditorModel } from './userDataProfilesEditorModel.js';
|
|
55
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
56
55
|
import { WorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
|
|
57
56
|
import { createInstantHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
57
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
58
|
+
import { Radio } from '../../../../base/browser/ui/radio/radio.js';
|
|
59
|
+
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
60
|
+
import { settingsTextInputBorder } from 'vscode/vscode/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry';
|
|
61
|
+
import { renderMarkdown } from 'vscode/vscode/vs/base/browser/markdownRenderer';
|
|
62
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
58
63
|
import { Orientation } from 'vscode/vscode/vs/base/browser/ui/sash/sash';
|
|
59
64
|
|
|
60
65
|
var UserDataProfilesEditor_1, ExistingProfileResourceTreeRenderer_1, NewProfileResourceTreeRenderer_1, ProfileResourceChildTreeItemRenderer_1, UserDataProfilesEditorInput_1;
|
|
61
|
-
const
|
|
62
|
-
const
|
|
66
|
+
const profilesSashBorder = registerColor('profiles.sashBorder', PANEL_BORDER, ( localize(10920, "The color of the Profiles editor splitview sash border.")));
|
|
67
|
+
const listStyles = getListStyles({
|
|
68
|
+
listActiveSelectionBackground: editorBackground,
|
|
69
|
+
listActiveSelectionForeground: foreground,
|
|
70
|
+
listFocusAndSelectionBackground: editorBackground,
|
|
71
|
+
listFocusAndSelectionForeground: foreground,
|
|
72
|
+
listFocusBackground: editorBackground,
|
|
73
|
+
listFocusForeground: foreground,
|
|
74
|
+
listHoverForeground: foreground,
|
|
75
|
+
listHoverBackground: editorBackground,
|
|
76
|
+
listHoverOutline: editorBackground,
|
|
77
|
+
listFocusOutline: editorBackground,
|
|
78
|
+
listInactiveSelectionBackground: editorBackground,
|
|
79
|
+
listInactiveSelectionForeground: foreground,
|
|
80
|
+
listInactiveFocusBackground: editorBackground,
|
|
81
|
+
listInactiveFocusOutline: editorBackground,
|
|
82
|
+
treeIndentGuidesStroke: undefined,
|
|
83
|
+
treeInactiveIndentGuidesStroke: undefined,
|
|
84
|
+
});
|
|
63
85
|
let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
64
86
|
static { UserDataProfilesEditor_1 = this; }
|
|
65
87
|
static { this.ID = 'workbench.editor.userDataProfiles'; }
|
|
66
|
-
constructor(group, telemetryService, themeService, storageService,
|
|
88
|
+
constructor(group, telemetryService, themeService, storageService, quickInputService, fileDialogService, contextMenuService, instantiationService) {
|
|
67
89
|
super(UserDataProfilesEditor_1.ID, group, telemetryService, themeService, storageService);
|
|
68
|
-
this.userDataProfileManagementService = userDataProfileManagementService;
|
|
69
90
|
this.quickInputService = quickInputService;
|
|
70
91
|
this.fileDialogService = fileDialogService;
|
|
71
92
|
this.contextMenuService = contextMenuService;
|
|
72
93
|
this.instantiationService = instantiationService;
|
|
73
|
-
this.templates = [];
|
|
74
94
|
}
|
|
75
95
|
layout(dimension, position) {
|
|
76
96
|
if (this.container && this.splitView) {
|
|
@@ -119,10 +139,6 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
119
139
|
}, Sizing.Distribute, undefined, true);
|
|
120
140
|
this.registerListeners();
|
|
121
141
|
this.updateStyles();
|
|
122
|
-
this.userDataProfileManagementService.getBuiltinProfileTemplates().then(templates => {
|
|
123
|
-
this.templates = templates;
|
|
124
|
-
this.profileWidget.templates = templates;
|
|
125
|
-
});
|
|
126
142
|
}
|
|
127
143
|
updateStyles() {
|
|
128
144
|
const borderColor = this.theme.getColor(profilesSashBorder);
|
|
@@ -141,7 +157,7 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
141
157
|
return profileElement?.name ?? '';
|
|
142
158
|
},
|
|
143
159
|
getWidgetAriaLabel() {
|
|
144
|
-
return (
|
|
160
|
+
return ( localize(10921, "Profiles"));
|
|
145
161
|
}
|
|
146
162
|
},
|
|
147
163
|
openOnSingleClick: true,
|
|
@@ -152,7 +168,8 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
152
168
|
}
|
|
153
169
|
return e.name;
|
|
154
170
|
}
|
|
155
|
-
}
|
|
171
|
+
},
|
|
172
|
+
alwaysConsumeMouseWheel: false,
|
|
156
173
|
}));
|
|
157
174
|
}
|
|
158
175
|
renderNewProfileButton(parent) {
|
|
@@ -160,11 +177,11 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
160
177
|
actions: {
|
|
161
178
|
getActions: () => {
|
|
162
179
|
const actions = [];
|
|
163
|
-
if (this.templates.length) {
|
|
164
|
-
actions.push(( (new SubmenuAction('from.template', (
|
|
180
|
+
if (this.model?.templates.length) {
|
|
181
|
+
actions.push(( (new SubmenuAction('from.template', ( localize(10922, "From Template")), this.getCreateFromTemplateActions()))));
|
|
165
182
|
actions.push(( (new Separator())));
|
|
166
183
|
}
|
|
167
|
-
actions.push(( (new Action('importProfile', (
|
|
184
|
+
actions.push(( (new Action('importProfile', ( localize(10923, "Import Profile...")), undefined, true, () => this.importProfile()))));
|
|
168
185
|
return actions;
|
|
169
186
|
}
|
|
170
187
|
},
|
|
@@ -173,17 +190,19 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
173
190
|
supportIcons: true,
|
|
174
191
|
...defaultButtonStyles
|
|
175
192
|
}))));
|
|
176
|
-
button.label = (
|
|
193
|
+
button.label = ( localize(10924, "New Profile"));
|
|
177
194
|
this._register(button.onDidClick(e => this.createNewProfile()));
|
|
178
195
|
}
|
|
179
196
|
getCreateFromTemplateActions() {
|
|
180
|
-
return
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
197
|
+
return this.model
|
|
198
|
+
? ( (this.model.templates.map(template => ( (new Action(
|
|
199
|
+
`template:${template.url}`,
|
|
200
|
+
template.name,
|
|
201
|
+
undefined,
|
|
202
|
+
true,
|
|
203
|
+
() => this.createNewProfile(( (URI.parse(template.url))))
|
|
204
|
+
))))))
|
|
205
|
+
: [];
|
|
187
206
|
}
|
|
188
207
|
registerListeners() {
|
|
189
208
|
if (this.profilesList) {
|
|
@@ -218,13 +237,13 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
218
237
|
}
|
|
219
238
|
getTreeContextMenuActions() {
|
|
220
239
|
const actions = [];
|
|
221
|
-
actions.push(( (new Action('newProfile', (
|
|
240
|
+
actions.push(( (new Action('newProfile', ( localize(10924, "New Profile")), undefined, true, () => this.createNewProfile()))));
|
|
222
241
|
const templateActions = this.getCreateFromTemplateActions();
|
|
223
242
|
if (templateActions.length) {
|
|
224
|
-
actions.push(( (new SubmenuAction('from.template', (
|
|
243
|
+
actions.push(( (new SubmenuAction('from.template', ( localize(10925, "New Profile From Template")), templateActions))));
|
|
225
244
|
}
|
|
226
245
|
actions.push(( (new Separator())));
|
|
227
|
-
actions.push(( (new Action('importProfile', (
|
|
246
|
+
actions.push(( (new Action('importProfile', ( localize(10925, "Import Profile...")), undefined, true, () => this.importProfile()))));
|
|
228
247
|
return actions;
|
|
229
248
|
}
|
|
230
249
|
async importProfile() {
|
|
@@ -233,13 +252,13 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
233
252
|
const updateQuickPickItems = (value) => {
|
|
234
253
|
const quickPickItems = [];
|
|
235
254
|
if (value) {
|
|
236
|
-
quickPickItems.push({ label: quickPick.value, description: (
|
|
255
|
+
quickPickItems.push({ label: quickPick.value, description: ( localize(10926, "Import from URL")) });
|
|
237
256
|
}
|
|
238
|
-
quickPickItems.push({ label: (
|
|
257
|
+
quickPickItems.push({ label: ( localize(10927, "Select File...")) });
|
|
239
258
|
quickPick.items = quickPickItems;
|
|
240
259
|
};
|
|
241
|
-
quickPick.title = (
|
|
242
|
-
quickPick.placeholder = (
|
|
260
|
+
quickPick.title = ( localize(10928, "Import from Profile Template..."));
|
|
261
|
+
quickPick.placeholder = ( localize(10929, "Provide Profile Template URL"));
|
|
243
262
|
quickPick.ignoreFocusOut = true;
|
|
244
263
|
disposables.add(quickPick.onDidChangeValue(updateQuickPickItems));
|
|
245
264
|
updateQuickPickItems();
|
|
@@ -268,7 +287,7 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
268
287
|
canSelectFiles: true,
|
|
269
288
|
canSelectMany: false,
|
|
270
289
|
filters: PROFILE_FILTER,
|
|
271
|
-
title: (
|
|
290
|
+
title: ( localize(10930, "Select Profile Template File")),
|
|
272
291
|
});
|
|
273
292
|
if (!profileLocation) {
|
|
274
293
|
return null;
|
|
@@ -278,10 +297,11 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
278
297
|
async setInput(input, options, context, token) {
|
|
279
298
|
await super.setInput(input, options, context, token);
|
|
280
299
|
this.model = await input.resolve();
|
|
300
|
+
if (this.profileWidget) {
|
|
301
|
+
this.profileWidget.templates = this.model.templates;
|
|
302
|
+
}
|
|
281
303
|
this.updateProfilesList();
|
|
282
|
-
this._register(this.model.onDidChange(
|
|
283
|
-
this.updateProfilesList(element);
|
|
284
|
-
}));
|
|
304
|
+
this._register(this.model.onDidChange(element => this.updateProfilesList(element)));
|
|
285
305
|
}
|
|
286
306
|
focus() {
|
|
287
307
|
super.focus();
|
|
@@ -317,11 +337,10 @@ UserDataProfilesEditor = UserDataProfilesEditor_1 = ( (__decorate([
|
|
|
317
337
|
( (__param(1, ITelemetryService))),
|
|
318
338
|
( (__param(2, IThemeService))),
|
|
319
339
|
( (__param(3, IStorageService))),
|
|
320
|
-
( (__param(4,
|
|
321
|
-
( (__param(5,
|
|
322
|
-
( (__param(6,
|
|
323
|
-
( (__param(7,
|
|
324
|
-
( (__param(8, IInstantiationService)))
|
|
340
|
+
( (__param(4, IQuickInputService))),
|
|
341
|
+
( (__param(5, IFileDialogService))),
|
|
342
|
+
( (__param(6, IContextMenuService))),
|
|
343
|
+
( (__param(7, IInstantiationService)))
|
|
325
344
|
], UserDataProfilesEditor)));
|
|
326
345
|
class ProfileElementDelegate {
|
|
327
346
|
getHeight(element) {
|
|
@@ -340,21 +359,22 @@ let ProfileElementRenderer = class ProfileElementRenderer {
|
|
|
340
359
|
container.classList.add('profile-list-item');
|
|
341
360
|
const icon = append(container, $('.profile-list-item-icon'));
|
|
342
361
|
const label = append(container, $('.profile-list-item-label'));
|
|
362
|
+
const dirty = append(container, $(`span${ThemeIcon.asCSSSelector(Codicon.circleFilled)}`));
|
|
343
363
|
const description = append(container, $('.profile-list-item-description'));
|
|
344
|
-
append(description, $(
|
|
345
|
-
append(description, $('span', undefined, ( localizeWithPath(_moduleId, 11, "In use"))));
|
|
364
|
+
append(description, $('span', undefined, ( localize(10931, "In use"))));
|
|
346
365
|
const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
|
|
347
366
|
const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
|
|
348
367
|
hoverDelegate: disposables.add(createInstantHoverDelegate()),
|
|
349
368
|
highlightToggledItems: true
|
|
350
369
|
}));
|
|
351
|
-
return { label, icon, description, actionBar, disposables, elementDisposables };
|
|
370
|
+
return { label, icon, dirty, description, actionBar, disposables, elementDisposables };
|
|
352
371
|
}
|
|
353
372
|
renderElement(element, index, templateData, height) {
|
|
354
373
|
templateData.elementDisposables.clear();
|
|
355
374
|
templateData.label.textContent = element.name;
|
|
356
375
|
templateData.label.classList.toggle('new-profile', element instanceof NewProfileElement);
|
|
357
376
|
templateData.icon.className = ThemeIcon.asClassName(element.icon ? ThemeIcon.fromId(element.icon) : DEFAULT_ICON);
|
|
377
|
+
templateData.dirty.classList.toggle('hide', !(element instanceof NewProfileElement));
|
|
358
378
|
templateData.description.classList.toggle('hide', !element.active);
|
|
359
379
|
if (element.onDidChange) {
|
|
360
380
|
templateData.elementDisposables.add(element.onDidChange(e => {
|
|
@@ -374,7 +394,7 @@ let ProfileElementRenderer = class ProfileElementRenderer {
|
|
|
374
394
|
}
|
|
375
395
|
}));
|
|
376
396
|
}
|
|
377
|
-
templateData.actionBar.setActions(element.actions[0]
|
|
397
|
+
templateData.actionBar.setActions([...element.actions[0]], [...element.actions[1]]);
|
|
378
398
|
}
|
|
379
399
|
disposeElement(element, index, templateData, height) {
|
|
380
400
|
templateData.elementDisposables.clear();
|
|
@@ -389,111 +409,34 @@ ProfileElementRenderer = ( (__decorate([
|
|
|
389
409
|
], ProfileElementRenderer)));
|
|
390
410
|
let ProfileWidget = class ProfileWidget extends Disposable {
|
|
391
411
|
set templates(templates) {
|
|
392
|
-
this.
|
|
393
|
-
this.
|
|
412
|
+
this.copyFromProfileRenderer.setTemplates(templates);
|
|
413
|
+
this.profileTree.rerender();
|
|
394
414
|
}
|
|
395
|
-
constructor(parent,
|
|
415
|
+
constructor(parent, editorProgressService, instantiationService) {
|
|
396
416
|
super();
|
|
397
|
-
this.hoverService = hoverService;
|
|
398
|
-
this.userDataProfilesService = userDataProfilesService;
|
|
399
|
-
this.contextViewService = contextViewService;
|
|
400
417
|
this.editorProgressService = editorProgressService;
|
|
401
418
|
this.instantiationService = instantiationService;
|
|
402
|
-
this.copyFromOptions = [];
|
|
403
|
-
this._templates = [];
|
|
404
419
|
this._profileElement = this._register(( (new MutableDisposable())));
|
|
405
420
|
const header = append(parent, $('.profile-header'));
|
|
406
421
|
const title = append(header, $('.profile-title-container'));
|
|
407
|
-
this.iconElement = append(title, $(`${ThemeIcon.asCSSSelector(DEFAULT_ICON)}`, { 'tabindex': '0', 'role': 'button', 'aria-label': ( localizeWithPath(_moduleId, 12, "Profile Icon")) }));
|
|
408
|
-
this.renderIconSelectBox(this.iconElement);
|
|
409
422
|
this.profileTitle = append(title, $(''));
|
|
410
|
-
this.nameInput = this._register(( (new InputBox(title, undefined, {
|
|
411
|
-
inputBoxStyles: defaultInputBoxStyles,
|
|
412
|
-
ariaLabel: ( localizeWithPath(_moduleId, 13, "Profile Name")),
|
|
413
|
-
placeholder: ( localizeWithPath(_moduleId, 13, "Profile Name")),
|
|
414
|
-
validationOptions: {
|
|
415
|
-
validation: (value) => {
|
|
416
|
-
if (!value) {
|
|
417
|
-
return {
|
|
418
|
-
content: ( localizeWithPath(_moduleId, 14, "Profile name is required and must be a non-empty value.")),
|
|
419
|
-
type: MessageType.ERROR
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
if (this._profileElement.value?.element.disabled) {
|
|
423
|
-
return null;
|
|
424
|
-
}
|
|
425
|
-
const initialName = this._profileElement.value?.element.getInitialName();
|
|
426
|
-
value = value.trim();
|
|
427
|
-
if (initialName !== value && ( (this.userDataProfilesService.profiles.some(p => p.name === value)))) {
|
|
428
|
-
return {
|
|
429
|
-
content: ( localizeWithPath(_moduleId, 15, "Profile with name {0} already exists.", value)),
|
|
430
|
-
type: MessageType.ERROR
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
return null;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}))));
|
|
437
|
-
this.nameInput.onDidChange(value => {
|
|
438
|
-
if (this._profileElement.value && value) {
|
|
439
|
-
this._profileElement.value.element.name = value;
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
const focusTracker = this._register(trackFocus(this.nameInput.inputElement));
|
|
443
|
-
this._register(focusTracker.onDidBlur(() => {
|
|
444
|
-
if (this._profileElement.value && !this.nameInput.value) {
|
|
445
|
-
this.nameInput.value = this._profileElement.value.element.name;
|
|
446
|
-
}
|
|
447
|
-
}));
|
|
448
|
-
const actionsContainer = append(header, $('.profile-actions-container'));
|
|
449
|
-
this.buttonContainer = append(actionsContainer, $('.profile-button-container'));
|
|
450
|
-
this.toolbar = this._register(instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
|
|
451
|
-
hoverDelegate: this._register(createInstantHoverDelegate()),
|
|
452
|
-
highlightToggledItems: true
|
|
453
|
-
}));
|
|
454
423
|
const body = append(parent, $('.profile-body'));
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
this.
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
const useAsDefaultProfileLabel = append(this.useAsDefaultProfileContainer, $('.profile-use-as-default-label', undefined, useAsDefaultProfileTitle));
|
|
467
|
-
this._register(this.useAsDefaultProfileCheckbox.onChange(() => {
|
|
468
|
-
if (this._profileElement.value?.element instanceof UserDataProfileElement) {
|
|
469
|
-
this._profileElement.value.element.toggleNewWindowProfile();
|
|
470
|
-
}
|
|
471
|
-
}));
|
|
472
|
-
this._register(addDisposableListener(useAsDefaultProfileLabel, EventType.CLICK, () => {
|
|
473
|
-
if (this._profileElement.value?.element instanceof UserDataProfileElement) {
|
|
474
|
-
this._profileElement.value.element.toggleNewWindowProfile();
|
|
475
|
-
}
|
|
476
|
-
}));
|
|
477
|
-
this.contentsTreeHeader = append(body, $('.profile-content-tree-header'));
|
|
478
|
-
this.inheritLabelElement = $('.inherit-label', undefined, ( localizeWithPath(_moduleId, 19, "Use Default Profile")));
|
|
479
|
-
append(this.contentsTreeHeader, $(''), $(''), this.inheritLabelElement, $('.actions-label', undefined, ( localizeWithPath(_moduleId, 20, "Actions"))));
|
|
480
|
-
const delegate = ( (new ProfileResourceTreeElementDelegate()));
|
|
481
|
-
this.resourcesTree = this._register(this.instantiationService.createInstance((WorkbenchAsyncDataTree), 'ProfileEditor-ResourcesTree', append(body, $('.profile-content-tree.file-icon-themable-tree.show-file-icons')), delegate, [
|
|
482
|
-
this.instantiationService.createInstance(ExistingProfileResourceTreeRenderer),
|
|
483
|
-
this.instantiationService.createInstance(NewProfileResourceTreeRenderer),
|
|
484
|
-
this.instantiationService.createInstance(ProfileResourceChildTreeItemRenderer),
|
|
485
|
-
], this.instantiationService.createInstance(ProfileResourceTreeDataSource), {
|
|
424
|
+
const delegate = ( (new ProfileTreeDelegate()));
|
|
425
|
+
const contentsRenderer = this._register(this.instantiationService.createInstance(ContentsProfileRenderer));
|
|
426
|
+
this.copyFromProfileRenderer = this._register(this.instantiationService.createInstance(CopyFromProfileRenderer));
|
|
427
|
+
this.profileTreeContainer = append(body, $('.profile-tree'));
|
|
428
|
+
this.profileTree = this._register(this.instantiationService.createInstance((WorkbenchAsyncDataTree), 'ProfileEditor-Tree', this.profileTreeContainer, delegate, [
|
|
429
|
+
this._register(this.instantiationService.createInstance(ProfileNameRenderer)),
|
|
430
|
+
this._register(this.instantiationService.createInstance(ProfileIconRenderer)),
|
|
431
|
+
this._register(this.instantiationService.createInstance(UseAsDefaultProfileRenderer)),
|
|
432
|
+
this.copyFromProfileRenderer,
|
|
433
|
+
contentsRenderer,
|
|
434
|
+
], this.instantiationService.createInstance(ProfileTreeDataSource), {
|
|
486
435
|
multipleSelectionSupport: false,
|
|
487
436
|
horizontalScrolling: false,
|
|
488
437
|
accessibilityProvider: {
|
|
489
438
|
getAriaLabel(element) {
|
|
490
|
-
|
|
491
|
-
return (element?.element).resourceType;
|
|
492
|
-
}
|
|
493
|
-
if ((element?.element).label) {
|
|
494
|
-
return (element?.element).label;
|
|
495
|
-
}
|
|
496
|
-
return '';
|
|
439
|
+
return element?.element ?? '';
|
|
497
440
|
},
|
|
498
441
|
getWidgetAriaLabel() {
|
|
499
442
|
return '';
|
|
@@ -501,114 +444,52 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
501
444
|
},
|
|
502
445
|
identityProvider: {
|
|
503
446
|
getId(element) {
|
|
504
|
-
|
|
505
|
-
return element.element.handle;
|
|
506
|
-
}
|
|
507
|
-
return '';
|
|
447
|
+
return element.element;
|
|
508
448
|
}
|
|
509
449
|
},
|
|
510
450
|
expandOnlyOnTwistieClick: true,
|
|
511
451
|
renderIndentGuides: RenderIndentGuides.None,
|
|
512
452
|
enableStickyScroll: false,
|
|
513
453
|
openOnSingleClick: false,
|
|
454
|
+
setRowLineHeight: false,
|
|
455
|
+
supportDynamicHeights: true,
|
|
456
|
+
alwaysConsumeMouseWheel: false,
|
|
514
457
|
}));
|
|
515
|
-
this.
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
if (e.element?.element.action) {
|
|
523
|
-
await e.element.element.action.run();
|
|
524
|
-
}
|
|
525
|
-
}));
|
|
526
|
-
}
|
|
527
|
-
renderIconSelectBox(iconContainer) {
|
|
528
|
-
const iconSelectBox = this._register(this.instantiationService.createInstance(WorkbenchIconSelectBox, { icons: ICONS, inputBoxStyles: defaultInputBoxStyles }));
|
|
529
|
-
let hoverWidget;
|
|
530
|
-
const showIconSelectBox = () => {
|
|
531
|
-
if (this._profileElement.value?.element instanceof UserDataProfileElement && this._profileElement.value.element.profile.isDefault) {
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
if (this._profileElement.value?.element.disabled) {
|
|
535
|
-
return;
|
|
536
|
-
}
|
|
537
|
-
iconSelectBox.clearInput();
|
|
538
|
-
hoverWidget = this.hoverService.showHover({
|
|
539
|
-
content: iconSelectBox.domNode,
|
|
540
|
-
target: iconContainer,
|
|
541
|
-
position: {
|
|
542
|
-
hoverPosition: HoverPosition.BELOW,
|
|
543
|
-
},
|
|
544
|
-
persistence: {
|
|
545
|
-
sticky: true,
|
|
546
|
-
},
|
|
547
|
-
appearance: {
|
|
548
|
-
showPointer: true,
|
|
549
|
-
},
|
|
550
|
-
}, true);
|
|
551
|
-
if (hoverWidget) {
|
|
552
|
-
iconSelectBox.layout(( (new Dimension(486, 260))));
|
|
553
|
-
iconSelectBox.focus();
|
|
554
|
-
}
|
|
555
|
-
};
|
|
556
|
-
this._register(addDisposableListener(iconContainer, EventType.CLICK, (e) => {
|
|
557
|
-
EventHelper.stop(e, true);
|
|
558
|
-
showIconSelectBox();
|
|
559
|
-
}));
|
|
560
|
-
this._register(addDisposableListener(iconContainer, EventType.KEY_DOWN, e => {
|
|
561
|
-
const event = ( (new StandardKeyboardEvent(e)));
|
|
562
|
-
if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
|
|
563
|
-
EventHelper.stop(event, true);
|
|
564
|
-
showIconSelectBox();
|
|
565
|
-
}
|
|
566
|
-
}));
|
|
567
|
-
this._register(addDisposableListener(iconSelectBox.domNode, EventType.KEY_DOWN, e => {
|
|
568
|
-
const event = ( (new StandardKeyboardEvent(e)));
|
|
569
|
-
if (event.equals(KeyCode.Escape)) {
|
|
570
|
-
EventHelper.stop(event, true);
|
|
571
|
-
hoverWidget?.dispose();
|
|
572
|
-
iconContainer.focus();
|
|
458
|
+
this.profileTree.style(listStyles);
|
|
459
|
+
this._register(contentsRenderer.onDidChangeContentHeight((e) => this.profileTree.updateElementHeight(e, undefined)));
|
|
460
|
+
this._register(contentsRenderer.onDidChangeSelection((e) => {
|
|
461
|
+
if (e.selected) {
|
|
462
|
+
this.profileTree.setFocus([]);
|
|
463
|
+
this.profileTree.setSelection([]);
|
|
573
464
|
}
|
|
574
465
|
}));
|
|
575
|
-
this._register(
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
if (this._profileElement.value) {
|
|
579
|
-
this._profileElement.value.element.icon = selectedIcon.id;
|
|
466
|
+
this._register(this.profileTree.onDidChangeContentHeight((e) => {
|
|
467
|
+
if (this.dimension) {
|
|
468
|
+
this.layout(this.dimension);
|
|
580
469
|
}
|
|
581
470
|
}));
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
this._register(this.copyFromSelectBox.onDidSelect(option => {
|
|
586
|
-
if (this._profileElement.value?.element instanceof NewProfileElement) {
|
|
587
|
-
this._profileElement.value.element.copyFrom = this.copyFromOptions[option.index].source;
|
|
471
|
+
this._register(this.profileTree.onDidChangeSelection((e) => {
|
|
472
|
+
if (e.elements.length) {
|
|
473
|
+
contentsRenderer.clearSelection();
|
|
588
474
|
}
|
|
589
475
|
}));
|
|
476
|
+
this.buttonContainer = append(body, $('.profile-row-container.profile-button-container'));
|
|
590
477
|
}
|
|
591
478
|
layout(dimension) {
|
|
592
|
-
this.
|
|
479
|
+
this.dimension = dimension;
|
|
480
|
+
const treeContentHeight = this.profileTree.contentHeight;
|
|
481
|
+
const height = Math.min(treeContentHeight, dimension.height - (this._profileElement.value?.element instanceof NewProfileElement ? 116 : 54));
|
|
482
|
+
this.profileTreeContainer.style.height = `${height}px`;
|
|
483
|
+
this.profileTree.layout(height, dimension.width);
|
|
593
484
|
}
|
|
594
485
|
render(profileElement) {
|
|
595
|
-
this.
|
|
486
|
+
this.profileTree.setInput(profileElement);
|
|
596
487
|
const disposables = ( (new DisposableStore()));
|
|
597
488
|
this._profileElement.value = { element: profileElement, dispose: () => disposables.dispose() };
|
|
598
|
-
this.
|
|
599
|
-
disposables.add(profileElement.onDidChange(e => this.renderProfileElement(profileElement)));
|
|
600
|
-
const profile = profileElement instanceof UserDataProfileElement ? profileElement.profile : undefined;
|
|
601
|
-
this.profileTitle.classList.toggle('hide', !profile?.isDefault);
|
|
602
|
-
this.nameInput.element.classList.toggle('hide', !!profile?.isDefault);
|
|
603
|
-
this.iconElement.classList.toggle('disabled', !!profile?.isDefault);
|
|
604
|
-
this.iconElement.setAttribute('tabindex', profile?.isDefault ? '' : '0');
|
|
489
|
+
this.profileTitle.textContent = profileElement.name;
|
|
605
490
|
disposables.add(profileElement.onDidChange(e => {
|
|
606
|
-
if (e.
|
|
607
|
-
|
|
608
|
-
this.resourcesTree.setInput(profileElement, {
|
|
609
|
-
...viewState,
|
|
610
|
-
expanded: viewState.expanded?.map(e => e)
|
|
611
|
-
});
|
|
491
|
+
if (e.name) {
|
|
492
|
+
this.profileTitle.textContent = profileElement.name;
|
|
612
493
|
}
|
|
613
494
|
}));
|
|
614
495
|
const [primaryTitleButtons, secondatyTitleButtons] = profileElement.titleButtons;
|
|
@@ -627,6 +508,9 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
627
508
|
if (!isUndefined(e.enabled)) {
|
|
628
509
|
button.enabled = action.enabled;
|
|
629
510
|
}
|
|
511
|
+
if (!isUndefined(e.label)) {
|
|
512
|
+
button.label = action.label;
|
|
513
|
+
}
|
|
630
514
|
}));
|
|
631
515
|
}
|
|
632
516
|
}
|
|
@@ -642,6 +526,9 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
642
526
|
if (!isUndefined(e.enabled)) {
|
|
643
527
|
button.enabled = action.enabled;
|
|
644
528
|
}
|
|
529
|
+
if (!isUndefined(e.label)) {
|
|
530
|
+
button.label = action.label;
|
|
531
|
+
}
|
|
645
532
|
}));
|
|
646
533
|
disposables.add(profileElement.onDidChange(e => {
|
|
647
534
|
if (e.message) {
|
|
@@ -655,81 +542,67 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
655
542
|
else {
|
|
656
543
|
this.buttonContainer.classList.add('hide');
|
|
657
544
|
}
|
|
658
|
-
this.toolbar.setActions(profileElement.titleActions[0].slice(0), profileElement.titleActions[1].slice(0));
|
|
659
545
|
if (profileElement instanceof NewProfileElement) {
|
|
660
|
-
this.
|
|
661
|
-
this.nameInput.select();
|
|
546
|
+
this.profileTree.focusFirst();
|
|
662
547
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
this.profileTitle.textContent = profileElement.name;
|
|
666
|
-
this.nameInput.value = profileElement.name;
|
|
667
|
-
this.nameInput.validate();
|
|
668
|
-
if (profileElement.disabled) {
|
|
669
|
-
this.nameInput.disable();
|
|
548
|
+
if (this.dimension) {
|
|
549
|
+
this.layout(this.dimension);
|
|
670
550
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
this.copyFromSelectBox.setOptions([{ text: basename(profileElement.copyFrom) }]);
|
|
697
|
-
this.copyFromSelectBox.setEnabled(false);
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
else if (profileElement instanceof UserDataProfileElement) {
|
|
701
|
-
this.contentsTreeHeader.classList.remove('new-profile');
|
|
702
|
-
this.inheritLabelElement.textContent = profileElement.profile.isDefault ? '' : ( localizeWithPath(_moduleId, 19, "Use Default Profile"));
|
|
703
|
-
this.useAsDefaultProfileContainer.classList.remove('hide');
|
|
704
|
-
this.useAsDefaultProfileCheckbox.checked = profileElement.isNewWindowProfile;
|
|
705
|
-
this.copyFromContainer.classList.add('hide');
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
ProfileWidget = ( (__decorate([
|
|
554
|
+
( (__param(1, IEditorProgressService))),
|
|
555
|
+
( (__param(2, IInstantiationService)))
|
|
556
|
+
], ProfileWidget)));
|
|
557
|
+
class ProfileTreeDelegate extends CachedListVirtualDelegate {
|
|
558
|
+
getTemplateId({ element }) {
|
|
559
|
+
return element;
|
|
560
|
+
}
|
|
561
|
+
hasDynamicHeight({ element }) {
|
|
562
|
+
return element === 'contents';
|
|
563
|
+
}
|
|
564
|
+
estimateHeight({ element }) {
|
|
565
|
+
switch (element) {
|
|
566
|
+
case 'name':
|
|
567
|
+
return 72;
|
|
568
|
+
case 'icon':
|
|
569
|
+
return 68;
|
|
570
|
+
case 'copyFrom':
|
|
571
|
+
return 90;
|
|
572
|
+
case 'useAsDefault':
|
|
573
|
+
return 68;
|
|
574
|
+
case 'contents':
|
|
575
|
+
return 250;
|
|
706
576
|
}
|
|
707
577
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
578
|
+
}
|
|
579
|
+
class ProfileTreeDataSource {
|
|
580
|
+
hasChildren(element) {
|
|
581
|
+
return element instanceof AbstractUserDataProfileElement;
|
|
582
|
+
}
|
|
583
|
+
async getChildren(element) {
|
|
584
|
+
if (element instanceof AbstractUserDataProfileElement) {
|
|
585
|
+
const children = [];
|
|
586
|
+
if (element instanceof NewProfileElement) {
|
|
587
|
+
children.push({ element: 'name', root: element });
|
|
588
|
+
children.push({ element: 'icon', root: element });
|
|
589
|
+
children.push({ element: 'copyFrom', root: element });
|
|
590
|
+
children.push({ element: 'contents', root: element });
|
|
716
591
|
}
|
|
592
|
+
else if (element instanceof UserDataProfileElement) {
|
|
593
|
+
if (!element.profile.isDefault) {
|
|
594
|
+
children.push({ element: 'name', root: element });
|
|
595
|
+
children.push({ element: 'icon', root: element });
|
|
596
|
+
}
|
|
597
|
+
children.push({ element: 'useAsDefault', root: element });
|
|
598
|
+
children.push({ element: 'contents', root: element });
|
|
599
|
+
}
|
|
600
|
+
return children;
|
|
717
601
|
}
|
|
718
|
-
|
|
719
|
-
for (const profile of this.userDataProfilesService.profiles) {
|
|
720
|
-
copyFromOptions.push({ text: profile.name, id: profile.id, source: profile });
|
|
721
|
-
}
|
|
722
|
-
return copyFromOptions;
|
|
602
|
+
return [];
|
|
723
603
|
}
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
( (__param(1, IHoverService))),
|
|
727
|
-
( (__param(2, IUserDataProfilesService))),
|
|
728
|
-
( (__param(3, IContextViewService))),
|
|
729
|
-
( (__param(4, IEditorProgressService))),
|
|
730
|
-
( (__param(5, IInstantiationService)))
|
|
731
|
-
], ProfileWidget)));
|
|
732
|
-
class ProfileResourceTreeElementDelegate {
|
|
604
|
+
}
|
|
605
|
+
class ProfileContentTreeElementDelegate {
|
|
733
606
|
getTemplateId(element) {
|
|
734
607
|
if (!element.element.resourceType) {
|
|
735
608
|
return ProfileResourceChildTreeItemRenderer.TEMPLATE_ID;
|
|
@@ -740,7 +613,7 @@ class ProfileResourceTreeElementDelegate {
|
|
|
740
613
|
return ExistingProfileResourceTreeRenderer.TEMPLATE_ID;
|
|
741
614
|
}
|
|
742
615
|
getHeight(element) {
|
|
743
|
-
return
|
|
616
|
+
return 24;
|
|
744
617
|
}
|
|
745
618
|
}
|
|
746
619
|
let ProfileResourceTreeDataSource = class ProfileResourceTreeDataSource {
|
|
@@ -803,15 +676,15 @@ class AbstractProfileResourceTreeRenderer extends Disposable {
|
|
|
803
676
|
getResourceTypeTitle(resourceType) {
|
|
804
677
|
switch (resourceType) {
|
|
805
678
|
case ProfileResourceType.Settings:
|
|
806
|
-
return (
|
|
679
|
+
return ( localize(10932, "Settings"));
|
|
807
680
|
case ProfileResourceType.Keybindings:
|
|
808
|
-
return (
|
|
681
|
+
return ( localize(10933, "Keyboard Shortcuts"));
|
|
809
682
|
case ProfileResourceType.Snippets:
|
|
810
|
-
return (
|
|
683
|
+
return ( localize(10934, "Snippets"));
|
|
811
684
|
case ProfileResourceType.Tasks:
|
|
812
|
-
return (
|
|
685
|
+
return ( localize(10935, "Tasks"));
|
|
813
686
|
case ProfileResourceType.Extensions:
|
|
814
|
-
return (
|
|
687
|
+
return ( localize(10936, "Extensions"));
|
|
815
688
|
}
|
|
816
689
|
return '';
|
|
817
690
|
}
|
|
@@ -822,6 +695,485 @@ class AbstractProfileResourceTreeRenderer extends Disposable {
|
|
|
822
695
|
templateData.disposables.dispose();
|
|
823
696
|
}
|
|
824
697
|
}
|
|
698
|
+
class ProfilePropertyRenderer extends AbstractProfileResourceTreeRenderer {
|
|
699
|
+
renderElement({ element }, index, templateData, height) {
|
|
700
|
+
templateData.elementDisposables.clear();
|
|
701
|
+
templateData.element = element;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
let ProfileNameRenderer = class ProfileNameRenderer extends ProfilePropertyRenderer {
|
|
705
|
+
constructor(userDataProfilesService, contextViewService) {
|
|
706
|
+
super();
|
|
707
|
+
this.userDataProfilesService = userDataProfilesService;
|
|
708
|
+
this.contextViewService = contextViewService;
|
|
709
|
+
this.templateId = 'name';
|
|
710
|
+
}
|
|
711
|
+
renderTemplate(parent) {
|
|
712
|
+
const disposables = ( (new DisposableStore()));
|
|
713
|
+
const elementDisposables = disposables.add(( (new DisposableStore())));
|
|
714
|
+
let profileElement;
|
|
715
|
+
const nameContainer = append(parent, $('.profile-row-container'));
|
|
716
|
+
append(nameContainer, $('.profile-label-element', undefined, ( localize(10937, "Name"))));
|
|
717
|
+
const nameInput = disposables.add(( (new InputBox(nameContainer, this.contextViewService, {
|
|
718
|
+
inputBoxStyles: getInputBoxStyle({
|
|
719
|
+
inputBorder: settingsTextInputBorder
|
|
720
|
+
}),
|
|
721
|
+
ariaLabel: ( localize(10938, "Profile Name")),
|
|
722
|
+
placeholder: ( localize(10938, "Profile Name")),
|
|
723
|
+
validationOptions: {
|
|
724
|
+
validation: (value) => {
|
|
725
|
+
if (!value) {
|
|
726
|
+
return {
|
|
727
|
+
content: ( localize(10939, "Profile name is required and must be a non-empty value.")),
|
|
728
|
+
type: MessageType.WARNING
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
if (profileElement?.root.disabled) {
|
|
732
|
+
return null;
|
|
733
|
+
}
|
|
734
|
+
if (!profileElement?.root.shouldValidateName()) {
|
|
735
|
+
return null;
|
|
736
|
+
}
|
|
737
|
+
const initialName = profileElement?.root.getInitialName();
|
|
738
|
+
value = value.trim();
|
|
739
|
+
if (initialName !== value && ( (this.userDataProfilesService.profiles.some(p => p.name === value)))) {
|
|
740
|
+
return {
|
|
741
|
+
content: ( localize(10940, "Profile with name {0} already exists.", value)),
|
|
742
|
+
type: MessageType.WARNING
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
return null;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}))));
|
|
749
|
+
disposables.add(this.userDataProfilesService.onDidChangeProfiles(() => nameInput.validate()));
|
|
750
|
+
nameInput.onDidChange(value => {
|
|
751
|
+
if (profileElement && value) {
|
|
752
|
+
profileElement.root.name = value;
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
const focusTracker = disposables.add(trackFocus(nameInput.inputElement));
|
|
756
|
+
disposables.add(focusTracker.onDidBlur(() => {
|
|
757
|
+
if (profileElement && !nameInput.value) {
|
|
758
|
+
nameInput.value = profileElement.root.name;
|
|
759
|
+
}
|
|
760
|
+
}));
|
|
761
|
+
const renderName = (profileElement) => {
|
|
762
|
+
nameInput.value = profileElement.root.name;
|
|
763
|
+
nameInput.validate();
|
|
764
|
+
if (profileElement.root.disabled) {
|
|
765
|
+
nameInput.disable();
|
|
766
|
+
}
|
|
767
|
+
else {
|
|
768
|
+
nameInput.enable();
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
return {
|
|
772
|
+
set element(element) {
|
|
773
|
+
profileElement = element;
|
|
774
|
+
renderName(profileElement);
|
|
775
|
+
elementDisposables.add(profileElement.root.onDidChange(e => {
|
|
776
|
+
if (e.name || e.disabled) {
|
|
777
|
+
renderName(element);
|
|
778
|
+
}
|
|
779
|
+
}));
|
|
780
|
+
},
|
|
781
|
+
disposables,
|
|
782
|
+
elementDisposables
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
ProfileNameRenderer = ( (__decorate([
|
|
787
|
+
( (__param(0, IUserDataProfilesService))),
|
|
788
|
+
( (__param(1, IContextViewService)))
|
|
789
|
+
], ProfileNameRenderer)));
|
|
790
|
+
let ProfileIconRenderer = class ProfileIconRenderer extends ProfilePropertyRenderer {
|
|
791
|
+
constructor(instantiationService, hoverService) {
|
|
792
|
+
super();
|
|
793
|
+
this.instantiationService = instantiationService;
|
|
794
|
+
this.hoverService = hoverService;
|
|
795
|
+
this.templateId = 'icon';
|
|
796
|
+
}
|
|
797
|
+
renderTemplate(parent) {
|
|
798
|
+
const disposables = ( (new DisposableStore()));
|
|
799
|
+
const elementDisposables = disposables.add(( (new DisposableStore())));
|
|
800
|
+
let profileElement;
|
|
801
|
+
const iconContainer = append(parent, $('.profile-row-container'));
|
|
802
|
+
append(iconContainer, $('.profile-label-element', undefined, ( localize(10941, "Icon"))));
|
|
803
|
+
const iconValueContainer = append(iconContainer, $('.profile-icon-container'));
|
|
804
|
+
const iconElement = append(iconValueContainer, $(`${ThemeIcon.asCSSSelector(DEFAULT_ICON)}`, { 'tabindex': '0', 'role': 'button', 'aria-label': ( localize(10942, "Profile Icon")) }));
|
|
805
|
+
const iconSelectBox = disposables.add(this.instantiationService.createInstance(WorkbenchIconSelectBox, { icons: ICONS, inputBoxStyles: defaultInputBoxStyles }));
|
|
806
|
+
let hoverWidget;
|
|
807
|
+
const showIconSelectBox = () => {
|
|
808
|
+
if (profileElement?.root instanceof UserDataProfileElement && profileElement.root.profile.isDefault) {
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
if (profileElement?.root.disabled) {
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
iconSelectBox.clearInput();
|
|
815
|
+
hoverWidget = this.hoverService.showHover({
|
|
816
|
+
content: iconSelectBox.domNode,
|
|
817
|
+
target: iconElement,
|
|
818
|
+
position: {
|
|
819
|
+
hoverPosition: HoverPosition.BELOW,
|
|
820
|
+
},
|
|
821
|
+
persistence: {
|
|
822
|
+
sticky: true,
|
|
823
|
+
},
|
|
824
|
+
appearance: {
|
|
825
|
+
showPointer: true,
|
|
826
|
+
},
|
|
827
|
+
}, true);
|
|
828
|
+
if (hoverWidget) {
|
|
829
|
+
iconSelectBox.layout(( (new Dimension(486, 260))));
|
|
830
|
+
iconSelectBox.focus();
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
disposables.add(addDisposableListener(iconElement, EventType.CLICK, (e) => {
|
|
834
|
+
EventHelper.stop(e, true);
|
|
835
|
+
showIconSelectBox();
|
|
836
|
+
}));
|
|
837
|
+
disposables.add(addDisposableListener(iconElement, EventType.KEY_DOWN, e => {
|
|
838
|
+
const event = ( (new StandardKeyboardEvent(e)));
|
|
839
|
+
if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
|
|
840
|
+
EventHelper.stop(event, true);
|
|
841
|
+
showIconSelectBox();
|
|
842
|
+
}
|
|
843
|
+
}));
|
|
844
|
+
disposables.add(addDisposableListener(iconSelectBox.domNode, EventType.KEY_DOWN, e => {
|
|
845
|
+
const event = ( (new StandardKeyboardEvent(e)));
|
|
846
|
+
if (event.equals(KeyCode.Escape)) {
|
|
847
|
+
EventHelper.stop(event, true);
|
|
848
|
+
hoverWidget?.dispose();
|
|
849
|
+
iconElement.focus();
|
|
850
|
+
}
|
|
851
|
+
}));
|
|
852
|
+
disposables.add(iconSelectBox.onDidSelect(selectedIcon => {
|
|
853
|
+
hoverWidget?.dispose();
|
|
854
|
+
iconElement.focus();
|
|
855
|
+
if (profileElement) {
|
|
856
|
+
profileElement.root.icon = selectedIcon.id;
|
|
857
|
+
}
|
|
858
|
+
}));
|
|
859
|
+
append(iconValueContainer, $('.profile-description-element', undefined, ( localize(10943, "Profile icon to be shown in the activity bar"))));
|
|
860
|
+
const renderIcon = (profileElement) => {
|
|
861
|
+
if (profileElement.root.icon) {
|
|
862
|
+
iconElement.className = ThemeIcon.asClassName(ThemeIcon.fromId(profileElement.root.icon));
|
|
863
|
+
}
|
|
864
|
+
else {
|
|
865
|
+
iconElement.className = ThemeIcon.asClassName(ThemeIcon.fromId(DEFAULT_ICON.id));
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
return {
|
|
869
|
+
set element(element) {
|
|
870
|
+
profileElement = element;
|
|
871
|
+
renderIcon(profileElement);
|
|
872
|
+
elementDisposables.add(profileElement.root.onDidChange(e => {
|
|
873
|
+
if (e.icon) {
|
|
874
|
+
renderIcon(element);
|
|
875
|
+
}
|
|
876
|
+
}));
|
|
877
|
+
},
|
|
878
|
+
disposables,
|
|
879
|
+
elementDisposables
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
ProfileIconRenderer = ( (__decorate([
|
|
884
|
+
( (__param(0, IInstantiationService))),
|
|
885
|
+
( (__param(1, IHoverService)))
|
|
886
|
+
], ProfileIconRenderer)));
|
|
887
|
+
class UseAsDefaultProfileRenderer extends ProfilePropertyRenderer {
|
|
888
|
+
constructor() {
|
|
889
|
+
super(...arguments);
|
|
890
|
+
this.templateId = 'useAsDefault';
|
|
891
|
+
}
|
|
892
|
+
renderTemplate(parent) {
|
|
893
|
+
const disposables = ( (new DisposableStore()));
|
|
894
|
+
const elementDisposables = disposables.add(( (new DisposableStore())));
|
|
895
|
+
let profileElement;
|
|
896
|
+
const useAsDefaultProfileContainer = append(parent, $('.profile-row-container'));
|
|
897
|
+
append(useAsDefaultProfileContainer, $('.profile-label-element', undefined, ( localize(10944, "Use as Default"))));
|
|
898
|
+
const useAsDefaultProfileValueContainer = append(useAsDefaultProfileContainer, $('.profile-use-as-default-container'));
|
|
899
|
+
const useAsDefaultProfileTitle = ( localize(10945, "Use this profile as the default for new windows"));
|
|
900
|
+
const useAsDefaultProfileCheckbox = disposables.add(( (new Checkbox(useAsDefaultProfileTitle, false, defaultCheckboxStyles))));
|
|
901
|
+
append(useAsDefaultProfileValueContainer, useAsDefaultProfileCheckbox.domNode);
|
|
902
|
+
const useAsDefaultProfileLabel = append(useAsDefaultProfileValueContainer, $('.profile-description-element', undefined, useAsDefaultProfileTitle));
|
|
903
|
+
disposables.add(useAsDefaultProfileCheckbox.onChange(() => {
|
|
904
|
+
if (profileElement?.root instanceof UserDataProfileElement) {
|
|
905
|
+
profileElement.root.toggleNewWindowProfile();
|
|
906
|
+
}
|
|
907
|
+
}));
|
|
908
|
+
disposables.add(addDisposableListener(useAsDefaultProfileLabel, EventType.CLICK, () => {
|
|
909
|
+
if (profileElement?.root instanceof UserDataProfileElement) {
|
|
910
|
+
profileElement.root.toggleNewWindowProfile();
|
|
911
|
+
}
|
|
912
|
+
}));
|
|
913
|
+
const renderUseAsDefault = (profileElement) => {
|
|
914
|
+
useAsDefaultProfileCheckbox.checked = profileElement.root instanceof UserDataProfileElement && profileElement.root.isNewWindowProfile;
|
|
915
|
+
};
|
|
916
|
+
return {
|
|
917
|
+
set element(element) {
|
|
918
|
+
profileElement = element;
|
|
919
|
+
renderUseAsDefault(profileElement);
|
|
920
|
+
elementDisposables.add(profileElement.root.onDidChange(e => {
|
|
921
|
+
if (e.newWindowProfile) {
|
|
922
|
+
renderUseAsDefault(element);
|
|
923
|
+
}
|
|
924
|
+
}));
|
|
925
|
+
},
|
|
926
|
+
disposables,
|
|
927
|
+
elementDisposables
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
let CopyFromProfileRenderer = class CopyFromProfileRenderer extends ProfilePropertyRenderer {
|
|
932
|
+
constructor(userDataProfilesService, instantiationService, uriIdentityService, contextViewService) {
|
|
933
|
+
super();
|
|
934
|
+
this.userDataProfilesService = userDataProfilesService;
|
|
935
|
+
this.instantiationService = instantiationService;
|
|
936
|
+
this.uriIdentityService = uriIdentityService;
|
|
937
|
+
this.contextViewService = contextViewService;
|
|
938
|
+
this.templateId = 'copyFrom';
|
|
939
|
+
this.templates = [];
|
|
940
|
+
}
|
|
941
|
+
renderTemplate(parent) {
|
|
942
|
+
const disposables = ( (new DisposableStore()));
|
|
943
|
+
const elementDisposables = disposables.add(( (new DisposableStore())));
|
|
944
|
+
let profileElement;
|
|
945
|
+
const copyFromContainer = append(parent, $('.profile-row-container.profile-copy-from-container'));
|
|
946
|
+
append(copyFromContainer, $('.profile-label-element', undefined, ( localize(10946, "Copy from"))));
|
|
947
|
+
append(copyFromContainer, $('.profile-description-element', undefined, ( localize(10947, "Select the profile source from which you want to copy contents"))));
|
|
948
|
+
const copyFromSelectBox = disposables.add(this.instantiationService.createInstance(SelectBox, [], 0, this.contextViewService, defaultSelectBoxStyles, {
|
|
949
|
+
useCustomDrawn: true,
|
|
950
|
+
ariaLabel: ( localize(10948, "Copy profile from")),
|
|
951
|
+
}));
|
|
952
|
+
copyFromSelectBox.render(append(copyFromContainer, $('.profile-select-container')));
|
|
953
|
+
const render = (profileElement, copyFromOptions) => {
|
|
954
|
+
copyFromSelectBox.setOptions(copyFromOptions);
|
|
955
|
+
const id = profileElement.copyFrom instanceof URI ? ( (profileElement.copyFrom.toString())) : profileElement.copyFrom?.id;
|
|
956
|
+
const index = id
|
|
957
|
+
? copyFromOptions.findIndex(option => option.id === id)
|
|
958
|
+
: 0;
|
|
959
|
+
copyFromSelectBox.select(index);
|
|
960
|
+
};
|
|
961
|
+
const that = this;
|
|
962
|
+
return {
|
|
963
|
+
set element(element) {
|
|
964
|
+
profileElement = element;
|
|
965
|
+
if (profileElement.root instanceof NewProfileElement) {
|
|
966
|
+
const newProfileElement = profileElement.root;
|
|
967
|
+
let copyFromOptions = that.getCopyFromOptions(newProfileElement);
|
|
968
|
+
render(newProfileElement, copyFromOptions);
|
|
969
|
+
copyFromSelectBox.setEnabled(!newProfileElement.previewProfile && !newProfileElement.disabled);
|
|
970
|
+
elementDisposables.add(profileElement.root.onDidChange(e => {
|
|
971
|
+
if (e.copyFrom || e.copyFromInfo) {
|
|
972
|
+
copyFromOptions = that.getCopyFromOptions(newProfileElement);
|
|
973
|
+
render(newProfileElement, copyFromOptions);
|
|
974
|
+
}
|
|
975
|
+
if (e.preview || e.disabled) {
|
|
976
|
+
copyFromSelectBox.setEnabled(!newProfileElement.previewProfile && !newProfileElement.disabled);
|
|
977
|
+
}
|
|
978
|
+
}));
|
|
979
|
+
elementDisposables.add(copyFromSelectBox.onDidSelect(option => {
|
|
980
|
+
newProfileElement.copyFrom = copyFromOptions[option.index].source;
|
|
981
|
+
}));
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
disposables,
|
|
985
|
+
elementDisposables
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
setTemplates(templates) {
|
|
989
|
+
this.templates = templates;
|
|
990
|
+
}
|
|
991
|
+
getCopyFromOptions(profileElement) {
|
|
992
|
+
const separator = { text: '\u2500\u2500\u2500\u2500\u2500\u2500', isDisabled: true };
|
|
993
|
+
const copyFromOptions = [];
|
|
994
|
+
copyFromOptions.push({ text: ( localize(10949, "None")) });
|
|
995
|
+
for (const [copyFromTemplate, name] of profileElement.copyFromTemplates) {
|
|
996
|
+
if (!( (this.templates.some(
|
|
997
|
+
template => this.uriIdentityService.extUri.isEqual(( (URI.parse(template.url))), copyFromTemplate)
|
|
998
|
+
)))) {
|
|
999
|
+
copyFromOptions.push({ text: `${name} (${basename(copyFromTemplate)})`, id: ( (copyFromTemplate.toString())), source: copyFromTemplate });
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
if (this.templates.length) {
|
|
1003
|
+
copyFromOptions.push({ ...separator, decoratorRight: ( localize(10950, "Profile Templates")) });
|
|
1004
|
+
for (const template of this.templates) {
|
|
1005
|
+
copyFromOptions.push({ text: template.name, id: template.url, source: ( (URI.parse(template.url))) });
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
copyFromOptions.push({ ...separator, decoratorRight: ( localize(10951, "Existing Profiles")) });
|
|
1009
|
+
for (const profile of this.userDataProfilesService.profiles) {
|
|
1010
|
+
copyFromOptions.push({ text: profile.name, id: profile.id, source: profile });
|
|
1011
|
+
}
|
|
1012
|
+
return copyFromOptions;
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
1015
|
+
CopyFromProfileRenderer = ( (__decorate([
|
|
1016
|
+
( (__param(0, IUserDataProfilesService))),
|
|
1017
|
+
( (__param(1, IInstantiationService))),
|
|
1018
|
+
( (__param(2, IUriIdentityService))),
|
|
1019
|
+
( (__param(3, IContextViewService)))
|
|
1020
|
+
], CopyFromProfileRenderer)));
|
|
1021
|
+
let ContentsProfileRenderer = class ContentsProfileRenderer extends ProfilePropertyRenderer {
|
|
1022
|
+
constructor(userDataProfilesService, instantiationService) {
|
|
1023
|
+
super();
|
|
1024
|
+
this.userDataProfilesService = userDataProfilesService;
|
|
1025
|
+
this.instantiationService = instantiationService;
|
|
1026
|
+
this.templateId = 'contents';
|
|
1027
|
+
this._onDidChangeContentHeight = this._register(( (new Emitter())));
|
|
1028
|
+
this.onDidChangeContentHeight = this._onDidChangeContentHeight.event;
|
|
1029
|
+
this._onDidChangeSelection = this._register(( (new Emitter())));
|
|
1030
|
+
this.onDidChangeSelection = this._onDidChangeSelection.event;
|
|
1031
|
+
}
|
|
1032
|
+
renderTemplate(parent) {
|
|
1033
|
+
const disposables = ( (new DisposableStore()));
|
|
1034
|
+
const elementDisposables = disposables.add(( (new DisposableStore())));
|
|
1035
|
+
let profileElement;
|
|
1036
|
+
const configureRowContainer = append(parent, $('.profile-row-container'));
|
|
1037
|
+
append(configureRowContainer, $('.profile-label-element', undefined, ( localize(10952, "Contents"))));
|
|
1038
|
+
const contentsDescriptionElement = append(configureRowContainer, $('.profile-description-element'));
|
|
1039
|
+
const contentsTreeHeader = append(configureRowContainer, $('.profile-content-tree-header'));
|
|
1040
|
+
const optionsLabel = $('.options-header', undefined, $('span', undefined, ( localize(10953, "Source"))));
|
|
1041
|
+
append(contentsTreeHeader, $(''), $('', undefined, ( localize(10953, "Contents"))), optionsLabel, $('.actions-header', undefined, ( localize(10954, "Actions"))));
|
|
1042
|
+
const delegate = ( (new ProfileContentTreeElementDelegate()));
|
|
1043
|
+
const profilesContentTree = this.profilesContentTree = disposables.add(this.instantiationService.createInstance((WorkbenchAsyncDataTree), 'ProfileEditor-ContentsTree', append(configureRowContainer, $('.profile-content-tree.file-icon-themable-tree.show-file-icons')), delegate, [
|
|
1044
|
+
this.instantiationService.createInstance(ExistingProfileResourceTreeRenderer),
|
|
1045
|
+
this.instantiationService.createInstance(NewProfileResourceTreeRenderer),
|
|
1046
|
+
this.instantiationService.createInstance(ProfileResourceChildTreeItemRenderer),
|
|
1047
|
+
], this.instantiationService.createInstance(ProfileResourceTreeDataSource), {
|
|
1048
|
+
multipleSelectionSupport: false,
|
|
1049
|
+
horizontalScrolling: false,
|
|
1050
|
+
accessibilityProvider: {
|
|
1051
|
+
getAriaLabel(element) {
|
|
1052
|
+
if ((element?.element).resourceType) {
|
|
1053
|
+
return (element?.element).resourceType;
|
|
1054
|
+
}
|
|
1055
|
+
if ((element?.element).label) {
|
|
1056
|
+
return (element?.element).label;
|
|
1057
|
+
}
|
|
1058
|
+
return '';
|
|
1059
|
+
},
|
|
1060
|
+
getWidgetAriaLabel() {
|
|
1061
|
+
return '';
|
|
1062
|
+
},
|
|
1063
|
+
},
|
|
1064
|
+
identityProvider: {
|
|
1065
|
+
getId(element) {
|
|
1066
|
+
if (element?.element.handle) {
|
|
1067
|
+
return element.element.handle;
|
|
1068
|
+
}
|
|
1069
|
+
return '';
|
|
1070
|
+
}
|
|
1071
|
+
},
|
|
1072
|
+
expandOnlyOnTwistieClick: true,
|
|
1073
|
+
renderIndentGuides: RenderIndentGuides.None,
|
|
1074
|
+
enableStickyScroll: false,
|
|
1075
|
+
openOnSingleClick: false,
|
|
1076
|
+
alwaysConsumeMouseWheel: false,
|
|
1077
|
+
}));
|
|
1078
|
+
this.profilesContentTree.style(listStyles);
|
|
1079
|
+
disposables.add(toDisposable(() => this.profilesContentTree = undefined));
|
|
1080
|
+
disposables.add(this.profilesContentTree.onDidChangeContentHeight(height => {
|
|
1081
|
+
this.profilesContentTree?.layout(height);
|
|
1082
|
+
if (profileElement) {
|
|
1083
|
+
this._onDidChangeContentHeight.fire(profileElement);
|
|
1084
|
+
}
|
|
1085
|
+
}));
|
|
1086
|
+
disposables.add(this.profilesContentTree.onDidChangeSelection((e => {
|
|
1087
|
+
if (profileElement) {
|
|
1088
|
+
this._onDidChangeSelection.fire({ element: profileElement, selected: !!e.elements.length });
|
|
1089
|
+
}
|
|
1090
|
+
})));
|
|
1091
|
+
disposables.add(this.profilesContentTree.onDidOpen(async (e) => {
|
|
1092
|
+
if (!e.browserEvent) {
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
if (e.browserEvent.target && e.browserEvent.target.classList.contains(Checkbox.CLASS_NAME)) {
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
if (e.element?.element.action) {
|
|
1099
|
+
await e.element.element.action.run();
|
|
1100
|
+
}
|
|
1101
|
+
}));
|
|
1102
|
+
const updateDescription = (element) => {
|
|
1103
|
+
const defaultHelpInfo = ( localize(10955, "- *Default:* Use contents from the Default profile\n"));
|
|
1104
|
+
const markdown = ( (new MarkdownString()))
|
|
1105
|
+
.appendMarkdown(( localize(10956, "Configure source of contents for this profile\n")));
|
|
1106
|
+
clearNode(contentsDescriptionElement);
|
|
1107
|
+
if (element.root instanceof UserDataProfileElement && element.root.profile.isDefault) {
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
if (element.root instanceof NewProfileElement) {
|
|
1111
|
+
const copyFromName = element.root.getCopyFromName();
|
|
1112
|
+
const optionName = copyFromName === this.userDataProfilesService.defaultProfile.name
|
|
1113
|
+
? ( localize(10957, "{0} (Copy)", copyFromName))
|
|
1114
|
+
: copyFromName;
|
|
1115
|
+
if (optionName) {
|
|
1116
|
+
markdown
|
|
1117
|
+
.appendMarkdown(( localize(
|
|
1118
|
+
10958,
|
|
1119
|
+
"- *{0}:* Copy contents from the {1} profile\n",
|
|
1120
|
+
optionName,
|
|
1121
|
+
copyFromName
|
|
1122
|
+
)));
|
|
1123
|
+
}
|
|
1124
|
+
markdown
|
|
1125
|
+
.appendMarkdown(defaultHelpInfo)
|
|
1126
|
+
.appendMarkdown(( localize(10959, "- *None:* Create empty contents\n")));
|
|
1127
|
+
}
|
|
1128
|
+
else if (element.root instanceof UserDataProfileElement) {
|
|
1129
|
+
markdown
|
|
1130
|
+
.appendMarkdown(defaultHelpInfo)
|
|
1131
|
+
.appendMarkdown(( localize(
|
|
1132
|
+
10960,
|
|
1133
|
+
"- *{1}:* Use contents from the {0} profile\n",
|
|
1134
|
+
element.root.profile.name,
|
|
1135
|
+
element.root.profile.name
|
|
1136
|
+
)));
|
|
1137
|
+
}
|
|
1138
|
+
append(contentsDescriptionElement, elementDisposables.add(renderMarkdown(markdown)).element);
|
|
1139
|
+
};
|
|
1140
|
+
const that = this;
|
|
1141
|
+
return {
|
|
1142
|
+
set element(element) {
|
|
1143
|
+
profileElement = element;
|
|
1144
|
+
updateDescription(element);
|
|
1145
|
+
if (element.root instanceof NewProfileElement) {
|
|
1146
|
+
contentsTreeHeader.classList.remove('default-profile');
|
|
1147
|
+
}
|
|
1148
|
+
else if (element.root instanceof UserDataProfileElement) {
|
|
1149
|
+
contentsTreeHeader.classList.toggle('default-profile', element.root.profile.isDefault);
|
|
1150
|
+
}
|
|
1151
|
+
profilesContentTree.setInput(profileElement.root);
|
|
1152
|
+
elementDisposables.add(profileElement.root.onDidChange(e => {
|
|
1153
|
+
if (e.copyFrom || e.copyFlags || e.flags) {
|
|
1154
|
+
profilesContentTree.updateChildren(element.root);
|
|
1155
|
+
}
|
|
1156
|
+
if (e.copyFromInfo) {
|
|
1157
|
+
updateDescription(element);
|
|
1158
|
+
that._onDidChangeContentHeight.fire(element);
|
|
1159
|
+
}
|
|
1160
|
+
}));
|
|
1161
|
+
},
|
|
1162
|
+
disposables,
|
|
1163
|
+
elementDisposables: ( (new DisposableStore()))
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
clearSelection() {
|
|
1167
|
+
if (this.profilesContentTree) {
|
|
1168
|
+
this.profilesContentTree.setSelection([]);
|
|
1169
|
+
this.profilesContentTree.setFocus([]);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
ContentsProfileRenderer = ( (__decorate([
|
|
1174
|
+
( (__param(0, IUserDataProfilesService))),
|
|
1175
|
+
( (__param(1, IInstantiationService)))
|
|
1176
|
+
], ContentsProfileRenderer)));
|
|
825
1177
|
let ExistingProfileResourceTreeRenderer = class ExistingProfileResourceTreeRenderer extends AbstractProfileResourceTreeRenderer {
|
|
826
1178
|
static { ExistingProfileResourceTreeRenderer_1 = this; }
|
|
827
1179
|
static { this.TEMPLATE_ID = 'ExistingProfileResourceTemplate'; }
|
|
@@ -834,15 +1186,14 @@ let ExistingProfileResourceTreeRenderer = class ExistingProfileResourceTreeRende
|
|
|
834
1186
|
const disposables = ( (new DisposableStore()));
|
|
835
1187
|
const container = append(parent, $('.profile-tree-item-container.existing-profile-resource-type-container'));
|
|
836
1188
|
const label = append(container, $('.profile-resource-type-label'));
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
append(
|
|
840
|
-
const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
|
|
1189
|
+
const radio = disposables.add(( (new Radio({ items: [] }))));
|
|
1190
|
+
append(append(container, $('.profile-resource-options-container')), radio.domNode);
|
|
1191
|
+
const actionsContainer = append(container, $('.profile-resource-actions-container'));
|
|
841
1192
|
const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
|
|
842
1193
|
hoverDelegate: disposables.add(createInstantHoverDelegate()),
|
|
843
1194
|
highlightToggledItems: true
|
|
844
1195
|
}));
|
|
845
|
-
return {
|
|
1196
|
+
return { label, radio, actionBar, disposables, elementDisposables: disposables.add(( (new DisposableStore()))) };
|
|
846
1197
|
}
|
|
847
1198
|
renderElement({ element: profileResourceTreeElement }, index, templateData, height) {
|
|
848
1199
|
templateData.elementDisposables.clear();
|
|
@@ -852,17 +1203,35 @@ let ExistingProfileResourceTreeRenderer = class ExistingProfileResourceTreeRende
|
|
|
852
1203
|
'ExistingProfileResourceTreeRenderer can only render existing profile element'
|
|
853
1204
|
)));
|
|
854
1205
|
}
|
|
855
|
-
if (!isProfileResourceTypeElement(element)) {
|
|
1206
|
+
if (isString(element) || !isProfileResourceTypeElement(element)) {
|
|
856
1207
|
throw ( (new Error('Invalid profile resource element')));
|
|
857
1208
|
}
|
|
858
|
-
|
|
1209
|
+
const updateRadioItems = () => {
|
|
1210
|
+
templateData.radio.setItems([{
|
|
1211
|
+
text: ( localize(10961, "Default")),
|
|
1212
|
+
tooltip: ( localize(10962, "Use {0} from the Default profile", resourceTypeTitle)),
|
|
1213
|
+
isActive: root.getFlag(element.resourceType)
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
text: root.name,
|
|
1217
|
+
tooltip: ( localize(10963, "Use {0} from the {1} profile", resourceTypeTitle, root.name)),
|
|
1218
|
+
isActive: !root.getFlag(element.resourceType)
|
|
1219
|
+
}]);
|
|
1220
|
+
};
|
|
1221
|
+
const resourceTypeTitle = this.getResourceTypeTitle(element.resourceType);
|
|
1222
|
+
templateData.label.textContent = resourceTypeTitle;
|
|
859
1223
|
if (root instanceof UserDataProfileElement && root.profile.isDefault) {
|
|
860
|
-
templateData.
|
|
1224
|
+
templateData.radio.domNode.classList.add('hide');
|
|
861
1225
|
}
|
|
862
1226
|
else {
|
|
863
|
-
templateData.
|
|
864
|
-
|
|
865
|
-
templateData.elementDisposables.add(
|
|
1227
|
+
templateData.radio.domNode.classList.remove('hide');
|
|
1228
|
+
updateRadioItems();
|
|
1229
|
+
templateData.elementDisposables.add(root.onDidChange(e => {
|
|
1230
|
+
if (e.name) {
|
|
1231
|
+
updateRadioItems();
|
|
1232
|
+
}
|
|
1233
|
+
}));
|
|
1234
|
+
templateData.elementDisposables.add(templateData.radio.onDidSelect((index) => root.setFlag(element.resourceType, index === 0)));
|
|
866
1235
|
}
|
|
867
1236
|
templateData.actionBar.setActions(element.action ? [element.action] : []);
|
|
868
1237
|
}
|
|
@@ -873,9 +1242,9 @@ ExistingProfileResourceTreeRenderer = ExistingProfileResourceTreeRenderer_1 = (
|
|
|
873
1242
|
let NewProfileResourceTreeRenderer = class NewProfileResourceTreeRenderer extends AbstractProfileResourceTreeRenderer {
|
|
874
1243
|
static { NewProfileResourceTreeRenderer_1 = this; }
|
|
875
1244
|
static { this.TEMPLATE_ID = 'NewProfileResourceTemplate'; }
|
|
876
|
-
constructor(
|
|
1245
|
+
constructor(userDataProfilesService, instantiationService) {
|
|
877
1246
|
super();
|
|
878
|
-
this.
|
|
1247
|
+
this.userDataProfilesService = userDataProfilesService;
|
|
879
1248
|
this.instantiationService = instantiationService;
|
|
880
1249
|
this.templateId = NewProfileResourceTreeRenderer_1.TEMPLATE_ID;
|
|
881
1250
|
}
|
|
@@ -884,17 +1253,14 @@ let NewProfileResourceTreeRenderer = class NewProfileResourceTreeRenderer extend
|
|
|
884
1253
|
const container = append(parent, $('.profile-tree-item-container.new-profile-resource-type-container'));
|
|
885
1254
|
const labelContainer = append(container, $('.profile-resource-type-label-container'));
|
|
886
1255
|
const label = append(labelContainer, $('span.profile-resource-type-label'));
|
|
887
|
-
const
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
const selectContainer = append(container, $('.profile-select-container'));
|
|
891
|
-
selectBox.render(selectContainer);
|
|
892
|
-
const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
|
|
1256
|
+
const radio = disposables.add(( (new Radio({ items: [] }))));
|
|
1257
|
+
append(append(container, $('.profile-resource-options-container')), radio.domNode);
|
|
1258
|
+
const actionsContainer = append(container, $('.profile-resource-actions-container'));
|
|
893
1259
|
const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
|
|
894
1260
|
hoverDelegate: disposables.add(createInstantHoverDelegate()),
|
|
895
1261
|
highlightToggledItems: true
|
|
896
1262
|
}));
|
|
897
|
-
return { label,
|
|
1263
|
+
return { label, radio, actionBar, disposables, elementDisposables: disposables.add(( (new DisposableStore()))) };
|
|
898
1264
|
}
|
|
899
1265
|
renderElement({ element: profileResourceTreeElement }, index, templateData, height) {
|
|
900
1266
|
templateData.elementDisposables.clear();
|
|
@@ -902,39 +1268,65 @@ let NewProfileResourceTreeRenderer = class NewProfileResourceTreeRenderer extend
|
|
|
902
1268
|
if (!(root instanceof NewProfileElement)) {
|
|
903
1269
|
throw ( (new Error('NewProfileResourceTreeRenderer can only render new profile element')));
|
|
904
1270
|
}
|
|
905
|
-
if (!isProfileResourceTypeElement(element)) {
|
|
1271
|
+
if (isString(element) || !isProfileResourceTypeElement(element)) {
|
|
906
1272
|
throw ( (new Error('Invalid profile resource element')));
|
|
907
1273
|
}
|
|
908
|
-
|
|
909
|
-
|
|
1274
|
+
const resourceTypeTitle = this.getResourceTypeTitle(element.resourceType);
|
|
1275
|
+
templateData.label.textContent = resourceTypeTitle;
|
|
1276
|
+
const renderRadioItems = () => {
|
|
1277
|
+
const options = [{
|
|
1278
|
+
text: ( localize(10963, "Default")),
|
|
1279
|
+
tooltip: ( localize(10963, "Use {0} from the Default profile", resourceTypeTitle)),
|
|
1280
|
+
},
|
|
1281
|
+
{
|
|
1282
|
+
text: ( localize(10964, "None")),
|
|
1283
|
+
tooltip: ( localize(10965, "Create empty {0}", resourceTypeTitle))
|
|
1284
|
+
}];
|
|
910
1285
|
const copyFromName = root.getCopyFromName();
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
1286
|
+
const name = copyFromName === this.userDataProfilesService.defaultProfile.name
|
|
1287
|
+
? ( localize(10965, "{0} (Copy)", copyFromName))
|
|
1288
|
+
: copyFromName;
|
|
1289
|
+
if (root.copyFrom && name) {
|
|
1290
|
+
templateData.radio.setItems([
|
|
1291
|
+
{
|
|
1292
|
+
text: name,
|
|
1293
|
+
tooltip: name ? ( localize(10966, "Copy {0} from the {1} profile", resourceTypeTitle, name)) : ( localize(10967, "Copy")),
|
|
1294
|
+
},
|
|
1295
|
+
...options
|
|
1296
|
+
]);
|
|
1297
|
+
templateData.radio.setActiveItem(root.getCopyFlag(element.resourceType) ? 0 : root.getFlag(element.resourceType) ? 1 : 2);
|
|
1298
|
+
}
|
|
1299
|
+
else {
|
|
1300
|
+
templateData.radio.setItems(options);
|
|
1301
|
+
templateData.radio.setActiveItem(root.getFlag(element.resourceType) ? 0 : 1);
|
|
1302
|
+
}
|
|
1303
|
+
};
|
|
1304
|
+
if (root.copyFrom) {
|
|
1305
|
+
templateData.elementDisposables.add(templateData.radio.onDidSelect(index => {
|
|
1306
|
+
root.setFlag(element.resourceType, index === 1);
|
|
1307
|
+
root.setCopyFlag(element.resourceType, index === 0);
|
|
920
1308
|
}));
|
|
921
1309
|
}
|
|
922
1310
|
else {
|
|
923
|
-
templateData.
|
|
924
|
-
|
|
925
|
-
{ text: ( localizeWithPath(_moduleId, 33, "Use Default Profile")) }
|
|
926
|
-
]);
|
|
927
|
-
templateData.selectBox.select(root.getFlag(element.resourceType) ? 1 : 0);
|
|
928
|
-
templateData.elementDisposables.add(templateData.selectBox.onDidSelect(option => {
|
|
929
|
-
root.setFlag(element.resourceType, option.index === 1);
|
|
1311
|
+
templateData.elementDisposables.add(templateData.radio.onDidSelect(index => {
|
|
1312
|
+
root.setFlag(element.resourceType, index === 0);
|
|
930
1313
|
}));
|
|
931
1314
|
}
|
|
932
|
-
|
|
1315
|
+
renderRadioItems();
|
|
1316
|
+
templateData.radio.setEnabled(!root.disabled);
|
|
1317
|
+
templateData.elementDisposables.add(root.onDidChange(e => {
|
|
1318
|
+
if (e.disabled) {
|
|
1319
|
+
templateData.radio.setEnabled(!root.disabled);
|
|
1320
|
+
}
|
|
1321
|
+
if (e.copyFrom || e.copyFromInfo) {
|
|
1322
|
+
renderRadioItems();
|
|
1323
|
+
}
|
|
1324
|
+
}));
|
|
933
1325
|
templateData.actionBar.setActions(element.action ? [element.action] : []);
|
|
934
1326
|
}
|
|
935
1327
|
};
|
|
936
1328
|
NewProfileResourceTreeRenderer = NewProfileResourceTreeRenderer_1 = ( (__decorate([
|
|
937
|
-
( (__param(0,
|
|
1329
|
+
( (__param(0, IUserDataProfilesService))),
|
|
938
1330
|
( (__param(1, IInstantiationService)))
|
|
939
1331
|
], NewProfileResourceTreeRenderer)));
|
|
940
1332
|
let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRenderer extends AbstractProfileResourceTreeRenderer {
|
|
@@ -953,7 +1345,7 @@ let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRen
|
|
|
953
1345
|
const checkbox = disposables.add(( (new Checkbox('', false, defaultCheckboxStyles))));
|
|
954
1346
|
append(container, checkbox.domNode);
|
|
955
1347
|
const resourceLabel = disposables.add(this.labels.create(container, { hoverDelegate: this.hoverDelegate }));
|
|
956
|
-
const actionsContainer = append(container, $('.profile-
|
|
1348
|
+
const actionsContainer = append(container, $('.profile-resource-actions-container'));
|
|
957
1349
|
const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
|
|
958
1350
|
hoverDelegate: disposables.add(createInstantHoverDelegate()),
|
|
959
1351
|
highlightToggledItems: true
|
|
@@ -963,10 +1355,11 @@ let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRen
|
|
|
963
1355
|
renderElement({ element: profileResourceTreeElement }, index, templateData, height) {
|
|
964
1356
|
templateData.elementDisposables.clear();
|
|
965
1357
|
const { element } = profileResourceTreeElement;
|
|
966
|
-
if (!isProfileResourceChildElement(element)) {
|
|
1358
|
+
if (isString(element) || !isProfileResourceChildElement(element)) {
|
|
967
1359
|
throw ( (new Error('Invalid profile resource element')));
|
|
968
1360
|
}
|
|
969
1361
|
if (element.checkbox) {
|
|
1362
|
+
templateData.checkbox.domNode.setAttribute('tabindex', '0');
|
|
970
1363
|
templateData.checkbox.domNode.classList.remove('hide');
|
|
971
1364
|
templateData.checkbox.checked = element.checkbox.isChecked;
|
|
972
1365
|
templateData.checkbox.domNode.ariaLabel = element.checkbox.accessibilityInformation?.label ?? '';
|
|
@@ -975,6 +1368,7 @@ let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRen
|
|
|
975
1368
|
}
|
|
976
1369
|
}
|
|
977
1370
|
else {
|
|
1371
|
+
templateData.checkbox.domNode.removeAttribute('tabindex');
|
|
978
1372
|
templateData.checkbox.domNode.classList.add('hide');
|
|
979
1373
|
}
|
|
980
1374
|
templateData.resourceLabel.setResource({
|
|
@@ -1010,9 +1404,10 @@ let UserDataProfilesEditorInput = class UserDataProfilesEditorInput extends Edit
|
|
|
1010
1404
|
this._register(this.model.onDidChange(e => this.dirty = ( (this.model.profiles.some(profile => profile instanceof NewProfileElement)))));
|
|
1011
1405
|
}
|
|
1012
1406
|
get typeId() { return UserDataProfilesEditorInput_1.ID; }
|
|
1013
|
-
getName() { return (
|
|
1407
|
+
getName() { return ( localize(10968, "Profiles")); }
|
|
1014
1408
|
getIcon() { return defaultUserDataProfileIcon; }
|
|
1015
1409
|
async resolve() {
|
|
1410
|
+
await this.model.resolve();
|
|
1016
1411
|
return this.model;
|
|
1017
1412
|
}
|
|
1018
1413
|
isDirty() {
|