load prev save if found

This commit is contained in:
Manindra Moharana
2014-01-12 19:23:03 +05:30
parent 3730031c25
commit 47a11b2f79
2 changed files with 36 additions and 3 deletions

View File

@@ -246,8 +246,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
addXQModeUI();
debugToolbarEnabled = new AtomicBoolean(false);
log("Sketch Path: " + path);
autosaver = new AutoSaveUtil(this, 5);
autosaver.init();
loadAutoSaver();
}
private void addXQModeUI(){
@@ -870,6 +869,25 @@ public class DebugEditor extends JavaEditor implements ActionListener {
}
return saved;
}
public void loadAutoSaver(){
autosaver = new AutoSaveUtil(this, 5);
if(!autosaver.checkForPastSave()) {
autosaver.init();
return;
}
File pastSave = autosaver.getPastSave();
int response = Base.showYesNoQuestion(this, "Unsaved backup found!", "An automatic backup of this " +
"sketch has been found. This may mean Processing quit unexpectedly last time.",
"Select YES to view it or NO to delete the backup.");
if(response == JOptionPane.YES_OPTION){
handleOpenInternal(pastSave.getAbsolutePath());
}
else{
autosaver.init();
}
}
/**
* Set text contents of a specific tab. Updates underlying document and text