Yes/No dialogs considered harmful, provide more immediate and descriptive button texts instead (for the most blatant bloopers)

This commit is contained in:
Alexey Kudravtsev
2017-05-14 14:35:49 +03:00
parent ac13cb0cc4
commit e53e3338ce
4 changed files with 17 additions and 12 deletions
@@ -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;
}
@@ -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;
}
@@ -637,11 +637,13 @@ public class PathsVerifier<BinaryType extends FilePatch> {
final List<FilePatch> result = new LinkedList<>();
if (! myOverrideExisting.isEmpty()) {
final String title = "Overwrite Existing Files";
final Collection<FilePath> selected = AbstractVcsHelper.getInstance(myProject).selectFilePathsToProcess(
new ArrayList<>(myOverrideExisting.keySet()), title,
List<FilePath> files = new ArrayList<>(myOverrideExisting.keySet());
Collection<FilePath> 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);
@@ -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) {