|
@@ -1577,19 +1577,33 @@ public class GUI<E> implements CategoryListener {
|
|
|
int dialogResult = JOptionPane.showConfirmDialog(null, "Old autosave file was found, should it be loaded?",
|
|
|
warningText, dialogButton);
|
|
|
if (dialogResult == JOptionPane.YES_OPTION) {
|
|
|
+ if(dest.exists()){
|
|
|
model.setAutoSaveNr(dest.listFiles().length - 1);
|
|
|
mntmRedo.doClick();
|
|
|
- } else {
|
|
|
- controller.deleteDirectory(dest);
|
|
|
- dest.mkdirs();
|
|
|
- try {
|
|
|
- controller.autoSave();
|
|
|
- } catch (IOException e1) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e1.printStackTrace();
|
|
|
+ }else{
|
|
|
+ JOptionPane.showMessageDialog(frmCyberPhysical, "Autosave could not be loaded.");
|
|
|
+ setUpAutoSave(dest);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ setUpAutoSave(dest);
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Sets up autosave if no old one is loaded at the beginning
|
|
|
+ *
|
|
|
+ * @param dest
|
|
|
+ * path to save-folder
|
|
|
+ */
|
|
|
+ public void setUpAutoSave(File dest){
|
|
|
+ controller.deleteDirectory(dest);
|
|
|
+ dest.mkdirs();
|
|
|
+ try {
|
|
|
+ controller.autoSave();
|
|
|
+ } catch (IOException e1) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e1.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|