use of org.phoenicis.scripts.interpreter.InteractiveScriptSession in project POL-POM-5 by PlayOnLinux.
the class EnginesController method deleteEngine.
private void deleteEngine(EngineDTO engineDTO, Consumer<Exception> errorCallback) {
final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession();
interactiveScriptSession.eval("include([\"Functions\", \"Engines\", \"" + engineDTO.getCategory() + "\"]);", ignored -> interactiveScriptSession.eval("new Wine()", output -> {
final ScriptObjectMirror wine = (ScriptObjectMirror) output;
wine.callMember("delete", engineDTO.getCategory(), engineDTO.getSubCategory(), engineDTO.getVersion(), engineDTO.getUserData());
}, errorCallback), errorCallback);
}
use of org.phoenicis.scripts.interpreter.InteractiveScriptSession in project POL-POM-5 by PlayOnLinux.
the class ConsoleController method createConsole.
public ConsoleTab createConsole() {
final ConsoleTab consoleTab = consoleTabFactory.createInstance();
final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession();
consoleTab.setOnSendCommand(command -> {
consoleTab.appendTextToConsole("> " + command + "\n", ConsoleTextType.NORMAL);
consoleTab.disableCommand();
interactiveScriptSession.eval(command, result -> {
consoleTab.appendTextToConsole(result == null ? "null\n" : result.toString() + "\n");
consoleTab.enableCommand();
}, error -> {
consoleTab.appendTextToConsole(ExceptionUtils.getFullStackTrace(error), ConsoleTextType.ERROR);
consoleTab.enableCommand();
});
});
return consoleTab;
}
use of org.phoenicis.scripts.interpreter.InteractiveScriptSession in project POL-POM-5 by PlayOnLinux.
the class ShortcutRunner method run.
public void run(ShortcutDTO shortcutDTO, List<String> arguments, Consumer<Exception> errorCallback) {
final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession();
interactiveScriptSession.eval("include([\"Functions\", \"Shortcuts\", \"Reader\"]);", ignored -> interactiveScriptSession.eval("new ShortcutReader()", output -> {
final ScriptObjectMirror shortcutReader = (ScriptObjectMirror) output;
shortcutReader.callMember("of", shortcutDTO);
shortcutReader.callMember("run", arguments);
}, errorCallback), errorCallback);
}
Aggregations