diff options
Diffstat (limited to 'platform/platform-api/src/com/intellij/openapi/ui/Messages.java')
-rw-r--r-- | platform/platform-api/src/com/intellij/openapi/ui/Messages.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/Messages.java b/platform/platform-api/src/com/intellij/openapi/ui/Messages.java index 1a07b33d696d..e963871cfd5f 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/Messages.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/Messages.java @@ -377,6 +377,33 @@ public class Messages { * @return {@link #YES} if user pressed "Yes" or {@link #NO} if user pressed "No" button. */ @YesNoResult + public static int showYesNoDialog(@Nullable Project project, + String message, + @NotNull String title, + @NotNull String yesText, + @NotNull String noText, + @Nullable Icon icon, + @Nullable DialogWrapper.DoNotAskOption doNotAskOption) { + try { + if (canShowMacSheetPanel()) { + return MacMessages.getInstance() + .showYesNoDialog(title, message, yesText, noText, WindowManager.getInstance().suggestParentWindow(project), doNotAskOption); + } + } + catch (Exception exception) { + LOG.error(exception); + } + + int result = showDialog(project, message, title, new String[]{yesText, noText}, 0, icon, doNotAskOption) == 0 ? YES : NO; + //noinspection ConstantConditions + LOG.assertTrue(result == YES || result == NO, result); + return result; + } + + /** + * @return {@link #YES} if user pressed "Yes" or {@link #NO} if user pressed "No" button. + */ + @YesNoResult public static int showYesNoDialog(@Nullable Project project, String message, @NotNull String title, @Nullable Icon icon) { try { if (canShowMacSheetPanel()) { @@ -394,6 +421,31 @@ public class Messages { return result; } + /** + * @return {@link #YES} if user pressed "Yes" or {@link #NO} if user pressed "No" button. + */ + @YesNoResult + public static int showYesNoDialog(@Nullable Project project, + String message, + @NotNull String title, + @Nullable Icon icon, + @Nullable DialogWrapper.DoNotAskOption doNotAskOption) { + try { + if (canShowMacSheetPanel()) { + return MacMessages.getInstance().showYesNoDialog(title, message, YES_BUTTON, NO_BUTTON, + WindowManager.getInstance().suggestParentWindow(project), doNotAskOption); + } + } + catch (Exception exception) { + LOG.error(exception); + } + + int result = showYesNoDialog(project, message, title, YES_BUTTON, NO_BUTTON, icon, doNotAskOption); + + LOG.assertTrue(result == YES || result == NO, result); + return result; + } + /** * @return {@link #YES} if user pressed "Yes" or {@link #NO} if user pressed "No" button. |