src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts/UserDataProfilesWorkbenchContribution/getProfileFromFileSystem
class UserDataProfilesWorkbenchContribution:	private registerImportProfileAction(): IDisposable {
		const disposables = new DisposableStore();
		const id = 'workbench.profiles.actions.importProfile';
		disposables.add(registerAction2(class ImportProfileAction extends Action2 {
			constructor() {
				super({
					id,
					title: {
						value: localize('import profile', "Import..."),
						original: 'Import...'
					},
					category: PROFILES_CATEGORY,
					f1: true,
					precondition: IS_PROFILE_IMPORT_EXPORT_IN_PROGRESS_CONTEXT.toNegated(),
					menu: [
						{
							id: ManageProfilesSubMenu,
							group: '4_import_export_profiles',
							when: PROFILES_ENABLEMENT_CONTEXT,
							order: 2
						}
					]
				});
			}

			async run(accessor: ServicesAccessor) {
				const fileDialogService = accessor.get(IFileDialogService);
				const quickInputService = accessor.get(IQuickInputService);
				const fileService = accessor.get(IFileService);
				const requestService = accessor.get(IRequestService);
				const userDataProfileImportExportService = accessor.get(IUserDataProfileImportExportService);
				const dialogService = accessor.get(IDialogService);
				const contextKeyService = accessor.get(IContextKeyService);
				const notificationService = accessor.get(INotificationService);

				const isSettingProfilesEnabled = contextKeyService.contextMatchesRules(PROFILES_ENABLEMENT_CONTEXT);

				if (!isSettingProfilesEnabled) {
					if (!(await dialogService.confirm({
						title: localize('import profile title', "Import Settings from a Profile"),
						message: localize('confiirmation message', "This will replace your current settings. Are you sure you want to continue?"),
					})).confirmed) {
						return;
					}
				}

				const disposables = new DisposableStore();
				const quickPick = disposables.add(quickInputService.createQuickPick());
				const updateQuickPickItems = (value?: string) => {
					const selectFromFileItem: IQuickPickItem = { label: localize('import from file', "Import from profile file") };
					quickPick.items = value ? [{ label: localize('import from url', "Import from URL"), description: quickPick.value }, selectFromFileItem] : [selectFromFileItem];
				};
				quickPick.title = localize('import profile quick pick title', "Import Profile");
				quickPick.placeholder = localize('import profile placeholder', "Provide profile URL or select profile file to import");
				quickPick.ignoreFocusOut = true;
				disposables.add(quickPick.onDidChangeValue(updateQuickPickItems));
				updateQuickPickItems();
				quickPick.matchOnLabel = false;
				quickPick.matchOnDescription = false;
				disposables.add(quickPick.onDidAccept(async () => {
					try {
						quickPick.hide();
						if (isSettingProfilesEnabled) {
							const profile = quickPick.selectedItems[0].description ? URI.parse(quickPick.value) : await this.getProfileUriFromFileSystem(fileDialogService);
							if (profile) {
								await userDataProfileImportExportService.importProfile(profile);
							}
						} else {
							const profile = quickPick.selectedItems[0].description ? await this.getProfileFromURL(quickPick.value, requestService) : await this.getProfileFromFileSystem(fileDialogService, fileService);
							if (profile) {
								await userDataProfileImportExportService.setProfile(profile);
							}
						}
					} catch (error) {
						notificationService.error(localize('profile import error', "Error while importing profile: {0}", getErrorMessage(error)));
					}
				}));
				disposables.add(quickPick.onDidHide(() => disposables.dispose()));
				quickPick.show();
			}

			private async getProfileUriFromFileSystem(fileDialogService: IFileDialogService): Promise<URI | null> {
				const profileLocation = await fileDialogService.showOpenDialog({
					canSelectFolders: false,
					canSelectFiles: true,
					canSelectMany: false,
					filters: PROFILE_FILTER,
					title: localize('import profile dialog', "Import Profile"),
				});
				if (!profileLocation) {
					return null;
				}
				return profileLocation[0];
			}

			private async getProfileFromFileSystem(fileDialogService: IFileDialogService, fileService: IFileService): Promise<IUserDataProfileTemplate | null> {
				const profileLocation = await this.getProfileUriFromFileSystem(fileDialogService);
				if (!profileLocation) {
					return null;
				}
				const content = (await fileService.readFile(profileLocation)).value.toString();
				const parsed = JSON.parse(content);
				return isUserDataProfileTemplate(parsed) ? parsed : null;
			}

			private async getProfileFromURL(url: string, requestService: IRequestService): Promise<IUserDataProfileTemplate | null> {
				const options = { type: 'GET', url };
				const context = await requestService.request(options, CancellationToken.None);
				if (context.res.statusCode === 200) {
					const result = await asJson(context);
					return isUserDataProfileTemplate(result) ? result : null;
				} else {
					const message = await asText(context);
					throw new Error(`Expected 200, got back ${context.res.statusCode} instead.\n\n${message}`);
				}
			}
		}));
		disposables.add(MenuRegistry.appendMenuItem(MenuId.MenubarShare, {
			command: {
				id,
				title: {
					value: localize('import profile share', "Import Profile...",),
					original: 'Import Profile...'
				},
				precondition: PROFILES_ENABLEMENT_CONTEXT,
			},
		}));
		return disposables;
	}