Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/vs/workbench/browser/parts/editor/editorActions.ts')
-rw-r--r--src/vs/workbench/browser/parts/editor/editorActions.ts34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts
index 0995d4e6e48..a993829e847 100644
--- a/src/vs/workbench/browser/parts/editor/editorActions.ts
+++ b/src/vs/workbench/browser/parts/editor/editorActions.ts
@@ -19,7 +19,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
-import { IFileDialogService, ConfirmResult } from 'vs/platform/dialogs/common/dialogs';
+import { IFileDialogService, ConfirmResult, IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { ItemActivation, IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { AllEditorsByMostRecentlyUsedQuickAccess, ActiveGroupEditorsByMostRecentlyUsedQuickAccess, AllEditorsByAppearanceQuickAccess } from 'vs/workbench/browser/parts/editor/editorQuickAccess';
import { Codicon } from 'vs/base/common/codicons';
@@ -1483,13 +1483,26 @@ export class ClearRecentFilesAction extends Action {
id: string,
label: string,
@IWorkspacesService private readonly workspacesService: IWorkspacesService,
- @IHistoryService private readonly historyService: IHistoryService
+ @IHistoryService private readonly historyService: IHistoryService,
+ @IDialogService private readonly dialogService: IDialogService
) {
super(id, label);
}
override async run(): Promise<void> {
+ // Ask for confirmation
+ const { confirmed } = await this.dialogService.confirm({
+ message: localize('confirmClearRecentsMessage', "Do you want to clear all recently opened files and workspaces?"),
+ detail: localize('confirmClearDetail', "This action is irreversible!"),
+ primaryButton: localize({ key: 'clearButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Clear"),
+ type: 'warning'
+ });
+
+ if (!confirmed) {
+ return;
+ }
+
// Clear global recently opened
this.workspacesService.clearRecentlyOpened();
@@ -1746,14 +1759,27 @@ export class ClearEditorHistoryAction extends Action {
constructor(
id: string,
label: string,
- @IHistoryService private readonly historyService: IHistoryService
+ @IHistoryService private readonly historyService: IHistoryService,
+ @IDialogService private readonly dialogService: IDialogService
) {
super(id, label);
}
override async run(): Promise<void> {
- // Editor history
+ // Ask for confirmation
+ const { confirmed } = await this.dialogService.confirm({
+ message: localize('confirmClearEditorHistoryMessage', "Do you want to clear the history of recently opened editors?"),
+ detail: localize('confirmClearDetail', "This action is irreversible!"),
+ primaryButton: localize({ key: 'clearButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Clear"),
+ type: 'warning'
+ });
+
+ if (!confirmed) {
+ return;
+ }
+
+ // Clear editor history
this.historyService.clear();
}
}