From 8211902ca017b1607f9a2c8e7a616ee501121f1e Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 21 Dec 2013 06:47:36 +0000 Subject: [PATCH] * print result --- source/net/sourceforge/filebot/cli/GroovyPad.java | 10 ++++++++-- source/net/sourceforge/filebot/ui/MainFrame.java | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/net/sourceforge/filebot/cli/GroovyPad.java b/source/net/sourceforge/filebot/cli/GroovyPad.java index ccb2a158..f233ec66 100644 --- a/source/net/sourceforge/filebot/cli/GroovyPad.java +++ b/source/net/sourceforge/filebot/cli/GroovyPad.java @@ -228,8 +228,14 @@ public class GroovyPad extends JFrame { try { result = shell.evaluate(script, new SimpleBindings(), true); - // make sure to flush Groovy output - shell.evaluate("println()", new SimpleBindings(), true); + // print result and make sure to flush Groovy output + SimpleBindings binding = new SimpleBindings(); + binding.put("result", result); + if (result != null) { + shell.evaluate("print('Result: '); println(result);", binding, true); + } else { + shell.evaluate("println();", binding, true); + } } catch (ScriptException e) { e.getCause().getCause().printStackTrace(); } catch (Throwable e) { diff --git a/source/net/sourceforge/filebot/ui/MainFrame.java b/source/net/sourceforge/filebot/ui/MainFrame.java index dfa6b5dc..1b15234a 100644 --- a/source/net/sourceforge/filebot/ui/MainFrame.java +++ b/source/net/sourceforge/filebot/ui/MainFrame.java @@ -117,7 +117,7 @@ public class MainFrame extends JFrame { @Override public void actionPerformed(ActionEvent evt) { - MainFrame.this.dispose(); + MainFrame.this.setVisible(false); GroovyPad.main(new String[0]); } });