2525import javax .swing .JFileChooser ;
2626import javax .swing .JLabel ;
2727import javax .swing .JPanel ;
28+ import javax .swing .JSplitPane ;
2829import javax .swing .JTable ;
2930import javax .swing .table .TableColumn ;
3031import javax .swing .table .TableCellEditor ;
3334import org .knime .core .data .DataTableSpec ;
3435import org .knime .core .node .*;
3536
36- // import javax.swing.JScrollPane;
37- // import javax.swing.JTextArea;
38- // import java.awt.Font;
37+ import javax .swing .JScrollPane ;
38+ import javax .swing .JTextArea ;
39+ import java .awt .Font ;
3940
4041import org .fife .ui .rtextarea .*;
4142import org .fife .ui .rsyntaxtextarea .*;
@@ -47,6 +48,9 @@ public class RubyScriptNodeDialog extends NodeDialogPane {
4748 //private JTextArea scriptTextArea = new JTextArea();
4849 private RSyntaxTextArea m_scriptTextArea = new RSyntaxTextArea ();
4950
51+ private JTextArea m_errorMessage = new JTextArea ();
52+ private JScrollPane m_sp_errorMessage = new JScrollPane (m_errorMessage );
53+
5054 private JTable table ;
5155 private int counter = 1 ;
5256 private JCheckBox m_appendColsCB ;
@@ -58,18 +62,23 @@ public class RubyScriptNodeDialog extends NodeDialogPane {
5862 */
5963 protected RubyScriptNodeDialog (RubyScriptNodeFactory factory ) {
6064 super ();
61-
65+
6266 m_factory = factory ;
6367
6468 //scriptTextArea.setAutoscrolls(true);
6569 //Font font = new Font(Font.MONOSPACED, Font.PLAIN, 12);
6670 //scriptTextArea.setFont(font);
67-
71+
6872 m_scriptTextArea .setSyntaxEditingStyle (SyntaxConstants .SYNTAX_STYLE_RUBY );
69- m_scriptTextArea .setCodeFoldingEnabled (true );
73+ m_scriptTextArea .setCodeFoldingEnabled (true );
7074 m_scriptTextArea .setAntiAliasingEnabled (true );
7175 RTextScrollPane spScript = new RTextScrollPane (m_scriptTextArea );
72- spScript .setFoldIndicatorEnabled (true );
76+ spScript .setFoldIndicatorEnabled (true );
77+
78+ Font font = new Font (Font .MONOSPACED , Font .PLAIN , 12 );
79+ m_errorMessage .setFont (font );
80+ m_errorMessage .setForeground (Color .RED );
81+ m_errorMessage .setEditable (false );
7382
7483 // construct the output column selection panel
7584 JPanel outputPanel = new JPanel ();
@@ -183,6 +192,9 @@ public void actionPerformed(final ActionEvent e) {
183192 }
184193
185194 m_scriptTextArea .setText (buffer .toString ());
195+
196+ m_scriptTextArea .removeAllLineHighlights ();
197+ m_sp_errorMessage .setVisible (false );
186198 }
187199 });
188200 scriptButton .setText ("Load Script from File" );
@@ -195,7 +207,11 @@ public void actionPerformed(final ActionEvent e) {
195207 //scriptMainPanel.add(new JScrollPane(scriptTextArea),
196208 // BorderLayout.CENTER);
197209
198- scriptMainPanel .add (spScript , BorderLayout .CENTER );
210+ //scriptMainPanel.add(spScript, BorderLayout.CENTER);
211+
212+ JSplitPane splitPane = new JSplitPane (JSplitPane .VERTICAL_SPLIT ,
213+ spScript , m_sp_errorMessage );
214+ scriptMainPanel .add (splitPane , BorderLayout .CENTER );
199215
200216 scriptPanel .add (scriptButtonPanel , BorderLayout .PAGE_START );
201217 scriptPanel .add (scriptMainPanel , BorderLayout .CENTER );
@@ -214,17 +230,26 @@ protected final void loadSettingsFrom(final NodeSettingsRO settings,
214230 script = "" ;
215231 }
216232 m_scriptTextArea .setText (script );
233+
217234 m_scriptTextArea .removeAllLineHighlights ();
235+ m_sp_errorMessage .setVisible (false );
236+ m_errorMessage .setText ("" );
218237 RubyScriptNodeModel .ScriptError error = m_factory .getModel ().getErrorData ();
219- if ( error .lineNum != -1 ) {
238+ if ( error .lineNum != -1 ) {
220239 try {
221240 m_scriptTextArea .addLineHighlight (error .lineNum - 1 , Color .red );
222241 } catch (BadLocationException e1 ) {
223242 // nothing to do
224243 // e1.printStackTrace();
225- }
244+ }
245+ StringBuilder outstr = new StringBuilder ();
246+ outstr .append (error .text );
247+ outstr .append ("\n line:\t class ( method )\t file\n " );
248+ outstr .append (error .trace );
249+ m_errorMessage .setText (outstr .toString ());
250+
251+ m_sp_errorMessage .setVisible (true );
226252 }
227-
228253
229254 boolean appendCols = settings .getBoolean (
230255 RubyScriptNodeModel .APPEND_COLS , true );
0 commit comments