Skip to content

Commit

Permalink
Add deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 committed Dec 20, 2024
1 parent 44b09ac commit 232fc0c
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/main/java/edu/wpi/first/pathweaver/PathWeaver.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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"));
Expand All @@ -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() {
Expand Down

0 comments on commit 232fc0c

Please sign in to comment.