From 9b5620cd07dc4ddf34431311729a1dc119d5d87f Mon Sep 17 00:00:00 2001 From: "Maxim.Kolmakov" Date: Thu, 26 Oct 2017 19:19:04 +0200 Subject: [PATCH] Don't collect logs in case canceled is pressed --- .../ide/actions/CollectZippedLogsAction.java | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/actions/CollectZippedLogsAction.java b/platform/platform-impl/src/com/intellij/ide/actions/CollectZippedLogsAction.java index fd2923e0e0bb..d952b41f8691 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/CollectZippedLogsAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/CollectZippedLogsAction.java @@ -49,25 +49,28 @@ public class CollectZippedLogsAction extends AnAction implements DumbAware { final boolean doNotShowDialog = PropertiesComponent.getInstance().getBoolean(CONFIRMATION_DIALOG); - try { - final File zippedLogsFile = createZip(project); - if (!doNotShowDialog) { - Messages.showIdeaMessageDialog( - project, "Included log and settings may contain sensitive data.", "Sensitive Data", - new String[]{Messages.OK_BUTTON}, 1, Messages.getInformationIcon(), - new DialogWrapper.DoNotAskOption.Adapter() { - @Override - public void rememberChoice(final boolean selected, final int exitCode) { - PropertiesComponent.getInstance().setValue(CONFIRMATION_DIALOG, selected); - } + int response = Messages.OK; + if (!doNotShowDialog) { + response = Messages.showOkCancelDialog( + project, "Included log and settings may contain sensitive data.", "Sensitive Data", + Messages.OK_BUTTON, Messages.CANCEL_BUTTON, Messages.getWarningIcon(), + new DialogWrapper.DoNotAskOption.Adapter() { + @Override + public void rememberChoice(final boolean selected, final int exitCode) { + PropertiesComponent.getInstance().setValue(CONFIRMATION_DIALOG, selected); } - ); - } - if (ShowFilePathAction.isSupported()) { - ShowFilePathAction.openFile(zippedLogsFile); - } - else { - Messages.showInfoMessage(zippedLogsFile.getAbsolutePath(), "Log File"); + } + ); + } + try { + if (response == Messages.OK) { + final File zippedLogsFile = createZip(project); + if (ShowFilePathAction.isSupported()) { + ShowFilePathAction.openFile(zippedLogsFile); + } + else { + Messages.showInfoMessage(zippedLogsFile.getAbsolutePath(), "Log File"); + } } } catch (final IOException exception) {