diff --git a/.version b/.version index 6dd61b6..396ec15 100644 --- a/.version +++ b/.version @@ -1,22 +1,9 @@ -1.1 +1.1.1 +Hotfix 1.1.1 +- Improve save dialog Version 1.1 - You can now add/replace/remove ORGs from within OrgAdder! - New options! - "REPLACE" - Replace ORG with new file - "EXTRACT" - Save ORG -- Change guide to match new ability -"Hotfix" 1.0.4 -- Add guide -Hotfix 1.0.3 -- Disallow empty ORG names -- Fix "Save EXE As..." not working -- Add IDs next to ORG names -Hotfix 1.0.2 -- App is no longer confused about what it is -- Fix error when adding/editing ORGs -Hotfix 1.0.1 -- This isn't OrgMaker! -- Fix error when cancelling "add/edit ORG" dialogs -- Disallow mutiple ORG names properly -Version 1.0 -- Initial release \ No newline at end of file +- Change guide to match new ability \ No newline at end of file diff --git a/src/main/java/com/leo/orgadder/DialogUtil.java b/src/main/java/com/leo/orgadder/DialogUtil.java index e114377..40cb004 100644 --- a/src/main/java/com/leo/orgadder/DialogUtil.java +++ b/src/main/java/com/leo/orgadder/DialogUtil.java @@ -34,24 +34,29 @@ public static File openFileDialog(boolean openOrSave, Component parent, String t dir = new File(System.getProperty("user.dir")); fc.setCurrentDirectory(dir); if (openOrSave) { - int ret = fc.showSaveDialog(parent); - if (ret == JFileChooser.APPROVE_OPTION) { - File sel = fc.getSelectedFile(); - String selName = sel.getName(); - String ext = filter.getExtensions()[0]; - if (!selName.contains(".") - || !selName.substring(selName.lastIndexOf(".") + 1, selName.length()).equalsIgnoreCase(ext)) { - selName += "." + ext; - sel = new File(sel.getParentFile().getPath() + "/" + selName); - } - if (sel.exists()) { - int confirm = JOptionPane.showConfirmDialog(parent, - "File \"" + sel.getAbsolutePath() + "\"\nalready exists! Overwrite it?", - "Overwrite selected file?", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); - if (confirm != JOptionPane.OK_OPTION) - return null; - } - return sel; + while (true) { + int ret = fc.showSaveDialog(parent); + if (ret == JFileChooser.APPROVE_OPTION) { + File sel = fc.getSelectedFile(); + String selName = sel.getName(); + String ext = filter.getExtensions()[0]; + if (!selName.contains(".") || !selName.substring(selName.lastIndexOf(".") + 1, selName.length()) + .equalsIgnoreCase(ext)) { + selName += "." + ext; + sel = new File(sel.getParentFile().getPath() + "/" + selName); + } + if (sel.exists()) { + int confirm = JOptionPane.showConfirmDialog(parent, + "File \"" + sel.getAbsolutePath() + "\"\nalready exists! Overwrite it?", + "Overwrite selected file?", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + if (confirm == JOptionPane.OK_OPTION) + return sel; + else + continue; + } + return sel; + } else + break; } } else { int ret = fc.showOpenDialog(parent); diff --git a/src/main/java/com/leo/orgadder/Main.java b/src/main/java/com/leo/orgadder/Main.java index 9c4b87c..af2a7d8 100644 --- a/src/main/java/com/leo/orgadder/Main.java +++ b/src/main/java/com/leo/orgadder/Main.java @@ -50,7 +50,7 @@ public class Main { public static final Logger LOGGER = LogManager.getLogger("OrgAdder"); - public static final Version VERSION = new Version("1.1"); + public static final Version VERSION = new Version("1.1.1"); public static final String UPDATE_CHECK_SITE = "https://raw.githubusercontent.com/Leo40Git/OrgAdder/master/.version"; public static final String DOWNLOAD_SITE = "https://github.com/Leo40Git/OrgAdder/releases/latest/"; public static final String ISSUES_SITE = "https://github.com/Leo40Git/OrgAdder/issues";