From 01d37e4854d4f2ad1f4cfa8def42266bafc2bd41 Mon Sep 17 00:00:00 2001 From: Plata Date: Thu, 12 Apr 2018 18:33:14 +0200 Subject: [PATCH] Object oriented engine tools --- Engines/Wine/Tools/Configure Wine/script.js | 32 +++++----------- .../Wine/Tools/Kill Wine Processes/script.js | 32 +++++----------- Engines/Wine/Tools/Reboot Wine/script.js | 32 +++++----------- .../Wine/Tools/Repair Wine Prefix/script.js | 32 +++++----------- .../Wine/Tools/Wine Registry Editor/script.js | 32 +++++----------- .../Wine/Tools/Wine Task Manager/script.js | 32 +++++----------- .../Wine/Tools/Wine Terminal Opener/script.js | 38 ++++++------------- Engines/Wine/Tools/Wine Uninstaller/script.js | 33 +++++----------- Engines/Wine/Tools/WineConsole/script.js | 32 +++++----------- 9 files changed, 85 insertions(+), 210 deletions(-) diff --git a/Engines/Wine/Tools/Configure Wine/script.js b/Engines/Wine/Tools/Configure Wine/script.js index 1ca87362ee..ef5e39245b 100644 --- a/Engines/Wine/Tools/Configure Wine/script.js +++ b/Engines/Wine/Tools/Configure Wine/script.js @@ -2,29 +2,15 @@ include(["engines", "wine", "engine", "object"]); /** * tool to configure Wine - * @constructor - */ -var ConfigureWine = function () { -}; - -/** -* runs the tool -* @param {String} container name -* @returns {void} */ -ConfigureWine.prototype.run = function (container) { - new Wine() - .prefix(container) - .run("winecfg") - .wait(); +var toolImplementation = { + run: function (container) { + new Wine() + .prefix(container) + .run("winecfg") + .wait(); + } }; -/** -* runs the ConfigureWine tool -* @param {String} container name -* @returns {void} -*/ -function run(container) { // eslint-disable-line no-unused-vars - var tool = new ConfigureWine(); - tool.run(container); -} +/* exported Tool */ +var Tool = Java.extend(org.phoenicis.engines.EngineTool, toolImplementation); diff --git a/Engines/Wine/Tools/Kill Wine Processes/script.js b/Engines/Wine/Tools/Kill Wine Processes/script.js index 71749a0f52..390cb3876d 100644 --- a/Engines/Wine/Tools/Kill Wine Processes/script.js +++ b/Engines/Wine/Tools/Kill Wine Processes/script.js @@ -2,29 +2,15 @@ include(["engines", "wine", "engine", "object"]); /** * tool to kill running Wine processes - * @constructor - */ -var KillWineProcesses = function () { -}; - -/** -* runs the tool -* @param {String} container name -* @returns {void} */ -KillWineProcesses.prototype.run = function (container) { - new Wine() - .prefix(container) - .run("kill") - .wait(); +var toolImplementation = { + run: function (container) { + new Wine() + .prefix(container) + .run("kill") + .wait(); + } }; -/** -* runs the KillWineProcesses tool -* @param {String} container name -* @returns {void} -*/ -function run(container) { // eslint-disable-line no-unused-vars - var tool = new KillWineProcesses(); - tool.run(container); -} +/* exported Tool */ +var Tool = Java.extend(org.phoenicis.engines.EngineTool, toolImplementation); diff --git a/Engines/Wine/Tools/Reboot Wine/script.js b/Engines/Wine/Tools/Reboot Wine/script.js index d3c040821a..ab34a6e7e6 100644 --- a/Engines/Wine/Tools/Reboot Wine/script.js +++ b/Engines/Wine/Tools/Reboot Wine/script.js @@ -2,29 +2,15 @@ include(["engines", "wine", "engine", "object"]); /** * tool to reboot Wine - * @constructor - */ -var RebootWine = function () { -}; - -/** -* runs the tool -* @param {String} container name -* @returns {void} */ -RebootWine.prototype.run = function (container) { - new Wine() - .prefix(container) - .run("wineboot") - .wait(); +var toolImplementation = { + run: function (container) { + new Wine() + .prefix(container) + .run("wineboot") + .wait(); + } }; -/** -* runs the RebootWine tool -* @param {String} container name -* @returns {void} -*/ -function run(container) { // eslint-disable-line no-unused-vars - var tool = new RebootWine(); - tool.run(container); -} +/* exported Tool */ +var Tool = Java.extend(org.phoenicis.engines.EngineTool, toolImplementation); diff --git a/Engines/Wine/Tools/Repair Wine Prefix/script.js b/Engines/Wine/Tools/Repair Wine Prefix/script.js index 9c0db68824..9d18fdae3f 100644 --- a/Engines/Wine/Tools/Repair Wine Prefix/script.js +++ b/Engines/Wine/Tools/Repair Wine Prefix/script.js @@ -2,29 +2,15 @@ include(["engines", "wine", "engine", "object"]); /** * tool to repair a Wine prefix - * @constructor - */ -var RepairWinePrefix = function () { -}; - -/** -* runs the tool -* @param {String} container name -* @returns {void} */ -RepairWinePrefix.prototype.run = function (container) { - new Wine() - .prefix(container) - .run("wineboot") - .wait(); +var toolImplementation = { + run: function (container) { + new Wine() + .prefix(container) + .run("wineboot") + .wait(); + } }; -/** -* runs the RepairWinePrefix tool -* @param {String} container name -* @returns {void} -*/ -function run(container) { // eslint-disable-line no-unused-vars - var tool = new RepairWinePrefix(); - tool.run(container); -} +/* exported Tool */ +var Tool = Java.extend(org.phoenicis.engines.EngineTool, toolImplementation); diff --git a/Engines/Wine/Tools/Wine Registry Editor/script.js b/Engines/Wine/Tools/Wine Registry Editor/script.js index d505c8eb2a..a86ee57d46 100644 --- a/Engines/Wine/Tools/Wine Registry Editor/script.js +++ b/Engines/Wine/Tools/Wine Registry Editor/script.js @@ -2,29 +2,15 @@ include(["engines", "wine", "engine", "object"]); /** * tool to open the Wine registry editor - * @constructor - */ -var WineRegistryEditor = function () { -}; - -/** -* runs the tool -* @param {String} container name -* @returns {void} */ -WineRegistryEditor.prototype.run = function (container) { - new Wine() - .prefix(container) - .run("regedit") - .wait(); +var toolImplementation = { + run: function (container) { + new Wine() + .prefix(container) + .run("regedit") + .wait(); + } }; -/** -* runs the WineRegistryEditor tool -* @param {String} container name -* @returns {void} -*/ -function run(container) { // eslint-disable-line no-unused-vars - var tool = new WineRegistryEditor(); - tool.run(container); -} +/* exported Tool */ +var Tool = Java.extend(org.phoenicis.engines.EngineTool, toolImplementation); diff --git a/Engines/Wine/Tools/Wine Task Manager/script.js b/Engines/Wine/Tools/Wine Task Manager/script.js index d1af24b22a..0363ffe521 100644 --- a/Engines/Wine/Tools/Wine Task Manager/script.js +++ b/Engines/Wine/Tools/Wine Task Manager/script.js @@ -2,29 +2,15 @@ include(["engines", "wine", "engine", "object"]); /** * tool to open the Wine task manager - * @constructor - */ -var WineTaskManager = function () { -}; - -/** -* runs the tool -* @param {String} container name -* @returns {void} */ -WineTaskManager.prototype.run = function (container) { - new Wine() - .prefix(container) - .run("taskmgr") - .wait(); +var toolImplementation = { + run: function (container) { + new Wine() + .prefix(container) + .run("taskmgr") + .wait(); + } }; -/** -* runs the WineTaskManager tool -* @param {String} container name -* @returns {void} -*/ -function run(container) { // eslint-disable-line no-unused-vars - var tool = new WineTaskManager(); - tool.run(container); -} +/* exported Tool */ +var Tool = Java.extend(org.phoenicis.engines.EngineTool, toolImplementation); diff --git a/Engines/Wine/Tools/Wine Terminal Opener/script.js b/Engines/Wine/Tools/Wine Terminal Opener/script.js index a679e59e96..9a9276f834 100644 --- a/Engines/Wine/Tools/Wine Terminal Opener/script.js +++ b/Engines/Wine/Tools/Wine Terminal Opener/script.js @@ -2,32 +2,18 @@ include(["engines", "wine", "engine", "object"]); /** * tool to open a terminal in a Wine prefix - * @constructor */ -var WineTerminalOpener = function () { - this._TerminalOpener = Bean("terminalOpener"); +var toolImplementation = { + _TerminalOpener: Bean("terminalOpener"), + run: function (container) { + var wine = new Wine() + .prefix(container); + var environment = []; + environment["WINEPREFIX"] = wine.prefixDirectory; + environment["PATH"] = wine.binPath() + ":$PATH"; + this._TerminalOpener.openTerminal(wine.prefixDirectory, environment); + } }; -/** -* runs the tool -* @param {String} container name -* @returns {void} -*/ -WineTerminalOpener.prototype.run = function (container) { - var wine = new Wine() - .prefix(container); - var environment = []; - environment["WINEPREFIX"] = wine.prefixDirectory; - environment["PATH"] = wine.binPath() + ":$PATH"; - this._TerminalOpener.openTerminal(wine.prefixDirectory, environment); -}; - -/** -* runs the WineTerminalOpener tool -* @param {String} container name -* @returns {void} -*/ -function run(container) { // eslint-disable-line no-unused-vars - var tool = new WineTerminalOpener(); - tool.run(container); -} +/* exported Tool */ +var Tool = Java.extend(org.phoenicis.engines.EngineTool, toolImplementation); diff --git a/Engines/Wine/Tools/Wine Uninstaller/script.js b/Engines/Wine/Tools/Wine Uninstaller/script.js index 90445db908..d9ac9b7bca 100644 --- a/Engines/Wine/Tools/Wine Uninstaller/script.js +++ b/Engines/Wine/Tools/Wine Uninstaller/script.js @@ -2,29 +2,16 @@ include(["engines", "wine", "engine", "object"]); /** * tool to uninstall Wine - * @constructor - */ -var WineUninstaller = function () { -}; - -/** -* runs the tool -* @param {String} container name -* @returns {void} */ -WineUninstaller.prototype.run = function (container) { - new Wine() - .prefix(container) - .run("uninstaller") - .wait(); +var toolImplementation = { + run: function (container) { + new Wine() + .prefix(container) + .run("uninstaller") + .wait(); + } }; -/** -* runs the WineUninstaller tool -* @param {String} container name -* @returns {void} -*/ -function run(container) { // eslint-disable-line no-unused-vars - var tool = new WineUninstaller(); - tool.run(container); -} +/* exported Tool */ +var Tool = Java.extend(org.phoenicis.engines.EngineTool, toolImplementation); + diff --git a/Engines/Wine/Tools/WineConsole/script.js b/Engines/Wine/Tools/WineConsole/script.js index e534b1fb39..88b4fc7922 100644 --- a/Engines/Wine/Tools/WineConsole/script.js +++ b/Engines/Wine/Tools/WineConsole/script.js @@ -2,29 +2,15 @@ include(["engines", "wine", "engine", "object"]); /** * tool to open a Wine console - * @constructor - */ -var WineConsole = function () { -}; - -/** -* runs the tool -* @param {String} container name -* @returns {void} */ -WineConsole.prototype.run = function (container) { - new Wine() - .prefix(container) - .run("wineconsole") - .wait(); +var toolImplementation = { + run: function (container) { + new Wine() + .prefix(container) + .run("wineconsole") + .wait(); + } }; -/** -* runs the WineConsole tool -* @param {String} container name -* @returns {void} -*/ -function run(container) { // eslint-disable-line no-unused-vars - var tool = new WineConsole(); - tool.run(container); -} +/* exported Tool */ +var Tool = Java.extend(org.phoenicis.engines.EngineTool, toolImplementation);