* print result

This commit is contained in:
Reinhard Pointner 2013-12-21 06:47:36 +00:00
parent 16facbde0c
commit 8211902ca0
2 changed files with 9 additions and 3 deletions

View File

@ -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) {

View File

@ -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]);
}
});