From bb40bb36144288a004bae2b46715ce52d22673c9 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Tue, 20 Jan 2015 17:29:23 +0300 Subject: [PATCH] IDEA-135419 Git: Force Push: html tags from the confirmation dialog fixed --- .../intellij/dvcs/push/PushController.java | 84 +++++++++++-------- 1 file changed, 47 insertions(+), 37 deletions(-) diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java b/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java index c35f94c047b6..76d0e5bfd061 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java @@ -36,6 +36,7 @@ import com.intellij.util.ObjectUtils; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.UIUtil; import com.intellij.vcs.log.VcsFullCommitDetails; +import com.intellij.xml.util.XmlStringUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -548,46 +549,15 @@ public class PushController implements Disposable { final PushSupport activePushSupport = selectedModel.getSupport(); final PushTarget commonTarget = getCommonTarget(selectedNodes); if (commonTarget != null && activePushSupport.isSilentForcePushAllowed(commonTarget)) return true; - return Messages.showOkCancelDialog(myProject, DvcsBundle.message("push.force.confirmation.text", - commonTarget != null - ? " to " + - commonTarget.getPresentation() + "" - : ""), + return Messages.showOkCancelDialog(myProject, XmlStringUtil.wrapInHtml(DvcsBundle.message("push.force.confirmation.text", + commonTarget != null + ? " to " + + commonTarget.getPresentation() + "" + : "")), "Force Push", "&Force Push", CommonBundle.getCancelButtonText(), Messages.getWarningIcon(), - commonTarget != null - ? new DialogWrapper.DoNotAskOption() { - - @Override - public boolean isToBeShown() { - return true; - } - - @Override - public void setToBeShown(boolean toBeShown, int exitCode) { - if (!toBeShown && exitCode == OK) { - activePushSupport.saveSilentForcePushTarget(commonTarget); - } - } - - @Override - public boolean canBeHidden() { - return true; - } - - @Override - public boolean shouldSaveOptionsOnCancel() { - return false; - } - - @NotNull - @Override - public String getDoNotShowMessage() { - return "Don't warn about this target"; - } - } - : null) == OK; + commonTarget != null ? new MyDoNotAskOptionForPush(activePushSupport, commonTarget) : null) == OK; } @Nullable @@ -689,4 +659,44 @@ public class PushController implements Disposable { return myCheckBoxModel; } } + + private static class MyDoNotAskOptionForPush implements DialogWrapper.DoNotAskOption { + + @NotNull private final PushSupport myActivePushSupport; + @NotNull private final PushTarget myCommonTarget; + + public MyDoNotAskOptionForPush(@NotNull PushSupport support, + @NotNull PushTarget target) { + myActivePushSupport = support; + myCommonTarget = target; + } + + @Override + public boolean isToBeShown() { + return true; + } + + @Override + public void setToBeShown(boolean toBeShown, int exitCode) { + if (!toBeShown && exitCode == OK) { + myActivePushSupport.saveSilentForcePushTarget(myCommonTarget); + } + } + + @Override + public boolean canBeHidden() { + return true; + } + + @Override + public boolean shouldSaveOptionsOnCancel() { + return false; + } + + @NotNull + @Override + public String getDoNotShowMessage() { + return "Don't warn about this target"; + } + } }