/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:set ts=4 sw=4 sts=4 et: */
package jp.oist.flint.form;

import jp.oist.flint.desktop.Desktop;
import java.awt.Dimension;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class ModelLoaderLogger implements IFrame {

    private final ArrayList<String> mLines = new ArrayList<>();

    private final Desktop mDesktop;

    public ModelLoaderLogger(Desktop desktop) {
        mDesktop = desktop;
    }

    public Desktop getDesktop() {
        return mDesktop;
    }

    @Override
    public void appendLog(String s) {
        mLines.add(s);
    }

    @Override
    public void showErrorDialog(String message, String title) {
        JTextArea textArea = new JTextArea(message);
        textArea.setEditable(false);
        textArea.append(System.getProperty("line.separator"));
        for (String line : mLines) {
            textArea.append(System.getProperty("line.separator"));
            textArea.append(line);
        }
        JScrollPane scrollPane = new JScrollPane(textArea);
        scrollPane.setPreferredSize(new Dimension(400, 100));
        JOptionPane.showMessageDialog(mDesktop.getPane(), scrollPane, title, JOptionPane.ERROR_MESSAGE);
    }
}

@@ -187,23 +187,150 @@
 a.awt.Di
-mension
+alog;%0Aimport java.awt.Dimension;%0Aimport java.awt.Window;%0Aimport java.awt.event.HierarchyEvent;%0Aimport java.awt.event.HierarchyListener
 ;%0Aimport
@@ -444,16 +444,51 @@
 extArea;
+%0Aimport javax.swing.SwingUtilities;
 %0A%0Apublic
@@ -1254,16 +1254,22 @@
         
+final 
 JScrollP
@@ -1312,16 +1312,635 @@
 tArea);%0A
+        // Trick for a resizeable JOptionPane dialog from:%0A        // %3Chttps://blogs.oracle.com/scblog/entry/tip_making_joptionpane_dialog_resizable%3E%0A        scrollPane.addHierarchyListener(new HierarchyListener() %7B%0A            @Override%0A            public void hierarchyChanged(HierarchyEvent e) %7B%0A                Window window = SwingUtilities.getWindowAncestor(scrollPane);%0A                if (window instanceof Dialog) %7B%0A                    Dialog dialog = (Dialog)window;%0A                    if (!dialog.isResizable())%0A                        dialog.setResizable(true);%0A                %7D%0A            %7D%0A        %7D);%0A
         

Make the error dialog resizeable