diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-03-27 09:54:17 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2019-12-15 21:06:46 +0100 |
commit | 1afffe8d5d8b63289de331f8c7ed01933377d551 (patch) | |
tree | 3e3536ee8662d63e6ccbf697e995b52b938b1e52 /scripting/java | |
parent | 12b4efb1216fc494443795b06e9ad92bcad2c306 (diff) |
Beanshell: Wrap long error messages
Change-Id: I5e607f4b94733700810d37c289f6cc29492da5f2
Reviewed-on: https://gerrit.libreoffice.org/69798
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
(cherry picked from commit 3c72945de874aceb12a405c03f5b0c8b3937f5cf)
Reviewed-on: https://gerrit.libreoffice.org/85033
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'scripting/java')
-rw-r--r-- | scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java | 16 |
1 files changed, 14 insertions, 2 deletions
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 32fa751351d0..804cb9fbfb8e 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 @@ -41,6 +41,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; @@ -254,9 +255,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() { |