* print result
This commit is contained in:
parent
16facbde0c
commit
8211902ca0
@ -228,8 +228,14 @@ public class GroovyPad extends JFrame {
|
|||||||
try {
|
try {
|
||||||
result = shell.evaluate(script, new SimpleBindings(), true);
|
result = shell.evaluate(script, new SimpleBindings(), true);
|
||||||
|
|
||||||
// make sure to flush Groovy output
|
// print result and make sure to flush Groovy output
|
||||||
shell.evaluate("println()", new SimpleBindings(), true);
|
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) {
|
} catch (ScriptException e) {
|
||||||
e.getCause().getCause().printStackTrace();
|
e.getCause().getCause().printStackTrace();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -117,7 +117,7 @@ public class MainFrame extends JFrame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
MainFrame.this.dispose();
|
MainFrame.this.setVisible(false);
|
||||||
GroovyPad.main(new String[0]);
|
GroovyPad.main(new String[0]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user