From 041a9c3c008ec05604e8a8ecb7feedf5743c135b Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Thu, 11 Jul 2024 13:26:00 -0400 Subject: [PATCH 1/2] Adding Jar files to the standalone file handeling https://github.com/CommonWealthRobotics/BowlerStudio/issues/409 --- .../bowlerstudio/scripting/DownloadManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/DownloadManager.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/DownloadManager.java index c846e0df..60e4fc35 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/DownloadManager.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/DownloadManager.java @@ -332,8 +332,11 @@ private static File getExecutable(String exeType, IExternalEditor editor, String if (type.toLowerCase().contains("dmg")) { dmgExtract(jvmArchive, bindir + targetdir, exeInZip); } - if (type.toLowerCase().contains("appimage") || type.toLowerCase().contains("exe") - || type.toLowerCase().contains("msi")) { + if ( type.toLowerCase().contains("appimage") || + type.toLowerCase().contains("exe") || + type.toLowerCase().contains("msi")|| + type.toLowerCase().contains("jar") + ) { standaloneEXE(type, name, targetdir, cmd); } // extract7zArchive From 0e3afaa6bdbe7915fc95def6d9d0c06b550c4ccc Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Thu, 11 Jul 2024 13:41:46 -0400 Subject: [PATCH 2/2] Adding a runner for fxml files https://github.com/CommonWealthRobotics/BowlerStudio/issues/409 --- .../scripting/FXMLBowlerLoader.java | 56 +++++++++++++++++++ .../scripting/ScriptingEngine.java | 1 + 2 files changed, 57 insertions(+) create mode 100644 src/main/java/com/neuronrobotics/bowlerstudio/scripting/FXMLBowlerLoader.java diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/FXMLBowlerLoader.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/FXMLBowlerLoader.java new file mode 100644 index 00000000..dd7a8202 --- /dev/null +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/FXMLBowlerLoader.java @@ -0,0 +1,56 @@ +package com.neuronrobotics.bowlerstudio.scripting; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; + +import com.neuronrobotics.bowlerstudio.vitamins.Vitamins; + +import eu.mihosoft.vrl.v3d.CSG; +import javafx.fxml.FXMLLoader; +import javafx.scene.control.Tab; +import javafx.scene.layout.Pane; + +public class FXMLBowlerLoader implements IScriptingLanguage { + + @Override + public Object inlineScriptRun(File xml, ArrayList args) throws Exception { + FXMLLoader loader = new FXMLLoader(xml.toURI().toURL()); + Pane newLoadedPane = loader.load(); + // Create a tab + Tab myTab = new Tab(); + //set the title of the new tab + myTab.setContent(newLoadedPane); + return myTab; + } + + @Override + public Object inlineScriptRun(String code, ArrayList args) throws Exception { + throw new RuntimeException("This engine only supports files"); + } + + @Override + public String getShellType() { + // TODO Auto-generated method stub + return "fxml"; + } + @Override + public boolean getIsTextFile() { + // TODO Auto-generated method stub + return true; + } + /** + * Get the contents of an empty file + * + * @return + */ + public String getDefaultContents() { + return ""; + } + @Override + public ArrayList getFileExtenetion() { + // TODO Auto-generated method stub + return new ArrayList<>(Arrays.asList("fxml","FXML","FxML")); + } + +} diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingEngine.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingEngine.java index 06060c90..782e6712 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingEngine.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingEngine.java @@ -146,6 +146,7 @@ public class ScriptingEngine {// this subclasses boarder pane for the widgets addScriptingLanguage(new SequenceRunner()); addScriptingLanguage(new BlenderLoader()); addScriptingLanguage(new FreecadLoader()); + addScriptingLanguage(new FXMLBowlerLoader()); } public static void setWorkspace(File file) {