@codingame/monaco-vscode-user-data-profile-service-override 6.0.3 → 7.0.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/platform/userDataProfile/common/userDataProfileStorageService.js +41 -20
- package/vscode/src/vs/platform/userDataSync/common/extensionsSync.js +1 -1
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +193 -87
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +349 -253
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +452 -125
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +24 -6
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +190 -92
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +5 -1
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileStorageService.js +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import './media/userDataProfilesEditor.css.js';
|
|
3
3
|
import { append, $, Dimension, trackFocus, addDisposableListener, EventType, EventHelper } from 'vscode/vscode/vs/base/browser/dom';
|
|
4
|
-
import { SubmenuAction,
|
|
4
|
+
import { SubmenuAction, Separator, Action } from 'vscode/vscode/vs/base/common/actions';
|
|
5
5
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
6
6
|
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
7
7
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
@@ -31,8 +31,7 @@ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
|
31
31
|
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
32
32
|
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
33
33
|
import { PANEL_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
|
|
34
|
-
import {
|
|
35
|
-
import { ObjectTreeElementCollapseState } from 'vscode/vscode/vs/base/browser/ui/tree/tree';
|
|
34
|
+
import { WorkbenchList, WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
36
35
|
import { DisposableStore, Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
37
36
|
import { InputBox, MessageType } from 'vscode/vscode/vs/base/browser/ui/inputbox/inputBox';
|
|
38
37
|
import { Checkbox } from 'vscode/vscode/vs/base/browser/ui/toggle/toggle';
|
|
@@ -46,33 +45,28 @@ import { HoverPosition } from 'vscode/vscode/vs/base/browser/ui/hover/hoverWidge
|
|
|
46
45
|
import { SelectBox } from 'vscode/vscode/vs/base/browser/ui/selectBox/selectBox';
|
|
47
46
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
48
47
|
import { IEditorProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
|
|
49
|
-
import {
|
|
50
|
-
import { isString, isUndefined } from 'vscode/vscode/vs/base/common/types';
|
|
48
|
+
import { isUndefined } from 'vscode/vscode/vs/base/common/types';
|
|
51
49
|
import { basename } from 'vscode/vscode/vs/base/common/resources';
|
|
52
50
|
import { RenderIndentGuides } from 'vscode/vscode/vs/base/browser/ui/tree/abstractTree';
|
|
53
|
-
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
54
|
-
import { API_OPEN_EDITOR_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
|
|
55
|
-
import { SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
56
51
|
import { ResourceLabels, DEFAULT_LABELS_CONTAINER } from 'vscode/vscode/vs/workbench/browser/labels';
|
|
57
|
-
import {
|
|
52
|
+
import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
58
53
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
59
|
-
import { UserDataProfileElement, AbstractUserDataProfileElement, NewProfileElement, UserDataProfilesEditorModel } from './userDataProfilesEditorModel.js';
|
|
54
|
+
import { UserDataProfileElement, AbstractUserDataProfileElement, NewProfileElement, isProfileResourceTypeElement, isProfileResourceChildElement, UserDataProfilesEditorModel } from './userDataProfilesEditorModel.js';
|
|
60
55
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
61
56
|
import { WorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
|
|
62
57
|
import { createInstantHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
63
58
|
import { Orientation } from 'vscode/vscode/vs/base/browser/ui/sash/sash';
|
|
64
59
|
|
|
65
|
-
var UserDataProfilesEditor_1, NewProfileResourceTreeRenderer_1, ProfileResourceChildTreeItemRenderer_1, UserDataProfilesEditorInput_1;
|
|
60
|
+
var UserDataProfilesEditor_1, ExistingProfileResourceTreeRenderer_1, NewProfileResourceTreeRenderer_1, ProfileResourceChildTreeItemRenderer_1, UserDataProfilesEditorInput_1;
|
|
66
61
|
const _moduleId = "vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor";
|
|
67
|
-
const profilesSashBorder = registerColor('profiles.sashBorder',
|
|
62
|
+
const profilesSashBorder = registerColor('profiles.sashBorder', PANEL_BORDER, ( localizeWithPath(_moduleId, 0, "The color of the Profiles editor splitview sash border.")));
|
|
68
63
|
let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
69
64
|
static { UserDataProfilesEditor_1 = this; }
|
|
70
65
|
static { this.ID = 'workbench.editor.userDataProfiles'; }
|
|
71
|
-
constructor(group, telemetryService, themeService, storageService, userDataProfileManagementService, quickInputService,
|
|
66
|
+
constructor(group, telemetryService, themeService, storageService, userDataProfileManagementService, quickInputService, fileDialogService, contextMenuService, instantiationService) {
|
|
72
67
|
super(UserDataProfilesEditor_1.ID, group, telemetryService, themeService, storageService);
|
|
73
68
|
this.userDataProfileManagementService = userDataProfileManagementService;
|
|
74
69
|
this.quickInputService = quickInputService;
|
|
75
|
-
this.dialogService = dialogService;
|
|
76
70
|
this.fileDialogService = fileDialogService;
|
|
77
71
|
this.contextMenuService = contextMenuService;
|
|
78
72
|
this.instantiationService = instantiationService;
|
|
@@ -100,20 +94,21 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
100
94
|
this.splitView.addView({
|
|
101
95
|
onDidChange: Event.None,
|
|
102
96
|
element: sidebarView,
|
|
103
|
-
minimumSize:
|
|
97
|
+
minimumSize: 200,
|
|
104
98
|
maximumSize: 350,
|
|
105
99
|
layout: (width, _, height) => {
|
|
106
100
|
sidebarView.style.width = `${width}px`;
|
|
107
|
-
if (height && this.
|
|
108
|
-
|
|
109
|
-
this.
|
|
101
|
+
if (height && this.profilesList) {
|
|
102
|
+
const listHeight = height - 40 - 15 ;
|
|
103
|
+
this.profilesList.getHTMLElement().style.height = `${listHeight}px`;
|
|
104
|
+
this.profilesList.layout(listHeight, width);
|
|
110
105
|
}
|
|
111
106
|
}
|
|
112
107
|
}, 300, undefined, true);
|
|
113
108
|
this.splitView.addView({
|
|
114
109
|
onDidChange: Event.None,
|
|
115
110
|
element: contentsView,
|
|
116
|
-
minimumSize:
|
|
111
|
+
minimumSize: 550,
|
|
117
112
|
maximumSize: Number.POSITIVE_INFINITY,
|
|
118
113
|
layout: (width, _, height) => {
|
|
119
114
|
contentsView.style.width = `${width}px`;
|
|
@@ -122,32 +117,34 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
122
117
|
}
|
|
123
118
|
}
|
|
124
119
|
}, Sizing.Distribute, undefined, true);
|
|
125
|
-
const borderColor = this.theme.getColor(profilesSashBorder);
|
|
126
|
-
this.splitView.style({ separatorBorder: borderColor });
|
|
127
120
|
this.registerListeners();
|
|
121
|
+
this.updateStyles();
|
|
128
122
|
this.userDataProfileManagementService.getBuiltinProfileTemplates().then(templates => {
|
|
129
123
|
this.templates = templates;
|
|
130
124
|
this.profileWidget.templates = templates;
|
|
131
125
|
});
|
|
132
126
|
}
|
|
127
|
+
updateStyles() {
|
|
128
|
+
const borderColor = this.theme.getColor(profilesSashBorder);
|
|
129
|
+
this.splitView?.style({ separatorBorder: borderColor });
|
|
130
|
+
}
|
|
133
131
|
renderSidebar(parent) {
|
|
134
132
|
this.renderNewProfileButton(append(parent, $('.new-profile-button')));
|
|
135
|
-
const renderer = this.instantiationService.createInstance(
|
|
136
|
-
const delegate = ( (new
|
|
137
|
-
this.
|
|
133
|
+
const renderer = this.instantiationService.createInstance(ProfileElementRenderer);
|
|
134
|
+
const delegate = ( (new ProfileElementDelegate()));
|
|
135
|
+
this.profilesList = this._register(this.instantiationService.createInstance((WorkbenchList), 'ProfilesList', append(parent, $('.profiles-list')), delegate, [renderer], {
|
|
138
136
|
multipleSelectionSupport: false,
|
|
139
137
|
setRowLineHeight: false,
|
|
140
138
|
horizontalScrolling: false,
|
|
141
139
|
accessibilityProvider: {
|
|
142
|
-
getAriaLabel(
|
|
143
|
-
return
|
|
140
|
+
getAriaLabel(profileElement) {
|
|
141
|
+
return profileElement?.name ?? '';
|
|
144
142
|
},
|
|
145
143
|
getWidgetAriaLabel() {
|
|
146
144
|
return ( localizeWithPath(_moduleId, 1, "Profiles"));
|
|
147
145
|
}
|
|
148
146
|
},
|
|
149
147
|
openOnSingleClick: true,
|
|
150
|
-
enableStickyScroll: false,
|
|
151
148
|
identityProvider: {
|
|
152
149
|
getId(e) {
|
|
153
150
|
if (e instanceof UserDataProfileElement) {
|
|
@@ -164,11 +161,7 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
164
161
|
getActions: () => {
|
|
165
162
|
const actions = [];
|
|
166
163
|
if (this.templates.length) {
|
|
167
|
-
actions.push(( (new SubmenuAction('from.template', ( localizeWithPath(_moduleId, 2, "From Template")),
|
|
168
|
-
template => ( (new Action(`template:${template.url}`, template.name, undefined, true, async () => {
|
|
169
|
-
this.createNewProfile(( (URI.parse(template.url))));
|
|
170
|
-
})))
|
|
171
|
-
))))));
|
|
164
|
+
actions.push(( (new SubmenuAction('from.template', ( localizeWithPath(_moduleId, 2, "From Template")), this.getCreateFromTemplateActions()))));
|
|
172
165
|
actions.push(( (new Separator())));
|
|
173
166
|
}
|
|
174
167
|
actions.push(( (new Action('importProfile', ( localizeWithPath(_moduleId, 3, "Import Profile...")), undefined, true, () => this.importProfile()))));
|
|
@@ -180,27 +173,59 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
180
173
|
supportIcons: true,
|
|
181
174
|
...defaultButtonStyles
|
|
182
175
|
}))));
|
|
183
|
-
button.label =
|
|
176
|
+
button.label = ( localizeWithPath(_moduleId, 4, "New Profile"));
|
|
184
177
|
this._register(button.onDidClick(e => this.createNewProfile()));
|
|
185
178
|
}
|
|
179
|
+
getCreateFromTemplateActions() {
|
|
180
|
+
return (
|
|
181
|
+
(this.templates.map(
|
|
182
|
+
template => ( (new Action(`template:${template.url}`, template.name, undefined, true, async () => {
|
|
183
|
+
this.createNewProfile(( (URI.parse(template.url))));
|
|
184
|
+
})))
|
|
185
|
+
))
|
|
186
|
+
);
|
|
187
|
+
}
|
|
186
188
|
registerListeners() {
|
|
187
|
-
if (this.
|
|
188
|
-
this._register(this.
|
|
189
|
+
if (this.profilesList) {
|
|
190
|
+
this._register(this.profilesList.onDidChangeSelection(e => {
|
|
189
191
|
const [element] = e.elements;
|
|
190
192
|
if (element instanceof AbstractUserDataProfileElement) {
|
|
191
193
|
this.profileWidget?.render(element);
|
|
192
194
|
}
|
|
193
195
|
}));
|
|
194
|
-
this._register(this.
|
|
196
|
+
this._register(this.profilesList.onContextMenu(e => {
|
|
197
|
+
const actions = [];
|
|
198
|
+
if (!e.element) {
|
|
199
|
+
actions.push(...this.getTreeContextMenuActions());
|
|
200
|
+
}
|
|
195
201
|
if (e.element instanceof AbstractUserDataProfileElement) {
|
|
202
|
+
actions.push(...e.element.actions[1]);
|
|
203
|
+
}
|
|
204
|
+
if (actions.length) {
|
|
196
205
|
this.contextMenuService.showContextMenu({
|
|
197
206
|
getAnchor: () => e.anchor,
|
|
198
|
-
getActions: () =>
|
|
207
|
+
getActions: () => actions,
|
|
199
208
|
getActionsContext: () => e.element
|
|
200
209
|
});
|
|
201
210
|
}
|
|
202
211
|
}));
|
|
212
|
+
this._register(this.profilesList.onMouseDblClick(e => {
|
|
213
|
+
if (!e.element) {
|
|
214
|
+
this.createNewProfile();
|
|
215
|
+
}
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
getTreeContextMenuActions() {
|
|
220
|
+
const actions = [];
|
|
221
|
+
actions.push(( (new Action('newProfile', ( localizeWithPath(_moduleId, 4, "New Profile")), undefined, true, () => this.createNewProfile()))));
|
|
222
|
+
const templateActions = this.getCreateFromTemplateActions();
|
|
223
|
+
if (templateActions.length) {
|
|
224
|
+
actions.push(( (new SubmenuAction('from.template', ( localizeWithPath(_moduleId, 5, "New Profile From Template")), templateActions))));
|
|
203
225
|
}
|
|
226
|
+
actions.push(( (new Separator())));
|
|
227
|
+
actions.push(( (new Action('importProfile', ( localizeWithPath(_moduleId, 3, "Import Profile...")), undefined, true, () => this.importProfile()))));
|
|
228
|
+
return actions;
|
|
204
229
|
}
|
|
205
230
|
async importProfile() {
|
|
206
231
|
const disposables = ( (new DisposableStore()));
|
|
@@ -208,13 +233,13 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
208
233
|
const updateQuickPickItems = (value) => {
|
|
209
234
|
const quickPickItems = [];
|
|
210
235
|
if (value) {
|
|
211
|
-
quickPickItems.push({ label: quickPick.value, description: ( localizeWithPath(_moduleId,
|
|
236
|
+
quickPickItems.push({ label: quickPick.value, description: ( localizeWithPath(_moduleId, 6, "Import from URL")) });
|
|
212
237
|
}
|
|
213
|
-
quickPickItems.push({ label: ( localizeWithPath(_moduleId,
|
|
238
|
+
quickPickItems.push({ label: ( localizeWithPath(_moduleId, 7, "Select File...")) });
|
|
214
239
|
quickPick.items = quickPickItems;
|
|
215
240
|
};
|
|
216
|
-
quickPick.title = ( localizeWithPath(_moduleId,
|
|
217
|
-
quickPick.placeholder = ( localizeWithPath(_moduleId,
|
|
241
|
+
quickPick.title = ( localizeWithPath(_moduleId, 8, "Import from Profile Template..."));
|
|
242
|
+
quickPick.placeholder = ( localizeWithPath(_moduleId, 9, "Provide Profile Template URL"));
|
|
218
243
|
quickPick.ignoreFocusOut = true;
|
|
219
244
|
disposables.add(quickPick.onDidChangeValue(updateQuickPickItems));
|
|
220
245
|
updateQuickPickItems();
|
|
@@ -235,23 +260,7 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
235
260
|
quickPick.show();
|
|
236
261
|
}
|
|
237
262
|
async createNewProfile(copyFrom) {
|
|
238
|
-
|
|
239
|
-
const result = await this.dialogService.confirm({
|
|
240
|
-
type: 'info',
|
|
241
|
-
message: ( localizeWithPath(
|
|
242
|
-
_moduleId,
|
|
243
|
-
9,
|
|
244
|
-
"A new profile is already being created. Do you want to discard it and create a new one?"
|
|
245
|
-
)),
|
|
246
|
-
primaryButton: ( localizeWithPath(_moduleId, 10, "Discard & Create")),
|
|
247
|
-
cancelButton: ( localizeWithPath(_moduleId, 11, "Cancel"))
|
|
248
|
-
});
|
|
249
|
-
if (!result.confirmed) {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
this.model.revert();
|
|
253
|
-
}
|
|
254
|
-
this.model?.createNewProfile(copyFrom);
|
|
263
|
+
await this.model?.createNewProfile(copyFrom);
|
|
255
264
|
}
|
|
256
265
|
async getProfileUriFromFileSystem() {
|
|
257
266
|
const profileLocation = await this.fileDialogService.showOpenDialog({
|
|
@@ -259,7 +268,7 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
259
268
|
canSelectFiles: true,
|
|
260
269
|
canSelectMany: false,
|
|
261
270
|
filters: PROFILE_FILTER,
|
|
262
|
-
title: ( localizeWithPath(_moduleId,
|
|
271
|
+
title: ( localizeWithPath(_moduleId, 10, "Select Profile Template File")),
|
|
263
272
|
});
|
|
264
273
|
if (!profileLocation) {
|
|
265
274
|
return null;
|
|
@@ -269,46 +278,37 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
|
|
|
269
278
|
async setInput(input, options, context, token) {
|
|
270
279
|
await super.setInput(input, options, context, token);
|
|
271
280
|
this.model = await input.resolve();
|
|
272
|
-
this.
|
|
281
|
+
this.updateProfilesList();
|
|
273
282
|
this._register(this.model.onDidChange((element) => {
|
|
274
|
-
this.
|
|
283
|
+
this.updateProfilesList(element);
|
|
275
284
|
}));
|
|
276
285
|
}
|
|
277
286
|
focus() {
|
|
278
287
|
super.focus();
|
|
279
|
-
this.
|
|
288
|
+
this.profilesList?.domFocus();
|
|
280
289
|
}
|
|
281
|
-
|
|
290
|
+
updateProfilesList(elementToSelect) {
|
|
282
291
|
if (!this.model) {
|
|
283
292
|
return;
|
|
284
293
|
}
|
|
285
|
-
const
|
|
286
|
-
const currentSelection = this.
|
|
287
|
-
this.
|
|
288
|
-
{
|
|
289
|
-
element: { name: ( localizeWithPath(_moduleId, 1, "Profiles")) },
|
|
290
|
-
children: profileElements,
|
|
291
|
-
collapsible: false,
|
|
292
|
-
collapsed: ObjectTreeElementCollapseState.Expanded
|
|
293
|
-
}
|
|
294
|
-
]);
|
|
294
|
+
const currentSelectionIndex = this.profilesList?.getSelection()?.[0];
|
|
295
|
+
const currentSelection = currentSelectionIndex !== undefined ? this.profilesList?.element(currentSelectionIndex) : undefined;
|
|
296
|
+
this.profilesList?.splice(0, this.profilesList.length, this.model.profiles);
|
|
295
297
|
if (elementToSelect) {
|
|
296
|
-
this.
|
|
298
|
+
this.profilesList?.setSelection([this.model.profiles.indexOf(elementToSelect)]);
|
|
297
299
|
}
|
|
298
300
|
else if (currentSelection) {
|
|
299
|
-
if (currentSelection
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
this.profilesTree?.setSelection([elementToSelect]);
|
|
304
|
-
}
|
|
301
|
+
if (!this.model.profiles.includes(currentSelection)) {
|
|
302
|
+
const elementToSelect = this.model.profiles.find(profile => profile.name === currentSelection.name) ?? this.model.profiles[0];
|
|
303
|
+
if (elementToSelect) {
|
|
304
|
+
this.profilesList?.setSelection([this.model.profiles.indexOf(elementToSelect)]);
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
else {
|
|
309
309
|
const elementToSelect = this.model.profiles.find(profile => profile.active) ?? this.model.profiles[0];
|
|
310
310
|
if (elementToSelect) {
|
|
311
|
-
this.
|
|
311
|
+
this.profilesList?.setSelection([this.model.profiles.indexOf(elementToSelect)]);
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
}
|
|
@@ -319,42 +319,45 @@ UserDataProfilesEditor = UserDataProfilesEditor_1 = ( (__decorate([
|
|
|
319
319
|
( (__param(3, IStorageService))),
|
|
320
320
|
( (__param(4, IUserDataProfileManagementService))),
|
|
321
321
|
( (__param(5, IQuickInputService))),
|
|
322
|
-
( (__param(6,
|
|
323
|
-
( (__param(7,
|
|
324
|
-
( (__param(8,
|
|
325
|
-
( (__param(9, IInstantiationService)))
|
|
322
|
+
( (__param(6, IFileDialogService))),
|
|
323
|
+
( (__param(7, IContextMenuService))),
|
|
324
|
+
( (__param(8, IInstantiationService)))
|
|
326
325
|
], UserDataProfilesEditor)));
|
|
327
|
-
class
|
|
326
|
+
class ProfileElementDelegate {
|
|
328
327
|
getHeight(element) {
|
|
329
|
-
return
|
|
328
|
+
return 22;
|
|
330
329
|
}
|
|
331
|
-
getTemplateId() { return '
|
|
330
|
+
getTemplateId() { return 'profileListElement'; }
|
|
332
331
|
}
|
|
333
|
-
class
|
|
334
|
-
constructor() {
|
|
335
|
-
this.
|
|
332
|
+
let ProfileElementRenderer = class ProfileElementRenderer {
|
|
333
|
+
constructor(instantiationService) {
|
|
334
|
+
this.instantiationService = instantiationService;
|
|
335
|
+
this.templateId = 'profileListElement';
|
|
336
336
|
}
|
|
337
337
|
renderTemplate(container) {
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
const
|
|
338
|
+
const disposables = ( (new DisposableStore()));
|
|
339
|
+
const elementDisposables = ( (new DisposableStore()));
|
|
340
|
+
container.classList.add('profile-list-item');
|
|
341
|
+
const icon = append(container, $('.profile-list-item-icon'));
|
|
342
|
+
const label = append(container, $('.profile-list-item-label'));
|
|
343
|
+
const description = append(container, $('.profile-list-item-description'));
|
|
342
344
|
append(description, $(`span${ThemeIcon.asCSSSelector(Codicon.check)}`));
|
|
343
|
-
append(description, $('span', undefined, ( localizeWithPath(_moduleId,
|
|
344
|
-
|
|
345
|
+
append(description, $('span', undefined, ( localizeWithPath(_moduleId, 11, "In use"))));
|
|
346
|
+
const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
|
|
347
|
+
const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
|
|
348
|
+
hoverDelegate: disposables.add(createInstantHoverDelegate()),
|
|
349
|
+
highlightToggledItems: true
|
|
350
|
+
}));
|
|
351
|
+
return { label, icon, description, actionBar, disposables, elementDisposables };
|
|
345
352
|
}
|
|
346
|
-
renderElement(
|
|
347
|
-
templateData.
|
|
353
|
+
renderElement(element, index, templateData, height) {
|
|
354
|
+
templateData.elementDisposables.clear();
|
|
348
355
|
templateData.label.textContent = element.name;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
else {
|
|
353
|
-
templateData.icon.className = 'hide';
|
|
354
|
-
}
|
|
356
|
+
templateData.label.classList.toggle('new-profile', element instanceof NewProfileElement);
|
|
357
|
+
templateData.icon.className = ThemeIcon.asClassName(element.icon ? ThemeIcon.fromId(element.icon) : DEFAULT_ICON);
|
|
355
358
|
templateData.description.classList.toggle('hide', !element.active);
|
|
356
359
|
if (element.onDidChange) {
|
|
357
|
-
templateData.
|
|
360
|
+
templateData.elementDisposables.add(element.onDidChange(e => {
|
|
358
361
|
if (e.name) {
|
|
359
362
|
templateData.label.textContent = element.name;
|
|
360
363
|
}
|
|
@@ -371,56 +374,59 @@ class ProfileTreeElementRenderer {
|
|
|
371
374
|
}
|
|
372
375
|
}));
|
|
373
376
|
}
|
|
377
|
+
templateData.actionBar.setActions(element.actions[0] ?? []);
|
|
378
|
+
}
|
|
379
|
+
disposeElement(element, index, templateData, height) {
|
|
380
|
+
templateData.elementDisposables.clear();
|
|
374
381
|
}
|
|
375
382
|
disposeTemplate(templateData) {
|
|
376
383
|
templateData.disposables.dispose();
|
|
384
|
+
templateData.elementDisposables.dispose();
|
|
377
385
|
}
|
|
378
|
-
}
|
|
386
|
+
};
|
|
387
|
+
ProfileElementRenderer = ( (__decorate([
|
|
388
|
+
( (__param(0, IInstantiationService)))
|
|
389
|
+
], ProfileElementRenderer)));
|
|
379
390
|
let ProfileWidget = class ProfileWidget extends Disposable {
|
|
380
391
|
set templates(templates) {
|
|
381
392
|
this._templates = templates;
|
|
382
393
|
this.renderSelectBox();
|
|
383
394
|
}
|
|
384
|
-
constructor(parent, hoverService, userDataProfilesService, contextViewService, editorProgressService,
|
|
395
|
+
constructor(parent, hoverService, userDataProfilesService, contextViewService, editorProgressService, instantiationService) {
|
|
385
396
|
super();
|
|
386
397
|
this.hoverService = hoverService;
|
|
387
398
|
this.userDataProfilesService = userDataProfilesService;
|
|
388
399
|
this.contextViewService = contextViewService;
|
|
389
400
|
this.editorProgressService = editorProgressService;
|
|
390
|
-
this.commandService = commandService;
|
|
391
401
|
this.instantiationService = instantiationService;
|
|
392
402
|
this.copyFromOptions = [];
|
|
393
403
|
this._templates = [];
|
|
394
404
|
this._profileElement = this._register(( (new MutableDisposable())));
|
|
395
405
|
const header = append(parent, $('.profile-header'));
|
|
396
|
-
const title = append(header, $('.profile-title'));
|
|
397
|
-
append(title, $('
|
|
398
|
-
this.profileTitle = append(title, $('span'));
|
|
399
|
-
const actionsContainer = append(header, $('.profile-actions-container'));
|
|
400
|
-
this.buttonContainer = append(actionsContainer, $('.profile-button-container'));
|
|
401
|
-
this.toolbar = this._register(instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
|
|
402
|
-
hoverDelegate: this._register(createInstantHoverDelegate()),
|
|
403
|
-
}));
|
|
404
|
-
const body = append(parent, $('.profile-body'));
|
|
405
|
-
this.nameContainer = append(body, $('.profile-name-container'));
|
|
406
|
-
this.iconElement = append(this.nameContainer, $(`${ThemeIcon.asCSSSelector(DEFAULT_ICON)}`, { 'tabindex': '0', 'role': 'button', 'aria-label': ( localizeWithPath(_moduleId, 15, "Profile Icon")) }));
|
|
406
|
+
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")) }));
|
|
407
408
|
this.renderIconSelectBox(this.iconElement);
|
|
408
|
-
this.
|
|
409
|
+
this.profileTitle = append(title, $(''));
|
|
410
|
+
this.nameInput = this._register(( (new InputBox(title, undefined, {
|
|
409
411
|
inputBoxStyles: defaultInputBoxStyles,
|
|
410
|
-
ariaLabel: ( localizeWithPath(_moduleId,
|
|
411
|
-
placeholder: ( localizeWithPath(_moduleId,
|
|
412
|
+
ariaLabel: ( localizeWithPath(_moduleId, 13, "Profile Name")),
|
|
413
|
+
placeholder: ( localizeWithPath(_moduleId, 13, "Profile Name")),
|
|
412
414
|
validationOptions: {
|
|
413
415
|
validation: (value) => {
|
|
414
416
|
if (!value) {
|
|
415
417
|
return {
|
|
416
|
-
content: ( localizeWithPath(_moduleId,
|
|
418
|
+
content: ( localizeWithPath(_moduleId, 14, "Profile name is required and must be a non-empty value.")),
|
|
417
419
|
type: MessageType.ERROR
|
|
418
420
|
};
|
|
419
421
|
}
|
|
420
|
-
|
|
422
|
+
if (this._profileElement.value?.element.disabled) {
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
const initialName = this._profileElement.value?.element.getInitialName();
|
|
426
|
+
value = value.trim();
|
|
421
427
|
if (initialName !== value && ( (this.userDataProfilesService.profiles.some(p => p.name === value)))) {
|
|
422
428
|
return {
|
|
423
|
-
content: ( localizeWithPath(_moduleId,
|
|
429
|
+
content: ( localizeWithPath(_moduleId, 15, "Profile with name {0} already exists.", value)),
|
|
424
430
|
type: MessageType.ERROR
|
|
425
431
|
};
|
|
426
432
|
}
|
|
@@ -439,15 +445,38 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
439
445
|
this.nameInput.value = this._profileElement.value.element.name;
|
|
440
446
|
}
|
|
441
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
|
+
const body = append(parent, $('.profile-body'));
|
|
442
455
|
this.copyFromContainer = append(body, $('.profile-copy-from-container'));
|
|
443
|
-
append(this.copyFromContainer, $('.profile-copy-from-label', undefined, ( localizeWithPath(_moduleId,
|
|
456
|
+
append(this.copyFromContainer, $('.profile-copy-from-label', undefined, ( localizeWithPath(_moduleId, 16, "Copy from"))));
|
|
444
457
|
this.copyFromSelectBox = this._register(this.instantiationService.createInstance(SelectBox, [], 0, this.contextViewService, defaultSelectBoxStyles, {
|
|
445
458
|
useCustomDrawn: true,
|
|
446
|
-
ariaLabel: ( localizeWithPath(_moduleId,
|
|
459
|
+
ariaLabel: ( localizeWithPath(_moduleId, 17, "Copy profile from")),
|
|
447
460
|
}));
|
|
448
461
|
this.copyFromSelectBox.render(append(this.copyFromContainer, $('.profile-select-container')));
|
|
449
|
-
|
|
450
|
-
|
|
462
|
+
this.useAsDefaultProfileContainer = append(body, $('.profile-use-as-default-container'));
|
|
463
|
+
const useAsDefaultProfileTitle = ( localizeWithPath(_moduleId, 18, "Use this profile as default for new windows"));
|
|
464
|
+
this.useAsDefaultProfileCheckbox = this._register(( (new Checkbox(useAsDefaultProfileTitle, false, defaultCheckboxStyles))));
|
|
465
|
+
append(this.useAsDefaultProfileContainer, this.useAsDefaultProfileCheckbox.domNode);
|
|
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"))));
|
|
451
480
|
const delegate = ( (new ProfileResourceTreeElementDelegate()));
|
|
452
481
|
this.resourcesTree = this._register(this.instantiationService.createInstance((WorkbenchAsyncDataTree), 'ProfileEditor-ResourcesTree', append(body, $('.profile-content-tree.file-icon-themable-tree.show-file-icons')), delegate, [
|
|
453
482
|
this.instantiationService.createInstance(ExistingProfileResourceTreeRenderer),
|
|
@@ -458,11 +487,11 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
458
487
|
horizontalScrolling: false,
|
|
459
488
|
accessibilityProvider: {
|
|
460
489
|
getAriaLabel(element) {
|
|
461
|
-
if (
|
|
462
|
-
return element.
|
|
490
|
+
if ((element?.element).resourceType) {
|
|
491
|
+
return (element?.element).resourceType;
|
|
463
492
|
}
|
|
464
|
-
if (element?.element) {
|
|
465
|
-
return element
|
|
493
|
+
if ((element?.element).label) {
|
|
494
|
+
return (element?.element).label;
|
|
466
495
|
}
|
|
467
496
|
return '';
|
|
468
497
|
},
|
|
@@ -472,10 +501,7 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
472
501
|
},
|
|
473
502
|
identityProvider: {
|
|
474
503
|
getId(element) {
|
|
475
|
-
if (
|
|
476
|
-
return element.element;
|
|
477
|
-
}
|
|
478
|
-
if (element?.element) {
|
|
504
|
+
if (element?.element.handle) {
|
|
479
505
|
return element.element.handle;
|
|
480
506
|
}
|
|
481
507
|
return '';
|
|
@@ -483,8 +509,8 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
483
509
|
},
|
|
484
510
|
expandOnlyOnTwistieClick: true,
|
|
485
511
|
renderIndentGuides: RenderIndentGuides.None,
|
|
486
|
-
openOnSingleClick: true,
|
|
487
512
|
enableStickyScroll: false,
|
|
513
|
+
openOnSingleClick: false,
|
|
488
514
|
}));
|
|
489
515
|
this._register(this.resourcesTree.onDidOpen(async (e) => {
|
|
490
516
|
if (!e.browserEvent) {
|
|
@@ -493,13 +519,8 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
493
519
|
if (e.browserEvent.target && e.browserEvent.target.classList.contains(Checkbox.CLASS_NAME)) {
|
|
494
520
|
return;
|
|
495
521
|
}
|
|
496
|
-
if (e.element
|
|
497
|
-
|
|
498
|
-
await this.commandService.executeCommand(API_OPEN_EDITOR_COMMAND_ID, e.element.element.resourceUri, [SIDE_GROUP], undefined, e);
|
|
499
|
-
}
|
|
500
|
-
else if (e.element.element.parent instanceof ExtensionsResourceTreeItem) {
|
|
501
|
-
await this.commandService.executeCommand('extension.open', e.element.element.handle, undefined, true, undefined, true);
|
|
502
|
-
}
|
|
522
|
+
if (e.element?.element.action) {
|
|
523
|
+
await e.element.element.action.run();
|
|
503
524
|
}
|
|
504
525
|
}));
|
|
505
526
|
}
|
|
@@ -510,6 +531,9 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
510
531
|
if (this._profileElement.value?.element instanceof UserDataProfileElement && this._profileElement.value.element.profile.isDefault) {
|
|
511
532
|
return;
|
|
512
533
|
}
|
|
534
|
+
if (this._profileElement.value?.element.disabled) {
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
513
537
|
iconSelectBox.clearInput();
|
|
514
538
|
hoverWidget = this.hoverService.showHover({
|
|
515
539
|
content: iconSelectBox.domNode,
|
|
@@ -557,19 +581,7 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
557
581
|
}));
|
|
558
582
|
}
|
|
559
583
|
renderSelectBox() {
|
|
560
|
-
|
|
561
|
-
this.copyFromOptions.push({ text: ( localizeWithPath(_moduleId, 22, "None")) });
|
|
562
|
-
if (this._templates.length) {
|
|
563
|
-
this.copyFromOptions.push({ ...separator, decoratorRight: ( localizeWithPath(_moduleId, 23, "Profile Templates")) });
|
|
564
|
-
for (const template of this._templates) {
|
|
565
|
-
this.copyFromOptions.push({ text: template.name, id: template.url, source: ( (URI.parse(template.url))) });
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
this.copyFromOptions.push({ ...separator, decoratorRight: ( localizeWithPath(_moduleId, 24, "Existing Profiles")) });
|
|
569
|
-
for (const profile of this.userDataProfilesService.profiles) {
|
|
570
|
-
this.copyFromOptions.push({ text: profile.name, id: profile.id, source: profile });
|
|
571
|
-
}
|
|
572
|
-
this.copyFromSelectBox.setOptions(this.copyFromOptions);
|
|
584
|
+
this.copyFromSelectBox.setOptions(this.getCopyFromOptions());
|
|
573
585
|
this._register(this.copyFromSelectBox.onDidSelect(option => {
|
|
574
586
|
if (this._profileElement.value?.element instanceof NewProfileElement) {
|
|
575
587
|
this._profileElement.value.element.copyFrom = this.copyFromOptions[option.index].source;
|
|
@@ -580,15 +592,18 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
580
592
|
this.resourcesTree.layout(dimension.height - 34 - 20 - 25 - 20, dimension.width);
|
|
581
593
|
}
|
|
582
594
|
render(profileElement) {
|
|
595
|
+
this.resourcesTree.setInput(profileElement);
|
|
583
596
|
const disposables = ( (new DisposableStore()));
|
|
584
597
|
this._profileElement.value = { element: profileElement, dispose: () => disposables.dispose() };
|
|
585
598
|
this.renderProfileElement(profileElement);
|
|
586
599
|
disposables.add(profileElement.onDidChange(e => this.renderProfileElement(profileElement)));
|
|
587
600
|
const profile = profileElement instanceof UserDataProfileElement ? profileElement.profile : undefined;
|
|
588
|
-
this.
|
|
589
|
-
this.
|
|
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');
|
|
590
605
|
disposables.add(profileElement.onDidChange(e => {
|
|
591
|
-
if (e.flags || e.copyFrom) {
|
|
606
|
+
if (e.flags || e.copyFrom || e.copyFlags || e.disabled) {
|
|
592
607
|
const viewState = this.resourcesTree.getViewState();
|
|
593
608
|
this.resourcesTree.setInput(profileElement, {
|
|
594
609
|
...viewState,
|
|
@@ -596,39 +611,66 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
596
611
|
});
|
|
597
612
|
}
|
|
598
613
|
}));
|
|
599
|
-
|
|
614
|
+
const [primaryTitleButtons, secondatyTitleButtons] = profileElement.titleButtons;
|
|
615
|
+
if (primaryTitleButtons?.length || secondatyTitleButtons?.length) {
|
|
600
616
|
this.buttonContainer.classList.remove('hide');
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
617
|
+
if (secondatyTitleButtons?.length) {
|
|
618
|
+
for (const action of secondatyTitleButtons) {
|
|
619
|
+
const button = disposables.add(( (new Button(this.buttonContainer, {
|
|
620
|
+
...defaultButtonStyles,
|
|
621
|
+
secondary: true
|
|
622
|
+
}))));
|
|
623
|
+
button.label = action.label;
|
|
624
|
+
button.enabled = action.enabled;
|
|
625
|
+
disposables.add(button.onDidClick(() => this.editorProgressService.showWhile(action.run())));
|
|
626
|
+
disposables.add(action.onDidChange((e) => {
|
|
627
|
+
if (!isUndefined(e.enabled)) {
|
|
628
|
+
button.enabled = action.enabled;
|
|
629
|
+
}
|
|
630
|
+
}));
|
|
611
631
|
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
button.
|
|
616
|
-
|
|
632
|
+
}
|
|
633
|
+
if (primaryTitleButtons?.length) {
|
|
634
|
+
for (const action of primaryTitleButtons) {
|
|
635
|
+
const button = disposables.add(( (new Button(this.buttonContainer, {
|
|
636
|
+
...defaultButtonStyles
|
|
637
|
+
}))));
|
|
638
|
+
button.label = action.label;
|
|
639
|
+
button.enabled = action.enabled;
|
|
640
|
+
disposables.add(button.onDidClick(() => this.editorProgressService.showWhile(action.run())));
|
|
641
|
+
disposables.add(action.onDidChange((e) => {
|
|
642
|
+
if (!isUndefined(e.enabled)) {
|
|
643
|
+
button.enabled = action.enabled;
|
|
644
|
+
}
|
|
645
|
+
}));
|
|
646
|
+
disposables.add(profileElement.onDidChange(e => {
|
|
647
|
+
if (e.message) {
|
|
648
|
+
button.setTitle(profileElement.message ?? action.label);
|
|
649
|
+
button.element.classList.toggle('error', !!profileElement.message);
|
|
650
|
+
}
|
|
651
|
+
}));
|
|
617
652
|
}
|
|
618
|
-
}
|
|
653
|
+
}
|
|
619
654
|
}
|
|
620
655
|
else {
|
|
621
656
|
this.buttonContainer.classList.add('hide');
|
|
622
657
|
}
|
|
623
658
|
this.toolbar.setActions(profileElement.titleActions[0].slice(0), profileElement.titleActions[1].slice(0));
|
|
624
|
-
this.nameInput.focus();
|
|
625
659
|
if (profileElement instanceof NewProfileElement) {
|
|
660
|
+
this.nameInput.focus();
|
|
626
661
|
this.nameInput.select();
|
|
627
662
|
}
|
|
628
663
|
}
|
|
629
664
|
renderProfileElement(profileElement) {
|
|
630
665
|
this.profileTitle.textContent = profileElement.name;
|
|
631
666
|
this.nameInput.value = profileElement.name;
|
|
667
|
+
this.nameInput.validate();
|
|
668
|
+
if (profileElement.disabled) {
|
|
669
|
+
this.nameInput.disable();
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
this.nameInput.enable();
|
|
673
|
+
}
|
|
632
674
|
if (profileElement.icon) {
|
|
633
675
|
this.iconElement.className = ThemeIcon.asClassName(ThemeIcon.fromId(profileElement.icon));
|
|
634
676
|
}
|
|
@@ -636,14 +678,18 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
636
678
|
this.iconElement.className = ThemeIcon.asClassName(ThemeIcon.fromId(DEFAULT_ICON.id));
|
|
637
679
|
}
|
|
638
680
|
if (profileElement instanceof NewProfileElement) {
|
|
681
|
+
this.contentsTreeHeader.classList.add('new-profile');
|
|
682
|
+
this.inheritLabelElement.textContent = ( localizeWithPath(_moduleId, 21, "Options"));
|
|
683
|
+
this.useAsDefaultProfileContainer.classList.add('hide');
|
|
639
684
|
this.copyFromContainer.classList.remove('hide');
|
|
685
|
+
this.copyFromOptions = this.getCopyFromOptions();
|
|
640
686
|
const id = profileElement.copyFrom instanceof URI ? ( (profileElement.copyFrom.toString())) : profileElement.copyFrom?.id;
|
|
641
687
|
const index = id
|
|
642
688
|
? this.copyFromOptions.findIndex(option => option.id === id)
|
|
643
689
|
: 0;
|
|
644
690
|
if (index !== -1) {
|
|
645
691
|
this.copyFromSelectBox.setOptions(this.copyFromOptions);
|
|
646
|
-
this.copyFromSelectBox.setEnabled(
|
|
692
|
+
this.copyFromSelectBox.setEnabled(!profileElement.previewProfile && !profileElement.disabled);
|
|
647
693
|
this.copyFromSelectBox.select(index);
|
|
648
694
|
}
|
|
649
695
|
else {
|
|
@@ -651,22 +697,41 @@ let ProfileWidget = class ProfileWidget extends Disposable {
|
|
|
651
697
|
this.copyFromSelectBox.setEnabled(false);
|
|
652
698
|
}
|
|
653
699
|
}
|
|
654
|
-
else {
|
|
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;
|
|
655
705
|
this.copyFromContainer.classList.add('hide');
|
|
656
706
|
}
|
|
657
707
|
}
|
|
708
|
+
getCopyFromOptions() {
|
|
709
|
+
const separator = { text: '\u2500\u2500\u2500\u2500\u2500\u2500', isDisabled: true };
|
|
710
|
+
const copyFromOptions = [];
|
|
711
|
+
copyFromOptions.push({ text: ( localizeWithPath(_moduleId, 22, "None")) });
|
|
712
|
+
if (this._templates.length) {
|
|
713
|
+
copyFromOptions.push({ ...separator, decoratorRight: ( localizeWithPath(_moduleId, 23, "Profile Templates")) });
|
|
714
|
+
for (const template of this._templates) {
|
|
715
|
+
copyFromOptions.push({ text: template.name, id: template.url, source: ( (URI.parse(template.url))) });
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
copyFromOptions.push({ ...separator, decoratorRight: ( localizeWithPath(_moduleId, 24, "Existing Profiles")) });
|
|
719
|
+
for (const profile of this.userDataProfilesService.profiles) {
|
|
720
|
+
copyFromOptions.push({ text: profile.name, id: profile.id, source: profile });
|
|
721
|
+
}
|
|
722
|
+
return copyFromOptions;
|
|
723
|
+
}
|
|
658
724
|
};
|
|
659
725
|
ProfileWidget = ( (__decorate([
|
|
660
726
|
( (__param(1, IHoverService))),
|
|
661
727
|
( (__param(2, IUserDataProfilesService))),
|
|
662
728
|
( (__param(3, IContextViewService))),
|
|
663
729
|
( (__param(4, IEditorProgressService))),
|
|
664
|
-
( (__param(5,
|
|
665
|
-
( (__param(6, IInstantiationService)))
|
|
730
|
+
( (__param(5, IInstantiationService)))
|
|
666
731
|
], ProfileWidget)));
|
|
667
732
|
class ProfileResourceTreeElementDelegate {
|
|
668
733
|
getTemplateId(element) {
|
|
669
|
-
if (!
|
|
734
|
+
if (!element.element.resourceType) {
|
|
670
735
|
return ProfileResourceChildTreeItemRenderer.TEMPLATE_ID;
|
|
671
736
|
}
|
|
672
737
|
if (element.root instanceof NewProfileElement) {
|
|
@@ -675,7 +740,7 @@ class ProfileResourceTreeElementDelegate {
|
|
|
675
740
|
return ExistingProfileResourceTreeRenderer.TEMPLATE_ID;
|
|
676
741
|
}
|
|
677
742
|
getHeight(element) {
|
|
678
|
-
return
|
|
743
|
+
return 22;
|
|
679
744
|
}
|
|
680
745
|
}
|
|
681
746
|
let ProfileResourceTreeDataSource = class ProfileResourceTreeDataSource {
|
|
@@ -686,12 +751,24 @@ let ProfileResourceTreeDataSource = class ProfileResourceTreeDataSource {
|
|
|
686
751
|
if (element instanceof AbstractUserDataProfileElement) {
|
|
687
752
|
return true;
|
|
688
753
|
}
|
|
689
|
-
if (
|
|
690
|
-
if (element.
|
|
754
|
+
if (element.element.resourceType) {
|
|
755
|
+
if (element.element.resourceType !== ProfileResourceType.Extensions && element.element.resourceType !== ProfileResourceType.Snippets) {
|
|
691
756
|
return false;
|
|
692
757
|
}
|
|
693
758
|
if (element.root instanceof NewProfileElement) {
|
|
694
|
-
|
|
759
|
+
const resourceType = element.element.resourceType;
|
|
760
|
+
if (element.root.getFlag(resourceType)) {
|
|
761
|
+
return true;
|
|
762
|
+
}
|
|
763
|
+
if (!element.root.hasResource(resourceType)) {
|
|
764
|
+
return false;
|
|
765
|
+
}
|
|
766
|
+
if (element.root.copyFrom === undefined) {
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
if (!element.root.getCopyFlag(resourceType)) {
|
|
770
|
+
return false;
|
|
771
|
+
}
|
|
695
772
|
}
|
|
696
773
|
return true;
|
|
697
774
|
}
|
|
@@ -699,23 +776,17 @@ let ProfileResourceTreeDataSource = class ProfileResourceTreeDataSource {
|
|
|
699
776
|
}
|
|
700
777
|
async getChildren(element) {
|
|
701
778
|
if (element instanceof AbstractUserDataProfileElement) {
|
|
702
|
-
const
|
|
703
|
-
ProfileResourceType.Settings,
|
|
704
|
-
ProfileResourceType.Keybindings,
|
|
705
|
-
ProfileResourceType.Snippets,
|
|
706
|
-
ProfileResourceType.Tasks,
|
|
707
|
-
ProfileResourceType.Extensions
|
|
708
|
-
];
|
|
779
|
+
const children = await element.getChildren();
|
|
709
780
|
return (
|
|
710
|
-
(
|
|
781
|
+
(children.map(e => ({ element: e, root: element })))
|
|
711
782
|
);
|
|
712
783
|
}
|
|
713
|
-
if (
|
|
714
|
-
const progressRunner = this.editorProgressService.show(true);
|
|
784
|
+
if (element.element.resourceType) {
|
|
785
|
+
const progressRunner = this.editorProgressService.show(true, 500);
|
|
715
786
|
try {
|
|
716
|
-
const extensions = await element.root.getChildren(element.element);
|
|
787
|
+
const extensions = await element.root.getChildren(element.element.resourceType);
|
|
717
788
|
return (
|
|
718
|
-
(extensions.map(
|
|
789
|
+
(extensions.map(e => ({ element: e, root: element.root })))
|
|
719
790
|
);
|
|
720
791
|
}
|
|
721
792
|
finally {
|
|
@@ -751,20 +822,27 @@ class AbstractProfileResourceTreeRenderer extends Disposable {
|
|
|
751
822
|
templateData.disposables.dispose();
|
|
752
823
|
}
|
|
753
824
|
}
|
|
754
|
-
class ExistingProfileResourceTreeRenderer extends AbstractProfileResourceTreeRenderer {
|
|
755
|
-
|
|
756
|
-
super(...arguments);
|
|
757
|
-
this.templateId = ExistingProfileResourceTreeRenderer.TEMPLATE_ID;
|
|
758
|
-
}
|
|
825
|
+
let ExistingProfileResourceTreeRenderer = class ExistingProfileResourceTreeRenderer extends AbstractProfileResourceTreeRenderer {
|
|
826
|
+
static { ExistingProfileResourceTreeRenderer_1 = this; }
|
|
759
827
|
static { this.TEMPLATE_ID = 'ExistingProfileResourceTemplate'; }
|
|
828
|
+
constructor(instantiationService) {
|
|
829
|
+
super();
|
|
830
|
+
this.instantiationService = instantiationService;
|
|
831
|
+
this.templateId = ExistingProfileResourceTreeRenderer_1.TEMPLATE_ID;
|
|
832
|
+
}
|
|
760
833
|
renderTemplate(parent) {
|
|
761
834
|
const disposables = ( (new DisposableStore()));
|
|
762
835
|
const container = append(parent, $('.profile-tree-item-container.existing-profile-resource-type-container'));
|
|
763
|
-
const checkbox = disposables.add(( (new Checkbox('', false, defaultCheckboxStyles))));
|
|
764
|
-
append(container, checkbox.domNode);
|
|
765
836
|
const label = append(container, $('.profile-resource-type-label'));
|
|
766
|
-
const
|
|
767
|
-
|
|
837
|
+
const inheritContainer = append(container, $('.inherit-container'));
|
|
838
|
+
const checkbox = disposables.add(( (new Checkbox('', false, defaultCheckboxStyles))));
|
|
839
|
+
append(inheritContainer, checkbox.domNode);
|
|
840
|
+
const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
|
|
841
|
+
const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
|
|
842
|
+
hoverDelegate: disposables.add(createInstantHoverDelegate()),
|
|
843
|
+
highlightToggledItems: true
|
|
844
|
+
}));
|
|
845
|
+
return { checkbox, label, inheritContainer, actionBar, disposables, elementDisposables: disposables.add(( (new DisposableStore()))) };
|
|
768
846
|
}
|
|
769
847
|
renderElement({ element: profileResourceTreeElement }, index, templateData, height) {
|
|
770
848
|
templateData.elementDisposables.clear();
|
|
@@ -774,31 +852,24 @@ class ExistingProfileResourceTreeRenderer extends AbstractProfileResourceTreeRen
|
|
|
774
852
|
'ExistingProfileResourceTreeRenderer can only render existing profile element'
|
|
775
853
|
)));
|
|
776
854
|
}
|
|
777
|
-
if (!
|
|
778
|
-
throw ( (new Error(
|
|
779
|
-
'ExistingProfileResourceTreeRenderer can only render profile resource types'
|
|
780
|
-
)));
|
|
855
|
+
if (!isProfileResourceTypeElement(element)) {
|
|
856
|
+
throw ( (new Error('Invalid profile resource element')));
|
|
781
857
|
}
|
|
782
|
-
templateData.label.textContent = this.getResourceTypeTitle(element);
|
|
858
|
+
templateData.label.textContent = this.getResourceTypeTitle(element.resourceType);
|
|
783
859
|
if (root instanceof UserDataProfileElement && root.profile.isDefault) {
|
|
784
|
-
templateData.checkbox.
|
|
785
|
-
templateData.checkbox.disable();
|
|
786
|
-
templateData.description.classList.add('hide');
|
|
860
|
+
templateData.checkbox.domNode.classList.add('hide');
|
|
787
861
|
}
|
|
788
862
|
else {
|
|
789
|
-
templateData.checkbox.
|
|
790
|
-
|
|
791
|
-
templateData.checkbox.
|
|
792
|
-
templateData.description.classList.toggle('hide', checked);
|
|
793
|
-
templateData.elementDisposables.add(templateData.checkbox.onChange(() => root.setFlag(element, !templateData.checkbox.checked)));
|
|
794
|
-
templateData.elementDisposables.add(root.onDidChange(e => {
|
|
795
|
-
if (e.flags) {
|
|
796
|
-
templateData.description.classList.toggle('hide', !root.getFlag(element));
|
|
797
|
-
}
|
|
798
|
-
}));
|
|
863
|
+
templateData.checkbox.domNode.classList.remove('hide');
|
|
864
|
+
templateData.checkbox.checked = root.getFlag(element.resourceType);
|
|
865
|
+
templateData.elementDisposables.add(templateData.checkbox.onChange(() => root.setFlag(element.resourceType, templateData.checkbox.checked)));
|
|
799
866
|
}
|
|
867
|
+
templateData.actionBar.setActions(element.action ? [element.action] : []);
|
|
800
868
|
}
|
|
801
|
-
}
|
|
869
|
+
};
|
|
870
|
+
ExistingProfileResourceTreeRenderer = ExistingProfileResourceTreeRenderer_1 = ( (__decorate([
|
|
871
|
+
( (__param(0, IInstantiationService)))
|
|
872
|
+
], ExistingProfileResourceTreeRenderer)));
|
|
802
873
|
let NewProfileResourceTreeRenderer = class NewProfileResourceTreeRenderer extends AbstractProfileResourceTreeRenderer {
|
|
803
874
|
static { NewProfileResourceTreeRenderer_1 = this; }
|
|
804
875
|
static { this.TEMPLATE_ID = 'NewProfileResourceTemplate'; }
|
|
@@ -813,16 +884,17 @@ let NewProfileResourceTreeRenderer = class NewProfileResourceTreeRenderer extend
|
|
|
813
884
|
const container = append(parent, $('.profile-tree-item-container.new-profile-resource-type-container'));
|
|
814
885
|
const labelContainer = append(container, $('.profile-resource-type-label-container'));
|
|
815
886
|
const label = append(labelContainer, $('span.profile-resource-type-label'));
|
|
816
|
-
const selectBox = this._register(this.instantiationService.createInstance(SelectBox, [
|
|
817
|
-
{ text: ( localizeWithPath(_moduleId, 31, "Empty")) },
|
|
818
|
-
{ text: ( localizeWithPath(_moduleId, 32, "Copy")) },
|
|
819
|
-
{ text: ( localizeWithPath(_moduleId, 33, "Use Default Profile")) }
|
|
820
|
-
], 0, this.contextViewService, defaultSelectBoxStyles, {
|
|
887
|
+
const selectBox = this._register(this.instantiationService.createInstance(SelectBox, [], 0, this.contextViewService, defaultSelectBoxStyles, {
|
|
821
888
|
useCustomDrawn: true,
|
|
822
889
|
}));
|
|
823
890
|
const selectContainer = append(container, $('.profile-select-container'));
|
|
824
891
|
selectBox.render(selectContainer);
|
|
825
|
-
|
|
892
|
+
const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
|
|
893
|
+
const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
|
|
894
|
+
hoverDelegate: disposables.add(createInstantHoverDelegate()),
|
|
895
|
+
highlightToggledItems: true
|
|
896
|
+
}));
|
|
897
|
+
return { label, selectContainer, selectBox, actionBar, disposables, elementDisposables: disposables.add(( (new DisposableStore()))) };
|
|
826
898
|
}
|
|
827
899
|
renderElement({ element: profileResourceTreeElement }, index, templateData, height) {
|
|
828
900
|
templateData.elementDisposables.clear();
|
|
@@ -830,15 +902,35 @@ let NewProfileResourceTreeRenderer = class NewProfileResourceTreeRenderer extend
|
|
|
830
902
|
if (!(root instanceof NewProfileElement)) {
|
|
831
903
|
throw ( (new Error('NewProfileResourceTreeRenderer can only render new profile element')));
|
|
832
904
|
}
|
|
833
|
-
if (!
|
|
834
|
-
throw ( (new Error('
|
|
905
|
+
if (!isProfileResourceTypeElement(element)) {
|
|
906
|
+
throw ( (new Error('Invalid profile resource element')));
|
|
835
907
|
}
|
|
836
|
-
templateData.label.textContent = this.getResourceTypeTitle(element);
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
908
|
+
templateData.label.textContent = this.getResourceTypeTitle(element.resourceType);
|
|
909
|
+
if (root.copyFrom && root.hasResource(element.resourceType)) {
|
|
910
|
+
const copyFromName = root.getCopyFromName();
|
|
911
|
+
templateData.selectBox.setOptions([
|
|
912
|
+
{ text: ( localizeWithPath(_moduleId, 30, "Empty")) },
|
|
913
|
+
{ text: copyFromName ? ( localizeWithPath(_moduleId, 31, "Copy ({0})", copyFromName)) : ( localizeWithPath(_moduleId, 32, "Copy")) },
|
|
914
|
+
{ text: ( localizeWithPath(_moduleId, 33, "Use Default Profile")) }
|
|
915
|
+
]);
|
|
916
|
+
templateData.selectBox.select(root.getCopyFlag(element.resourceType) ? 1 : root.getFlag(element.resourceType) ? 2 : 0);
|
|
917
|
+
templateData.elementDisposables.add(templateData.selectBox.onDidSelect(option => {
|
|
918
|
+
root.setFlag(element.resourceType, option.index === 2);
|
|
919
|
+
root.setCopyFlag(element.resourceType, option.index === 1);
|
|
920
|
+
}));
|
|
921
|
+
}
|
|
922
|
+
else {
|
|
923
|
+
templateData.selectBox.setOptions([
|
|
924
|
+
{ text: ( localizeWithPath(_moduleId, 30, "Empty")) },
|
|
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);
|
|
930
|
+
}));
|
|
931
|
+
}
|
|
932
|
+
templateData.selectBox.setEnabled(!root.disabled);
|
|
933
|
+
templateData.actionBar.setActions(element.action ? [element.action] : []);
|
|
842
934
|
}
|
|
843
935
|
};
|
|
844
936
|
NewProfileResourceTreeRenderer = NewProfileResourceTreeRenderer_1 = ( (__decorate([
|
|
@@ -850,6 +942,7 @@ let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRen
|
|
|
850
942
|
static { this.TEMPLATE_ID = 'ProfileResourceChildTreeItemTemplate'; }
|
|
851
943
|
constructor(instantiationService) {
|
|
852
944
|
super();
|
|
945
|
+
this.instantiationService = instantiationService;
|
|
853
946
|
this.templateId = ProfileResourceChildTreeItemRenderer_1.TEMPLATE_ID;
|
|
854
947
|
this.labels = instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER);
|
|
855
948
|
this.hoverDelegate = this._register(instantiationService.createInstance(WorkbenchHoverDelegate, 'mouse', false, {}));
|
|
@@ -860,15 +953,18 @@ let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRen
|
|
|
860
953
|
const checkbox = disposables.add(( (new Checkbox('', false, defaultCheckboxStyles))));
|
|
861
954
|
append(container, checkbox.domNode);
|
|
862
955
|
const resourceLabel = disposables.add(this.labels.create(container, { hoverDelegate: this.hoverDelegate }));
|
|
863
|
-
|
|
956
|
+
const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
|
|
957
|
+
const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
|
|
958
|
+
hoverDelegate: disposables.add(createInstantHoverDelegate()),
|
|
959
|
+
highlightToggledItems: true
|
|
960
|
+
}));
|
|
961
|
+
return { checkbox, resourceLabel, actionBar, disposables, elementDisposables: disposables.add(( (new DisposableStore()))) };
|
|
864
962
|
}
|
|
865
963
|
renderElement({ element: profileResourceTreeElement }, index, templateData, height) {
|
|
866
964
|
templateData.elementDisposables.clear();
|
|
867
965
|
const { element } = profileResourceTreeElement;
|
|
868
|
-
if (
|
|
869
|
-
throw ( (new Error(
|
|
870
|
-
'NewProfileResourceTreeRenderer can only render profile resource child tree items'
|
|
871
|
-
)));
|
|
966
|
+
if (!isProfileResourceChildElement(element)) {
|
|
967
|
+
throw ( (new Error('Invalid profile resource element')));
|
|
872
968
|
}
|
|
873
969
|
if (element.checkbox) {
|
|
874
970
|
templateData.checkbox.domNode.classList.remove('hide');
|
|
@@ -881,15 +977,15 @@ let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRen
|
|
|
881
977
|
else {
|
|
882
978
|
templateData.checkbox.domNode.classList.add('hide');
|
|
883
979
|
}
|
|
884
|
-
const resource = URI.revive(element.resourceUri);
|
|
885
980
|
templateData.resourceLabel.setResource({
|
|
886
|
-
name: resource ? basename(resource) : element.label
|
|
887
|
-
|
|
888
|
-
resource
|
|
981
|
+
name: element.resource ? basename(element.resource) : element.label,
|
|
982
|
+
resource: element.resource
|
|
889
983
|
}, {
|
|
890
984
|
forceLabel: true,
|
|
891
|
-
|
|
985
|
+
icon: element.icon,
|
|
986
|
+
hideIcon: !element.resource && !element.icon,
|
|
892
987
|
});
|
|
988
|
+
templateData.actionBar.setActions(element.action ? [element.action] : []);
|
|
893
989
|
}
|
|
894
990
|
};
|
|
895
991
|
ProfileResourceChildTreeItemRenderer = ProfileResourceChildTreeItemRenderer_1 = ( (__decorate([
|