// Path: src/hexgui/gui/GuiUtil.java
// public static String insertLineBreaks(String message)
// {
//     final int MAX_CHAR_PER_LINE = 72;
//     int length = message.length();
//     if (length < MAX_CHAR_PER_LINE)
//         return message;
//     StringBuilder buffer = new StringBuilder();
//     int startLine = 0;
//     int lastWhiteSpace = -1;
//     for (int pos = 0; pos < length; ++pos)
//     {
//         char c = message.charAt(pos);
//         if (pos - startLine > 72)
//         {
//             int endLine =
//                 (lastWhiteSpace > startLine ? lastWhiteSpace : pos);
//             if (buffer.length() > 0)
//                 buffer.append("<br>");
//             buffer.append(message.substring(startLine, endLine));
//             startLine = endLine;
//         }
//         if (Character.isWhitespace(c))
//             lastWhiteSpace = pos;
//     }
//     if (buffer.length() > 0)
//         buffer.append("<br>");
//     buffer.append(message.substring(startLine));
//     return buffer.toString();
// }


import java.awt.Component;
import java.util.TreeSet;
import java.util.Set;
import java.util.prefs.Preferences;
import javax.swing.Box;
import javax.swing.JComponent;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import static hexgui.gui.GuiUtil.insertLineBreaks;
import hexgui.util.Platform;
import hexgui.util.PrefUtil;
import hexgui.util.StringUtils;
    private boolean checkDisabled(String disableKey)
    {
        if (disableKey == null)
            return false;
        Preferences prefs =
            PrefUtil.createNode("net/sf/hexgui/gui/messagedialogs/disabled");
        boolean permanentlyDisabled = prefs.getBoolean(disableKey, false);
        if (permanentlyDisabled)
            return true;
        // Make sure this entry exists (right now these settings can only
        // be directly edited in the backing store)
        prefs.putBoolean(disableKey, permanentlyDisabled);
        return m_disabled.contains(disableKey);
    }

    private Object show(String disableKey, Component parent, String title,
                        String mainMessage, String optionalMessage,
                        int messageType, int optionType, Object[] options,
                        Object defaultOption, int destructiveIndex)
    {
        if (optionalMessage == null)
            optionalMessage = "";
        boolean isMac = Platform.isMac();
        Box box = Box.createVerticalBox();

        String css = GuiUtil.getMessageCss();

        JLabel label =
            new JLabel("<html>" + css + "<b>" + insertLineBreaks(mainMessage)
                       + "</b><p>"
// Path: src/hexgui/gui/GuiUtil.java
// public static String insertLineBreaks(String message)
// {
//     final int MAX_CHAR_PER_LINE = 72;
//     int length = message.length();
//     if (length < MAX_CHAR_PER_LINE)
//         return message;
//     StringBuilder buffer = new StringBuilder();
//     int startLine = 0;
//     int lastWhiteSpace = -1;
//     for (int pos = 0; pos < length; ++pos)
//     {
//         char c = message.charAt(pos);
//         if (pos - startLine > 72)
//         {
//             int endLine =
//                 (lastWhiteSpace > startLine ? lastWhiteSpace : pos);
//             if (buffer.length() > 0)
//                 buffer.append("<br>");
//             buffer.append(message.substring(startLine, endLine));
//             startLine = endLine;
//         }
//         if (Character.isWhitespace(c))
//             lastWhiteSpace = pos;
//     }
//     if (buffer.length() > 0)
//         buffer.append("<br>");
//     buffer.append(message.substring(startLine));
//     return buffer.toString();
// }


// Path: src/hexgui/gui/MessageDialogs.java
import java.awt.Component;
import java.util.TreeSet;
import java.util.Set;
import java.util.prefs.Preferences;
import javax.swing.Box;
import javax.swing.JComponent;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import static hexgui.gui.GuiUtil.insertLineBreaks;
import hexgui.util.Platform;
import hexgui.util.PrefUtil;
import hexgui.util.StringUtils;

    private boolean checkDisabled(String disableKey)
    {
        if (disableKey == null)
            return false;
        Preferences prefs =
            PrefUtil.createNode("net/sf/hexgui/gui/messagedialogs/disabled");
        boolean permanentlyDisabled = prefs.getBoolean(disableKey, false);
        if (permanentlyDisabled)
            return true;
        // Make sure this entry exists (right now these settings can only
        // be directly edited in the backing store)
        prefs.putBoolean(disableKey, permanentlyDisabled);
        return m_disabled.contains(disableKey);
    }

    private Object show(String disableKey, Component parent, String title,
                        String mainMessage, String optionalMessage,
                        int messageType, int optionType, Object[] options,
                        Object defaultOption, int destructiveIndex)
    {
        if (optionalMessage == null)
            optionalMessage = "";
        boolean isMac = Platform.isMac();
        Box box = Box.createVerticalBox();

        String css = GuiUtil.getMessageCss();

        JLabel label =
            new JLabel("<html>" + css + "<b>" + insertLineBreaks(mainMessage)
                       + "</b><p>"
                       + insertLineBreaks(optionalMessage) + "</p>");