Search in sources :

Example 1 with EngineDTO

use of org.phoenicis.engines.dto.EngineDTO in project POL-POM-5 by PlayOnLinux.

the class EnginesController method installEngine.

private void installEngine(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("install", engineDTO.getCategory(), engineDTO.getSubCategory(), engineDTO.getVersion(), engineDTO.getUserData());
    }, errorCallback), errorCallback);
}
Also used : Files(java.nio.file.Files) ErrorMessage(org.phoenicis.javafx.views.common.ErrorMessage) LoggerFactory(org.slf4j.LoggerFactory) ScriptInterpreter(org.phoenicis.scripts.interpreter.ScriptInterpreter) IOException(java.io.IOException) Localisation.tr(org.phoenicis.configuration.localisation.Localisation.tr) AppsController(org.phoenicis.javafx.controller.apps.AppsController) File(java.io.File) Platform(javafx.application.Platform) Consumer(java.util.function.Consumer) List(java.util.List) EngineDTO(org.phoenicis.engines.dto.EngineDTO) EnginesSource(org.phoenicis.engines.EnginesSource) EngineCategoryDTO(org.phoenicis.engines.dto.EngineCategoryDTO) ViewEngines(org.phoenicis.javafx.views.mainwindow.engines.ViewEngines) ScriptObjectMirror(jdk.nashorn.api.scripting.ScriptObjectMirror) ConfirmMessage(org.phoenicis.javafx.views.common.ConfirmMessage) URI(java.net.URI) InteractiveScriptSession(org.phoenicis.scripts.interpreter.InteractiveScriptSession) Path(java.nio.file.Path) ThemeManager(org.phoenicis.javafx.views.common.ThemeManager) ScriptObjectMirror(jdk.nashorn.api.scripting.ScriptObjectMirror) InteractiveScriptSession(org.phoenicis.scripts.interpreter.InteractiveScriptSession)

Example 2 with EngineDTO

use of org.phoenicis.engines.dto.EngineDTO 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);
}
Also used : Files(java.nio.file.Files) ErrorMessage(org.phoenicis.javafx.views.common.ErrorMessage) LoggerFactory(org.slf4j.LoggerFactory) ScriptInterpreter(org.phoenicis.scripts.interpreter.ScriptInterpreter) IOException(java.io.IOException) Localisation.tr(org.phoenicis.configuration.localisation.Localisation.tr) AppsController(org.phoenicis.javafx.controller.apps.AppsController) File(java.io.File) Platform(javafx.application.Platform) Consumer(java.util.function.Consumer) List(java.util.List) EngineDTO(org.phoenicis.engines.dto.EngineDTO) EnginesSource(org.phoenicis.engines.EnginesSource) EngineCategoryDTO(org.phoenicis.engines.dto.EngineCategoryDTO) ViewEngines(org.phoenicis.javafx.views.mainwindow.engines.ViewEngines) ScriptObjectMirror(jdk.nashorn.api.scripting.ScriptObjectMirror) ConfirmMessage(org.phoenicis.javafx.views.common.ConfirmMessage) URI(java.net.URI) InteractiveScriptSession(org.phoenicis.scripts.interpreter.InteractiveScriptSession) Path(java.nio.file.Path) ThemeManager(org.phoenicis.javafx.views.common.ThemeManager) ScriptObjectMirror(jdk.nashorn.api.scripting.ScriptObjectMirror) InteractiveScriptSession(org.phoenicis.scripts.interpreter.InteractiveScriptSession)

Aggregations

File (java.io.File)2 IOException (java.io.IOException)2 URI (java.net.URI)2 Files (java.nio.file.Files)2 Path (java.nio.file.Path)2 List (java.util.List)2 Consumer (java.util.function.Consumer)2 Platform (javafx.application.Platform)2 ScriptObjectMirror (jdk.nashorn.api.scripting.ScriptObjectMirror)2 Localisation.tr (org.phoenicis.configuration.localisation.Localisation.tr)2 EnginesSource (org.phoenicis.engines.EnginesSource)2 EngineCategoryDTO (org.phoenicis.engines.dto.EngineCategoryDTO)2 EngineDTO (org.phoenicis.engines.dto.EngineDTO)2 AppsController (org.phoenicis.javafx.controller.apps.AppsController)2 ConfirmMessage (org.phoenicis.javafx.views.common.ConfirmMessage)2 ErrorMessage (org.phoenicis.javafx.views.common.ErrorMessage)2 ThemeManager (org.phoenicis.javafx.views.common.ThemeManager)2 ViewEngines (org.phoenicis.javafx.views.mainwindow.engines.ViewEngines)2 InteractiveScriptSession (org.phoenicis.scripts.interpreter.InteractiveScriptSession)2 ScriptInterpreter (org.phoenicis.scripts.interpreter.ScriptInterpreter)2