From addd23b76089c5ae7fa1492485154b027200e205 Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Sat, 29 Jun 2024 13:30:01 -0500 Subject: [PATCH] confirm dialogs, fix index wipe bug --- src/MissPiggy.java | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/MissPiggy.java b/src/MissPiggy.java index c6448ef..9cacf66 100644 --- a/src/MissPiggy.java +++ b/src/MissPiggy.java @@ -87,9 +87,9 @@ public class MissPiggy implements ActionListener { toolsMenu = new JMenu("Tools"); helpMenu = new JMenu("Help"); - fileMenu.add(new JMenuItem("Deploy All Mods")); - fileMenu.add(new JMenuItem("Import Mod...")); - fileMenu.add(new JMenuItem("Remove All")); + fileMenu.add(new JMenuItem("Deploy Mods")); + fileMenu.add(new JMenuItem("Import Mod from File")); + fileMenu.add(new JMenuItem("Delete All")); fileMenu.add(new JSeparator()); fileMenu.add(new JMenuItem("Options")); fileMenu.add(new JMenuItem("Quit")); @@ -269,12 +269,15 @@ public class MissPiggy implements ActionListener { // Will likely split the below functions into separate classes to work with intellij GUI designer. public void deployModGUI() { - // prevent interruptions - frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - frame.setEnabled(false); + int result = JOptionPane.showConfirmDialog(frame, "A new PSARC will be generated. This can take several minutes.\nDuring this time, your computer may be very busy or slow.\n\nAre you sure you want to continue?", "Deploy Mods", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + if (result == JOptionPane.YES_OPTION) { + // prevent interruptions + frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); + frame.setEnabled(false); - // start - new Gonzo().DeployMods(this); + // start + new Gonzo().DeployMods(this); + } } public void wrapUpDeployment() { @@ -330,12 +333,13 @@ public class MissPiggy implements ActionListener { for (Main.Mod entry : Main.Mods) { new File(System.getProperty("user.home") + "/.firestar/mods/" + entry.path).delete(); } - } - new File(System.getProperty("user.home") + "/.firestar/mods/index").delete(); - Main.Mods.clear(); - InitializeModListStructure(); - InitializeModListInGUI(); + new File(System.getProperty("user.home") + "/.firestar/mods/index").delete(); + Main.Mods.clear(); + + InitializeModListStructure(); + InitializeModListInGUI(); + } } public void optionsGUI() {