fixes, tidying things up for auto save

This commit is contained in:
Manindra Moharana
2014-01-13 20:43:48 +05:30
parent 507e3ca765
commit 27dc79e288
3 changed files with 9 additions and 8 deletions
@@ -61,7 +61,7 @@ public class AutoSaveUtil {
}
public void init(){
if(saveTime < 1000) return;
if(saveTime < 10000) saveTime = 10 * 1000;
//saveTime = 10 * 1000; //TODO: remove
timer = new Timer();
timer.schedule(new SaveTask(), saveTime, saveTime);
@@ -76,6 +76,7 @@ public class AutoSaveUtil {
}
private boolean saveSketch() throws IOException{
if(!editor.getSketch().isModified()) return false;
isSaving = true;
Sketch sc = editor.getSketch();
@@ -224,8 +225,8 @@ public class AutoSaveUtil {
@Override
public void run() {
try {
saveSketch();
ExperimentalMode.log("Backup Saved " + editor.getSketch().getMainFilePath());
if(saveSketch())
ExperimentalMode.log("Backup Saved " + editor.getSketch().getMainFilePath());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -245,7 +245,7 @@ public class DebugEditor extends JavaEditor implements ActionListener {
ta.setECSandThemeforTextArea(errorCheckerService, dmode);
addXQModeUI();
debugToolbarEnabled = new AtomicBoolean(false);
log("Sketch Path: " + path);
log("Sketch Path: " + path);
}
private void addXQModeUI(){
@@ -737,7 +737,6 @@ public class DebugEditor extends JavaEditor implements ActionListener {
if(autosaver != null)
autosaver.stop();
loadAutoSaver();
//System.out.println("LOADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
return didOpen;
}
@@ -878,10 +877,11 @@ public class DebugEditor extends JavaEditor implements ActionListener {
}
public void loadAutoSaver(){
log("Load Auto Saver()");
if(autosaver != null){
autosaver.stop();
}
autosaver = new AutoSaveUtil(this, dmode.autoSaveInterval);
autosaver = new AutoSaveUtil(this, ExperimentalMode.autoSaveInterval);
if(!autosaver.checkForPastSave()) {
autosaver.init();
return;
@@ -119,9 +119,9 @@ public class ExperimentalMode extends JavaMode {
volatile public static boolean errorCheckEnabled = true, warningsEnabled = true,
codeCompletionsEnabled = true, debugOutputEnabled = false, errorLogsEnabled = false;
public int autoSaveInterval = 5; //in minutes
public static int autoSaveInterval = 5; //in minutes
public final String prefErrorCheck = "pdex.errorCheckEnabled",
public static final String prefErrorCheck = "pdex.errorCheckEnabled",
prefWarnings = "pdex.warningsEnabled",
prefCodeCompletionEnabled = "pdex.ccEnabled",
prefDebugOP = "pdex.dbgOutput", prefErrorLogs = "pdex.writeErrorLogs", prefAutoSaveInterval = "pdex.autoSaveInterval";