From 69e33b7c048488dcc79e2ba13739eefd88913f01 Mon Sep 17 00:00:00 2001 From: Krystian Grzymski Date: Thu, 21 Oct 2021 08:48:39 +0200 Subject: [PATCH] Delete confirmation popup should show always (#306) --- src/DialogMessage.ts | 2 +- src/Tomcat/TomcatController.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/DialogMessage.ts b/src/DialogMessage.ts index 7f68b3c..899e31e 100644 --- a/src/DialogMessage.ts +++ b/src/DialogMessage.ts @@ -16,7 +16,7 @@ export namespace DialogMessage { export const noServerConfig: string = localize('tomcatExt.noServerConfig', 'The Tomcat Server is broken. It does not have server.xml'); export const selectWarPackage: string = localize('tomcatExt.selectWarPackage', 'Select War Package'); export const selectDirectory: string = localize('tomcatExt.selectDirectory', 'Select Tomcat Directory'); - export const deleteConfirm: string = localize('tomcatExt.deleteConfirm', 'This Tomcat Server is running, are you sure you want to delete it?'); + export const deleteConfirm: string = localize('tomcatExt.deleteConfirm', 'Are you sure you want to delete this server?'); export const serverRunning: string = localize('tomcatExt.serverRunning', 'This Tomcat Server is already started.'); export const serverStopped: string = localize('tomcatExt.serverStopped', 'This Tomcat Server was stopped.'); export const startServer: string = localize('tomcatExt.startServer', 'The Tomcat server needs to be started before browsing. Would you like to start it now?'); diff --git a/src/Tomcat/TomcatController.ts b/src/Tomcat/TomcatController.ts index b3fe42b..f069426 100644 --- a/src/Tomcat/TomcatController.ts +++ b/src/Tomcat/TomcatController.ts @@ -28,12 +28,12 @@ export class TomcatController { public async deleteServer(operationId: string, tomcatServer: TomcatServer): Promise { const server: TomcatServer = await this.precheck(operationId, tomcatServer); if (server) { + const confirmation: MessageItem = await vscode.window.showWarningMessage(DialogMessage.deleteConfirm, DialogMessage.yes, DialogMessage.cancel); + if (confirmation !== DialogMessage.yes) { + Utility.infoTelemetryStep(operationId, 'cancel'); + return; + } if (server.isStarted()) { - const confirmation: MessageItem = await vscode.window.showWarningMessage(DialogMessage.deleteConfirm, DialogMessage.yes, DialogMessage.cancel); - if (confirmation !== DialogMessage.yes) { - Utility.infoTelemetryStep(operationId, 'cancel'); - return; - } await this.stopOrRestartServer(operationId, server); } this._tomcatModel.deleteServer(server);