From 9e8700e09b79fe542490a0e0466d48bc692002e0 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Fri, 6 Sep 2019 13:28:33 +0300 Subject: [PATCH] IDEA-CR-52168: closing "Browser Error" dialog with Escape shouldn't run "Fix..." action (WEB-41095) (cherry picked from commit 01e97788eb0037345e7560e0d7c8d2105eef5378) GitOrigin-RevId: 4146e34b9a874aa69e77595efb92504c36f37aa0 --- .../platform-api/src/com/intellij/openapi/ui/MessageUtil.kt | 5 +++-- .../src/com/intellij/ide/browsers/BrowserLauncherImpl.kt | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/ui/MessageUtil.kt b/platform/platform-api/src/com/intellij/openapi/ui/MessageUtil.kt index 5f3267669f62..63407a1488e9 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/MessageUtil.kt +++ b/platform/platform-api/src/com/intellij/openapi/ui/MessageUtil.kt @@ -10,8 +10,9 @@ fun showYesNoDialog(@Nls(capitalization = Nls.Capitalization.Title) title: Strin return Messages.showYesNoDialog(project, message, title, yesText, noText, icon) == Messages.YES } -fun showOkNoDialog(@Nls(capitalization = Nls.Capitalization.Title) title: String, message: String, project: Project?, yesText: String = Messages.OK_BUTTON, noText: String = Messages.NO_BUTTON, icon: Icon? = null): Boolean { - return Messages.showYesNoDialog(project, message, title, yesText, noText, icon) == Messages.YES +fun showOkNoDialog(@Nls(capitalization = Nls.Capitalization.Title) title: String, message: String, project: Project?, + okText: String = Messages.OK_BUTTON, noText: String = Messages.NO_BUTTON, icon: Icon? = null): Boolean { + return Messages.showYesNoDialog(project, message, title, okText, noText, icon) == Messages.YES } @Messages.OkCancelResult diff --git a/xml/impl/src/com/intellij/ide/browsers/BrowserLauncherImpl.kt b/xml/impl/src/com/intellij/ide/browsers/BrowserLauncherImpl.kt index df160534690b..96e861852a4f 100644 --- a/xml/impl/src/com/intellij/ide/browsers/BrowserLauncherImpl.kt +++ b/xml/impl/src/com/intellij/ide/browsers/BrowserLauncherImpl.kt @@ -10,6 +10,7 @@ import com.intellij.ide.util.PropertiesComponent import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.options.ShowSettingsUtil import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.Messages import com.intellij.openapi.ui.showOkNoDialog import com.intellij.openapi.util.SystemInfo import com.intellij.openapi.util.registry.Registry @@ -67,7 +68,9 @@ class BrowserLauncherImpl : BrowserLauncherAppless() { override fun showError(error: String?, browser: WebBrowser?, project: Project?, title: String?, launchTask: (() -> Unit)?) { AppUIUtil.invokeOnEdt(Runnable { - if (!showOkNoDialog(title ?: IdeBundle.message("browser.error"), error ?: "Unknown error", project, noText = IdeBundle.message("button.fix"))) { + if (showOkNoDialog(title ?: IdeBundle.message("browser.error"), error ?: "Unknown error", project, + okText = IdeBundle.message("button.fix"), + noText = Messages.OK_BUTTON)) { val browserSettings = BrowserSettings() if (ShowSettingsUtil.getInstance().editConfigurable(project, browserSettings, browser?.let { Runnable { browserSettings.selectBrowser(it) } })) { launchTask?.invoke()