use of org.phoenicis.scripts.interpreter.InteractiveScriptSession in project POL-POM-5 by PlayOnLinux.
the class ShortcutManager method uninstallFromShortcut.
public void uninstallFromShortcut(ShortcutDTO shortcutDTO, 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("uninstall");
}, errorCallback), errorCallback);
}
use of org.phoenicis.scripts.interpreter.InteractiveScriptSession in project POL-POM-5 by PlayOnLinux.
the class ShortcutRunner method stop.
public void stop(ShortcutDTO shortcutDTO, 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("stop");
}, errorCallback), errorCallback);
}
use of org.phoenicis.scripts.interpreter.InteractiveScriptSession in project POL-POM-5 by PlayOnLinux.
the class WinePrefixContainerController method killProcesses.
public void killProcesses(WinePrefixContainerDTO winePrefix, Runnable doneCallback, Consumer<Exception> errorCallback) {
final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession();
interactiveScriptSession.eval("include([\"Functions\", \"Engines\", \"Wine\"]);", ignored -> interactiveScriptSession.eval("new Wine()", output -> {
final ScriptObjectMirror wine = (ScriptObjectMirror) output;
wine.callMember("prefix", winePrefix.getName());
wine.callMember("kill");
doneCallback.run();
}, errorCallback), errorCallback);
}
use of org.phoenicis.scripts.interpreter.InteractiveScriptSession in project POL-POM-5 by PlayOnLinux.
the class EnginesSource method fetchAvailableEngines.
public void fetchAvailableEngines(Consumer<List<EngineCategoryDTO>> callback) {
final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession();
List<EngineCategoryDTO> engines = new ArrayList<>();
interactiveScriptSession.eval("include([\"Functions\", \"Engines\", \"Wine\"]);", ignored -> interactiveScriptSession.eval("new Wine().getAvailableVersions()", output -> {
EngineCategoryDTO wine = new EngineCategoryDTO.Builder().withName("Wine").withDescription("Wine").withSubCategories(unSerialize(output)).build();
engines.add(wine);
callback.accept(engines);
}, this::throwError), this::throwError);
}
use of org.phoenicis.scripts.interpreter.InteractiveScriptSession in project POL-POM-5 by PlayOnLinux.
the class WinePrefixContainerController method runInPrefix.
public void runInPrefix(WinePrefixContainerDTO winePrefix, String command, Runnable doneCallback, Consumer<Exception> errorCallback) {
final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession();
interactiveScriptSession.eval("include([\"Functions\", \"Engines\", \"Wine\"]);", ignored -> interactiveScriptSession.eval("new Wine()", output -> {
final ScriptObjectMirror wine = (ScriptObjectMirror) output;
wine.callMember("prefix", winePrefix.getName());
wine.callMember("run", command);
wine.callMember("wait");
doneCallback.run();
}, errorCallback), errorCallback);
}
Aggregations