From e53e3338ce40751e86cbc4961b5674fee91160c3 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Sun, 14 May 2017 14:33:07 +0300 Subject: [PATCH] Yes/No dialogs considered harmful, provide more immediate and descriptive button texts instead (for the most blatant bloopers) --- .../ui/header/InspectionProfileSchemesPanel.java | 7 ++++--- .../testframework/export/ExportTestResultsAction.java | 10 +++++----- .../openapi/diff/impl/patch/formove/PathsVerifier.java | 8 +++++--- .../vcs/changes/patch/CreatePatchCommitExecutor.java | 4 +++- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionProfileSchemesPanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionProfileSchemesPanel.java index ceb80624db82..d7bee78e7bc0 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionProfileSchemesPanel.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionProfileSchemesPanel.java @@ -157,9 +157,10 @@ public class InspectionProfileSchemesPanel extends AbstractDescriptionAwareSchem } final SingleInspectionProfilePanel existed = InspectionProfileSchemesPanel.this.getModel().getProfilePanel(profile); if (existed != null) { - if (Messages.showOkCancelDialog(myProject, "Profile with name \'" + - profile.getName() + - "\' already exists. Do you want to overwrite it?", "Warning", + if (Messages.showOkCancelDialog(myProject, "Profile with name \'" + profile.getName() + + "\' already exists. Do you want to overwrite it?", + "Overwrite Warning", + "Overwrite", "Cancel", Messages.getInformationIcon()) != Messages.OK) { return; } diff --git a/platform/testRunner/src/com/intellij/execution/testframework/export/ExportTestResultsAction.java b/platform/testRunner/src/com/intellij/execution/testframework/export/ExportTestResultsAction.java index bc4a0f9c98ba..3bd78524e06f 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/export/ExportTestResultsAction.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/export/ExportTestResultsAction.java @@ -116,11 +116,11 @@ public class ExportTestResultsAction extends DumbAwareAction { } filename = d.getFileName(); showDialog = getOutputFile(config, project, filename).exists() - && Messages.showOkCancelDialog( - project, - ExecutionBundle.message("export.test.results.file.exists.message", filename), - ExecutionBundle.message("export.test.results.file.exists.title"), - Messages.getQuestionIcon() + && Messages.showOkCancelDialog(project, + ExecutionBundle.message("export.test.results.file.exists.message", filename), + ExecutionBundle.message("export.test.results.file.exists.title"), + "Overwrite", "Cancel", + Messages.getQuestionIcon() ) != Messages.OK; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java index 70b0c5993586..b9278a6fa981 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java @@ -637,11 +637,13 @@ public class PathsVerifier { final List result = new LinkedList<>(); if (! myOverrideExisting.isEmpty()) { final String title = "Overwrite Existing Files"; - final Collection selected = AbstractVcsHelper.getInstance(myProject).selectFilePathsToProcess( - new ArrayList<>(myOverrideExisting.keySet()), title, + List files = new ArrayList<>(myOverrideExisting.keySet()); + Collection selected = AbstractVcsHelper.getInstance(myProject).selectFilePathsToProcess( + files, title, "\nThe following files should be created by patch, but they already exist.\nDo you want to overwrite them?\n", title, "The following file should be created by patch, but it already exists.\nDo you want to overwrite it?\n{0}", - VcsShowConfirmationOption.STATIC_SHOW_CONFIRMATION); + VcsShowConfirmationOption.STATIC_SHOW_CONFIRMATION, + "Overwrite", "Cancel"); if (selected != null) { for (FilePath path : selected) { myOverrideExisting.remove(path); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchCommitExecutor.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchCommitExecutor.java index b2aa755f6fce..28781af8177f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchCommitExecutor.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchCommitExecutor.java @@ -157,7 +157,9 @@ public class CreatePatchCommitExecutor extends LocalCommitExecutor implements Pr WaitForProgressToShow.runOrInvokeAndWaitAboveProgress( () -> result[0] = Messages.showYesNoDialog(myProject, "File " + file.getName() + " (" + file.getParent() + ")" + " already exists.\nDo you want to overwrite it?", - CommonBundle.getWarningTitle(), Messages.getWarningIcon())); + CommonBundle.getWarningTitle(), + "Overwrite", "Cancel", + Messages.getWarningIcon())); if (Messages.NO == result[0]) return; } if (file.getParentFile() == null) {