summaryrefslogtreecommitdiff
path: root/scripting/java
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-03-27 09:54:17 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-03-27 12:37:17 +0100
commit3c72945de874aceb12a405c03f5b0c8b3937f5cf (patch)
treef767d89208db1c64bcbc419a6ab98f5b5eb79682 /scripting/java
parent167812fe0d77b993427e7dca112f319a92942a3c (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>
Diffstat (limited to 'scripting/java')
-rw-r--r--scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java16
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 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() {