@@ -7,8 +7,8 @@ import { CancellationToken } from 'vs/base/common/cancellation';
7
7
import { DisposableStore } from 'vs/base/common/lifecycle' ;
8
8
import { joinPath } from 'vs/base/common/resources' ;
9
9
import { localize } from 'vs/nls' ;
10
- import { Action2 , registerAction2 } from 'vs/platform/actions/common/actions' ;
11
- import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs' ;
10
+ import { Action2 , MenuId , registerAction2 } from 'vs/platform/actions/common/actions' ;
11
+ import { IDialogService , IFileDialogService } from 'vs/platform/dialogs/common/dialogs' ;
12
12
import { IFileService } from 'vs/platform/files/common/files' ;
13
13
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
14
14
import { INotificationService } from 'vs/platform/notification/common/notification' ;
@@ -19,6 +19,7 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
19
19
import { IUserDataProfile , IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile' ;
20
20
import { CATEGORIES } from 'vs/workbench/common/actions' ;
21
21
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity' ;
22
+ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
22
23
23
24
registerAction2 ( class CreateFromCurrentProfileAction extends Action2 {
24
25
constructor ( ) {
@@ -196,14 +197,14 @@ registerAction2(class ExportProfileAction extends Action2 {
196
197
original : 'Export Settings Profile...'
197
198
} ,
198
199
category : PROFILES_CATEGORY ,
199
- f1 : true ,
200
- precondition : PROFILES_ENABLEMENT_CONTEXT ,
201
200
menu : [
202
201
{
203
202
id : ManageProfilesSubMenu ,
204
203
group : '3_import_export_profiles' ,
205
204
when : PROFILES_ENABLEMENT_CONTEXT ,
206
205
order : 1
206
+ } , {
207
+ id : MenuId . CommandPalette
207
208
}
208
209
]
209
210
} ) ;
@@ -241,14 +242,14 @@ registerAction2(class ImportProfileAction extends Action2 {
241
242
original : 'Import Settings Profile...'
242
243
} ,
243
244
category : PROFILES_CATEGORY ,
244
- f1 : true ,
245
- precondition : PROFILES_ENABLEMENT_CONTEXT ,
246
245
menu : [
247
246
{
248
247
id : ManageProfilesSubMenu ,
249
248
group : '3_import_export_profiles' ,
250
249
when : PROFILES_ENABLEMENT_CONTEXT ,
251
250
order : 2
251
+ } , {
252
+ id : MenuId . CommandPalette
252
253
}
253
254
]
254
255
} ) ;
@@ -260,6 +261,19 @@ registerAction2(class ImportProfileAction extends Action2 {
260
261
const fileService = accessor . get ( IFileService ) ;
261
262
const requestService = accessor . get ( IRequestService ) ;
262
263
const userDataProfileImportExportService = accessor . get ( IUserDataProfileImportExportService ) ;
264
+ const dialogService = accessor . get ( IDialogService ) ;
265
+ const contextKeyService = accessor . get ( IContextKeyService ) ;
266
+
267
+ const isSettingProfilesEnabled = contextKeyService . contextMatchesRules ( PROFILES_ENABLEMENT_CONTEXT ) ;
268
+
269
+ if ( ! isSettingProfilesEnabled ) {
270
+ if ( ! ( await dialogService . confirm ( {
271
+ title : localize ( 'import profile title' , "Import Settings from a Profile" ) ,
272
+ message : localize ( 'confiirmation message' , "This will replace your current settings. Are you sure you want to continue?" ) ,
273
+ } ) ) . confirmed ) {
274
+ return ;
275
+ }
276
+ }
263
277
264
278
const disposables = new DisposableStore ( ) ;
265
279
const quickPick = disposables . add ( quickInputService . createQuickPick ( ) ) ;
@@ -278,7 +292,11 @@ registerAction2(class ImportProfileAction extends Action2 {
278
292
quickPick . hide ( ) ;
279
293
const profile = quickPick . selectedItems [ 0 ] . description ? await this . getProfileFromURL ( quickPick . value , requestService ) : await this . getProfileFromFileSystem ( fileDialogService , fileService ) ;
280
294
if ( profile ) {
281
- await userDataProfileImportExportService . importProfile ( profile ) ;
295
+ if ( isSettingProfilesEnabled ) {
296
+ await userDataProfileImportExportService . importProfile ( profile ) ;
297
+ } else {
298
+ await userDataProfileImportExportService . setProfile ( profile ) ;
299
+ }
282
300
}
283
301
} ) ) ;
284
302
disposables . add ( quickPick . onDidHide ( ( ) => disposables . dispose ( ) ) ) ;
0 commit comments