[Libreoffice-commits] core.git: scripting/java

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 27 11:37:41 UTC 2019


 scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java |   16 ++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 3c72945de874aceb12a405c03f5b0c8b3937f5cf
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed Mar 27 09:54:17 2019 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Wed Mar 27 12:37:17 2019 +0100

    Beanshell: Wrap long error messages
    
    Change-Id: I5e607f4b94733700810d37c289f6cc29492da5f2
    Reviewed-on: https://gerrit.libreoffice.org/69798
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
index 5cb701e5bb79..91bd98894798 100644
--- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
+++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
@@ -42,6 +42,7 @@ import java.util.Map;
 
 import javax.swing.JButton;
 import javax.swing.JComponent;
+import javax.swing.JDialog;
 import javax.swing.JFrame;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
@@ -265,9 +266,20 @@ public class ScriptEditorForBeanShell implements ScriptEditor, ActionListener {
         frame.setVisible(true);
     }
 
+    // Wraps long error messages
+    class NarrowOptionPane extends JOptionPane {
+        private static final long serialVersionUID = 1L;
+        public int getMaxCharactersPerLineCount() {
+            return 100;
+        }
+    }
+
     private void showErrorMessage(String message) {
-        JOptionPane.showMessageDialog(frame, message,
-                                      "Error", JOptionPane.ERROR_MESSAGE);
+        JOptionPane optionPane = new NarrowOptionPane();
+        optionPane.setMessage(message);
+        optionPane.setMessageType(JOptionPane.ERROR_MESSAGE);
+        JDialog dialog = optionPane.createDialog(null, "Error");
+        dialog.setVisible(true);
     }
 
     private void initUI() {


More information about the Libreoffice-commits mailing list