public static void runJSR223Script(final Component parent, final ClientModel model, final File file,
final String ext, final Writer out) {
try {
parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByExtension(ext);
engine.getContext().setWriter(out);
engine.getContext().setErrorWriter(out);
engine.put("session", model.getClientSession().getSession());
engine.put("binding", model.getClientSession().getSession().getBinding());
engine.put("out", new PrintWriter(out));