List of usage examples for com.intellij.openapi.ui DialogWrapper.DoNotAskOption getDoNotShowMessage
@NotNull
protected String getDoNotShowMessage()
From source file:com.intellij.ui.mac.MacMessagesImpl.java
License:Apache License
@Messages.YesNoCancelResult public static int showAlertDialog(@NotNull String title, @NotNull String defaultText, @Nullable final String alternateText, @Nullable final String otherText, final String message, @Nullable Window window, final boolean errorStyle, @Nullable final DialogWrapper.DoNotAskOption doNotAskDialogOption) { Map<Enum, Object> params = new HashMap<Enum, Object>(); ID pool = invoke(invoke("NSAutoreleasePool", "alloc"), "init"); try {//ww w. j av a 2s . c o m params.put(COMMON_DIALOG_PARAM_TYPE.title, nsString(title)); params.put(ALERT_DIALOG_PARAM_TYPE.defaultText, nsString(UIUtil.removeMnemonic(defaultText))); params.put(ALERT_DIALOG_PARAM_TYPE.alternateText, nsString(otherText == null ? "-1" : UIUtil.removeMnemonic(otherText))); params.put(ALERT_DIALOG_PARAM_TYPE.otherText, nsString(alternateText == null ? "-1" : UIUtil.removeMnemonic(alternateText))); // replace % -> %% to avoid formatted parameters (causes SIGTERM) params.put(COMMON_DIALOG_PARAM_TYPE.message, nsString(StringUtil.stripHtml(message == null ? "" : message, true).replace("%", "%%"))); params.put(COMMON_DIALOG_PARAM_TYPE.errorStyle, nsString(errorStyle ? "error" : "-1")); params.put(COMMON_DIALOG_PARAM_TYPE.doNotAskDialogOption1, nsString(doNotAskDialogOption == null || !doNotAskDialogOption.canBeHidden() // TODO: state=!doNotAsk.shouldBeShown() ? "-1" : doNotAskDialogOption.getDoNotShowMessage())); params.put(COMMON_DIALOG_PARAM_TYPE.doNotAskDialogOption2, nsString( doNotAskDialogOption != null && !doNotAskDialogOption.isToBeShown() ? "checked" : "-1")); MessageResult result = resultsFromDocumentRoot.remove(showDialog(window, "showSheet:", new DialogParamsWrapper(DialogParamsWrapper.DialogType.alert, params))); int convertedResult = convertReturnCodeFromNativeAlertDialog(result.myReturnCode, alternateText); if (doNotAskDialogOption != null && doNotAskDialogOption.canBeHidden()) { boolean operationCanceled = convertedResult == Messages.CANCEL; if (!operationCanceled || doNotAskDialogOption.shouldSaveOptionsOnCancel()) { doNotAskDialogOption.setToBeShown(!result.mySuppress, convertedResult); } } return convertedResult; } finally { invoke(pool, "release"); } }
From source file:com.intellij.ui.mac.MacMessagesImpl.java
License:Apache License
@Override public int showMessageDialog(@NotNull final String title, final String message, @NotNull final String[] buttons, final boolean errorStyle, @Nullable Window window, final int defaultOptionIndex, final int focusedOptionIndex, @Nullable final DialogWrapper.DoNotAskOption doNotAskDialogOption) { ID pool = invoke(invoke("NSAutoreleasePool", "alloc"), "init"); try {//from ww w. jav a 2s . c o m final ID buttonsArray = invoke("NSMutableArray", "array"); for (String s : buttons) { ID s1 = nsString(UIUtil.removeMnemonic(s)); invoke(buttonsArray, "addObject:", s1); } Map<Enum, Object> params = new HashMap<Enum, Object>(); params.put(COMMON_DIALOG_PARAM_TYPE.title, nsString(title)); // replace % -> %% to avoid formatted parameters (causes SIGTERM) params.put(COMMON_DIALOG_PARAM_TYPE.message, nsString(StringUtil.stripHtml(message == null ? "" : message, true).replace("%", "%%"))); params.put(COMMON_DIALOG_PARAM_TYPE.errorStyle, nsString(errorStyle ? "error" : "-1")); params.put(COMMON_DIALOG_PARAM_TYPE.doNotAskDialogOption1, nsString(doNotAskDialogOption == null || !doNotAskDialogOption.canBeHidden() // TODO: state=!doNotAsk.shouldBeShown() ? "-1" : doNotAskDialogOption.getDoNotShowMessage())); params.put(COMMON_DIALOG_PARAM_TYPE.doNotAskDialogOption2, nsString( doNotAskDialogOption != null && !doNotAskDialogOption.isToBeShown() ? "checked" : "-1")); params.put(MESSAGE_DIALOG_PARAM_TYPE.defaultOptionIndex, nsString(Integer.toString(defaultOptionIndex))); params.put(MESSAGE_DIALOG_PARAM_TYPE.focusedOptionIndex, nsString(Integer.toString(focusedOptionIndex))); params.put(MESSAGE_DIALOG_PARAM_TYPE.buttonsArray, buttonsArray); MessageResult result = resultsFromDocumentRoot.remove(showDialog(window, "showVariableButtonsSheet:", new DialogParamsWrapper(DialogParamsWrapper.DialogType.message, params))); final int code = convertReturnCodeFromNativeMessageDialog(result.myReturnCode); final int cancelCode = buttons.length - 1; if (doNotAskDialogOption != null && doNotAskDialogOption.canBeHidden()) { if (cancelCode != code || doNotAskDialogOption.shouldSaveOptionsOnCancel()) { doNotAskDialogOption.setToBeShown(!result.mySuppress, code); } } return code; } finally { invoke(pool, "release"); } }