|
| 1 | +/*--------------------------------------------------------------------------------------------- |
| 2 | + * Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | + * Licensed under the MIT License. See License.txt in the project root for license information. |
| 4 | + *--------------------------------------------------------------------------------------------*/ |
| 5 | + |
| 6 | +import { URI } from 'vs/base/common/uri'; |
| 7 | +import { SimpleFileDialog } from 'vs/workbench/services/dialogs/browser/simpleFileDialog'; |
| 8 | +import { Schemas } from 'vs/base/common/network'; |
| 9 | +import { IFileService } from 'vs/platform/files/common/files'; |
| 10 | +import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; |
| 11 | +import { ILabelService } from 'vs/platform/label/common/label'; |
| 12 | +import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; |
| 13 | +import { INotificationService } from 'vs/platform/notification/common/notification'; |
| 14 | +import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; |
| 15 | +import { IModelService } from 'vs/editor/common/services/modelService'; |
| 16 | +import { IModeService } from 'vs/editor/common/services/modeService'; |
| 17 | +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; |
| 18 | +import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; |
| 19 | +import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService'; |
| 20 | +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; |
| 21 | +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; |
| 22 | +import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService'; |
| 23 | + |
| 24 | +export class NativeSimpleFileDialog extends SimpleFileDialog { |
| 25 | + constructor( |
| 26 | + @IFileService fileService: IFileService, |
| 27 | + @IQuickInputService quickInputService: IQuickInputService, |
| 28 | + @ILabelService labelService: ILabelService, |
| 29 | + @IWorkspaceContextService workspaceContextService: IWorkspaceContextService, |
| 30 | + @INotificationService notificationService: INotificationService, |
| 31 | + @IFileDialogService fileDialogService: IFileDialogService, |
| 32 | + @IModelService modelService: IModelService, |
| 33 | + @IModeService modeService: IModeService, |
| 34 | + @IWorkbenchEnvironmentService protected environmentService: INativeWorkbenchEnvironmentService, |
| 35 | + @IRemoteAgentService remoteAgentService: IRemoteAgentService, |
| 36 | + @IRemotePathService protected remotePathService: IRemotePathService, |
| 37 | + @IKeybindingService keybindingService: IKeybindingService, |
| 38 | + @IContextKeyService contextKeyService: IContextKeyService |
| 39 | + ) { |
| 40 | + super(fileService, quickInputService, labelService, workspaceContextService, notificationService, fileDialogService, modelService, modeService, environmentService, remoteAgentService, remotePathService, keybindingService, contextKeyService); |
| 41 | + } |
| 42 | + |
| 43 | + protected async getUserHome(): Promise<URI> { |
| 44 | + if (this.scheme !== Schemas.file) { |
| 45 | + return super.getUserHome(); |
| 46 | + } |
| 47 | + return this.environmentService.userHome; |
| 48 | + } |
| 49 | +} |
0 commit comments