From 232fc0c6897565f410a2db49e8dc3439d82ca092 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Mon, 2 Dec 2024 00:11:31 -0500 Subject: [PATCH] Add deprecation warning --- .../edu/wpi/first/pathweaver/PathWeaver.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/wpi/first/pathweaver/PathWeaver.java b/src/main/java/edu/wpi/first/pathweaver/PathWeaver.java index 78af611d..00bf565e 100644 --- a/src/main/java/edu/wpi/first/pathweaver/PathWeaver.java +++ b/src/main/java/edu/wpi/first/pathweaver/PathWeaver.java @@ -4,11 +4,17 @@ import edu.wpi.first.pathweaver.extensions.ExtensionManager; import edu.wpi.first.util.CombinedRuntimeLoader; import edu.wpi.first.util.WPIUtilJNI; +import java.awt.Deskop; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import javafx.application.Application; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; +import javafx.scene.control.Alert; +import javafx.scene.control.Alert.AlertType; +import javafx.scene.control.ButtonType; import javafx.scene.layout.Pane; import javafx.stage.Stage; @@ -20,7 +26,7 @@ public void start(Stage primaryStage) throws IOException { WPIUtilJNI.Helper.setExtractOnStaticLoad(false); TrajectoryUtilJNI.Helper.setExtractOnStaticLoad(false); CombinedRuntimeLoader.loadLibraries(PathWeaver.class, "wpiutiljni", - "wpimathjni"); + "wpimathjni"); ExtensionManager.getInstance().refresh(); Pane root = FXMLLoader.load(getClass().getResource("welcomeScreen.fxml")); @@ -35,10 +41,27 @@ public void start(Stage primaryStage) throws IOException { primaryStage.setScene(this.mainScene); primaryStage.show(); Loggers.setupLoggers(); + var warn = new Alert(AlertType.WARNING); + warn.setTitle("PathWeaver is deprecated!"); + warn.setHeaderText("PathWeaver is deprecated and will be removed by 2027."); + warn.setContentText("Consider using Choreo or PathPlanner instead."); + ButtonType learnMore = new ButtonType("Learn more"); + ButtonType okay = new ButtonType("Ok"); + warn.getButtonTypes().remove(0); + warn.getButtonTypes().addAll(learnMore, okay); + var result = warn.showAndWait(); + if (result.get().getText().equals("Learn more")) { + try { + Desktop.getDesktop().browse(new URI( + "https://docs.wpilib.org/en/latest/docs/software/pathplanning/pathweaver/introduction.html#deprecation-notice")); + } catch (IOException | URISyntaxException e) { + } + } } /** * The version of this build of PathWeaver. + * * @return String representing the version of PathWeaver. */ public static String getVersion() {