Skip to content

Commit

Permalink
editor: added confirmation prompt when executing clear editor history
Browse files Browse the repository at this point in the history
  • Loading branch information
souravghosh01 committed May 9, 2023
1 parent e85d95d commit 18605f7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/editor/src/browser/editor-navigation-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { NavigationLocation, RecentlyClosedEditor } from './navigation/navigatio
import { NavigationLocationService } from './navigation/navigation-location-service';
import { PreferenceService, PreferenceScope, addEventListener } from '@theia/core/lib/browser';
import { ConfirmDialog, Dialog } from '@theia/core/lib/browser/dialogs';
import { nls } from '@theia/core';

@injectable()
export class EditorNavigationContribution implements Disposable, FrontendApplicationContribution {
Expand Down Expand Up @@ -85,13 +86,13 @@ export class EditorNavigationContribution implements Disposable, FrontendApplica
});
this.commandRegistry.registerHandler(EditorCommands.CLEAR_EDITOR_HISTORY.id, {
execute: async () => {
const confirmed = await new ConfirmDialog({
title: 'Clear Editor History',
msg: 'Are you sure you want to clear the history of recently opened editors?',
const shouldClear = await new ConfirmDialog({
title: nls.localizeByDefault('Clear Editor History'),
msg: nls.localizeByDefault('Do you want to clear the history of recently opened editors?'),
ok: Dialog.YES,
cancel: Dialog.NO
}).open();
if (confirmed) {
if (shouldClear) {
this.locationStack.clearHistory();
}
},
Expand Down

0 comments on commit 18605f7

Please sign in to comment.